diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0791159..0a01eef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,7 +17,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.48.0 + toolchain: 1.49.0 components: clippy, rustfmt default: true - name: Install dependencies diff --git a/README.md b/README.md index 37c07bd..321acb4 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ from [GitHub Actions](https://actions-badge.atrox.dev/iceiix/stevenarella/goto?r ## Dependencies -Requires Rust stable version 1.48.0 or newer. +Requires Rust stable version 1.49.0 or newer. **Debian/Ubuntu** diff --git a/protocol/src/format.rs b/protocol/src/format.rs index 0b470ff..bfa0887 100644 --- a/protocol/src/format.rs +++ b/protocol/src/format.rs @@ -323,8 +323,8 @@ pub fn convert_legacy(c: &mut Component) { current.text = txt.text[last..i].to_owned(); last = next.0 + 1; - let mut modifier = if (color_char >= 'a' && color_char <= 'f') - || (color_char >= '0' && color_char <= '9') + let mut modifier = if ('a'..='f').contains(&color_char) + || ('0'..='9').contains(&color_char) { Default::default() } else { diff --git a/src/chunk_builder.rs b/src/chunk_builder.rs index 5bdd915..cc63af9 100644 --- a/src/chunk_builder.rs +++ b/src/chunk_builder.rs @@ -302,7 +302,11 @@ fn flood_fill(snapshot: &world::Snapshot, visited: &mut Set, x: i32, y: i32, z: let mut touched = 0; while let Some((x, y, z)) = next_position.pop_front() { let idx = (x | (z << 4) | (y << 8)) as usize; - if x < 0 || x > 15 || y < 0 || y > 15 || z < 0 || z > 15 || visited.get(idx) { + if !(0..=15).contains(&x) + || !(0..=15).contains(&y) + || !(0..=15).contains(&z) + || visited.get(idx) + { continue; } visited.set(idx, true); diff --git a/src/entity/systems.rs b/src/entity/systems.rs index 73c75c9..922de11 100644 --- a/src/entity/systems.rs +++ b/src/entity/systems.rs @@ -151,7 +151,7 @@ impl ecs::System for LerpPosition { pos.position = pos.position + (target_pos.position - pos.position) * delta * target_pos.lerp_amount; let len = (pos.position - target_pos.position).magnitude2(); - if len < 0.001 || len > 100.0 * 100.0 { + if !(0.001..=100.0 * 100.0).contains(&len) { pos.position = target_pos.position; } } diff --git a/src/world/mod.rs b/src/world/mod.rs index bb3cdbc..a4ad809 100644 --- a/src/world/mod.rs +++ b/src/world/mod.rs @@ -430,7 +430,7 @@ impl World { y: i32, z: i32, ) -> Option<(Option<&mut Section>, &mut u32)> { - if y < 0 || y > 15 { + if !(0..=15).contains(&y) { return None; } if let Some(chunk) = self.chunks.get_mut(&CPos(x, z)) { @@ -540,7 +540,7 @@ impl World { let z2 = min(16, max(0, z + d - (cz << 4))); for cy in cy1..cy2 { - if cy < 0 || cy > 15 { + if !(0..=15).contains(&cy) { continue; } let section = &chunk.sections[cy as usize]; @@ -1124,7 +1124,7 @@ impl World { } fn flag_section_dirty(&mut self, x: i32, y: i32, z: i32) { - if y < 0 || y > 15 { + if !(0..=15).contains(&y) { return; } let cpos = CPos(x, z); @@ -1255,7 +1255,7 @@ impl Chunk { fn set_block(&mut self, x: i32, y: i32, z: i32, b: block::Block) -> bool { let s_idx = y >> 4; - if s_idx < 0 || s_idx > 15 { + if !(0..=15).contains(&s_idx) { return false; } let s_idx = s_idx as usize; @@ -1297,7 +1297,7 @@ impl Chunk { fn get_block(&self, x: i32, y: i32, z: i32) -> block::Block { let s_idx = y >> 4; - if s_idx < 0 || s_idx > 15 { + if !(0..=15).contains(&s_idx) { return block::Missing {}; } match self.sections[s_idx as usize].as_ref() { @@ -1308,7 +1308,7 @@ impl Chunk { fn get_block_light(&self, x: i32, y: i32, z: i32) -> u8 { let s_idx = y >> 4; - if s_idx < 0 || s_idx > 15 { + if !(0..=15).contains(&s_idx) { return 0; } match self.sections[s_idx as usize].as_ref() { @@ -1319,7 +1319,7 @@ impl Chunk { fn set_block_light(&mut self, x: i32, y: i32, z: i32, light: u8) { let s_idx = y >> 4; - if s_idx < 0 || s_idx > 15 { + if !(0..=15).contains(&s_idx) { return; } let s_idx = s_idx as usize; @@ -1337,7 +1337,7 @@ impl Chunk { fn get_sky_light(&self, x: i32, y: i32, z: i32) -> u8 { let s_idx = y >> 4; - if s_idx < 0 || s_idx > 15 { + if !(0..=15).contains(&s_idx) { return 15; } match self.sections[s_idx as usize].as_ref() { @@ -1348,7 +1348,7 @@ impl Chunk { fn set_sky_light(&mut self, x: i32, y: i32, z: i32, light: u8) { let s_idx = y >> 4; - if s_idx < 0 || s_idx > 15 { + if !(0..=15).contains(&s_idx) { return; } let s_idx = s_idx as usize;