Skip to content

Commit

Permalink
Fix CI (#637)
Browse files Browse the repository at this point in the history
# Objective

Fix the CI

# Solution

- fix generated code and ignore specific style hints.
- some other misc fixes
  • Loading branch information
JackCrumpLeys authored Jul 26, 2024
1 parent 1331a79 commit 1ef81cc
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/valence_lang/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn build() -> anyhow::Result<TokenStream> {
let const_id = ident(translation.key.to_shouty_snake_case());
let key = &translation.key;
let english_translation = &translation.english_translation;
let doc = format!("\"{}\"", escape(english_translation));
let doc = format!("\"{}\"", escape(english_translation)).replace('`', "\\`");

quote! {
#[doc = #doc]
Expand Down
10 changes: 5 additions & 5 deletions crates/valence_nbt/src/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
//! "byte" => 5_i8,
//! "string" => "hello",
//! "list_of_float" => List::Float(vec![
//! 3.1415,
//! 2.7182,
//! std::f32::consts::PI,
//! std::f32::consts::E,
//! 1.4142
//! ]),
//! };
//!
//! let mut buf = vec![];
//!
//! to_binary(&mut buf, "", &c).unwrap();
//! to_binary(&c, &mut buf, "").unwrap();
//! ```
//!
//! Decode NBT data from its binary form.
Expand All @@ -32,9 +32,9 @@
//! "int" => 0xdead
//! };
//!
//! let (root_name, nbt) = from_binary(&mut some_bytes.as_slice()).unwrap().unwrap();
//! let (nbt, root_name) = from_binary(&mut some_bytes.as_slice()).unwrap();
//!
//! assert_eq!(nbt, Value::from(expected_value));
//! assert_eq!(nbt, expected_value);
//! assert_eq!(root_name, "");
//! ```

Expand Down
8 changes: 4 additions & 4 deletions crates/valence_server/src/layer/chunk/loaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ impl LoadedChunk {
self.changed_biomes = false;

messages.send_local_infallible(LocalMsg::ChangeBiome { pos }, |buf| {
for sect in self.sections.iter() {
for sect in &self.sections {
sect.biomes
.encode_mc_format(
&mut *buf,
Expand Down Expand Up @@ -390,7 +390,7 @@ impl LoadedChunk {

let mut blocks_and_biomes: Vec<u8> = vec![];

for sect in self.sections.iter() {
for sect in &self.sections {
sect.count_non_air_blocks()
.encode(&mut blocks_and_biomes)
.unwrap();
Expand Down Expand Up @@ -463,7 +463,7 @@ impl LoadedChunk {
assert!(!self.changed_biomes);
assert!(self.changed_block_entities.is_empty());

for sect in self.sections.iter() {
for sect in &self.sections {
assert!(sect.updates.is_empty());
}
}
Expand Down Expand Up @@ -686,7 +686,7 @@ impl Chunk for LoadedChunk {
fn shrink_to_fit(&mut self) {
self.cached_init_packets.get_mut().shrink_to_fit();

for sect in self.sections.iter_mut() {
for sect in &mut self.sections {
sect.block_states.shrink_to_fit();
sect.biomes.shrink_to_fit();
sect.updates.shrink_to_fit();
Expand Down
2 changes: 1 addition & 1 deletion crates/valence_spatial/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# valence_spatial
# `valence_spatial`

An implementation of a [bounding volume hierarchy](https://en.wikipedia.org/wiki/Bounding_volume_hierarchy) (BVH) for fast spatial queries.
1 change: 1 addition & 0 deletions crates/valence_text/src/into_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ mod tests {
use super::*;

#[test]
#[allow(clippy::needless_borrows_for_generic_args)]
fn intotext_trait() {
fn is_borrowed<'a>(value: impl IntoText<'a>) -> bool {
matches!(value.into_cow_text(), Cow::Borrowed(..))
Expand Down
10 changes: 7 additions & 3 deletions tools/packet_inspector/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ pub fn main() -> anyhow::Result<()> {
}

fn write_packets(packets: &Vec<Packet>) -> anyhow::Result<()> {
let mut consts = TokenStream::new();
let mut consts = quote! {
#[allow(clippy::unseparated_literal_suffix)]

};

let len = packets.len();

Expand Down Expand Up @@ -173,14 +176,14 @@ fn write_transformer(packets: &[Packet]) -> anyhow::Result<()> {
side_arms.extend(quote! {
valence_protocol::PacketState::#state => match packet.id {
#match_arms
_ => Ok(NOT_AVAILABLE.to_string()),
_ => Ok(NOT_AVAILABLE.to_owned()),
},
});
}

if side == "Clientbound" {
side_arms.extend(quote! {
_ => Ok(NOT_AVAILABLE.to_string()),
_ => Ok(NOT_AVAILABLE.to_owned()),
});
}

Expand All @@ -197,6 +200,7 @@ fn write_transformer(packets: &[Packet]) -> anyhow::Result<()> {
let generated = quote! {
const NOT_AVAILABLE: &str = "Not yet implemented";

#[allow(clippy::match_wildcard_for_single_variants)]
pub(crate) fn packet_to_string(packet: &ProxyPacket) -> Result<String, Box<dyn std::error::Error>> {
let bytes = packet.data.as_ref().unwrap();
let mut data = &bytes.clone()[..];
Expand Down

0 comments on commit 1ef81cc

Please sign in to comment.