Update to Rust 1.49.0 (#457)

* Update to Rust 1.49.0

* Fix clippy::manual_range_contains warnings
This commit is contained in:
iceiix 2020-12-31 09:51:46 -08:00 committed by GitHub
parent 028ab1cbe3
commit b7bd59f75f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 15 deletions

View File

@ -17,7 +17,7 @@ jobs:
- name: Install Rust - name: Install Rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: 1.48.0 toolchain: 1.49.0
components: clippy, rustfmt components: clippy, rustfmt
default: true default: true
- name: Install dependencies - name: Install dependencies

View File

@ -66,7 +66,7 @@ from [GitHub Actions](https://actions-badge.atrox.dev/iceiix/stevenarella/goto?r
## Dependencies ## Dependencies
Requires Rust stable version 1.48.0 or newer. Requires Rust stable version 1.49.0 or newer.
**Debian/Ubuntu** **Debian/Ubuntu**

View File

@ -323,8 +323,8 @@ pub fn convert_legacy(c: &mut Component) {
current.text = txt.text[last..i].to_owned(); current.text = txt.text[last..i].to_owned();
last = next.0 + 1; last = next.0 + 1;
let mut modifier = if (color_char >= 'a' && color_char <= 'f') let mut modifier = if ('a'..='f').contains(&color_char)
|| (color_char >= '0' && color_char <= '9') || ('0'..='9').contains(&color_char)
{ {
Default::default() Default::default()
} else { } else {

View File

@ -302,7 +302,11 @@ fn flood_fill(snapshot: &world::Snapshot, visited: &mut Set, x: i32, y: i32, z:
let mut touched = 0; let mut touched = 0;
while let Some((x, y, z)) = next_position.pop_front() { while let Some((x, y, z)) = next_position.pop_front() {
let idx = (x | (z << 4) | (y << 8)) as usize; 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; continue;
} }
visited.set(idx, true); visited.set(idx, true);

View File

@ -151,7 +151,7 @@ impl ecs::System for LerpPosition {
pos.position = pos.position pos.position = pos.position
+ (target_pos.position - pos.position) * delta * target_pos.lerp_amount; + (target_pos.position - pos.position) * delta * target_pos.lerp_amount;
let len = (pos.position - target_pos.position).magnitude2(); 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; pos.position = target_pos.position;
} }
} }

View File

@ -430,7 +430,7 @@ impl World {
y: i32, y: i32,
z: i32, z: i32,
) -> Option<(Option<&mut Section>, &mut u32)> { ) -> Option<(Option<&mut Section>, &mut u32)> {
if y < 0 || y > 15 { if !(0..=15).contains(&y) {
return None; return None;
} }
if let Some(chunk) = self.chunks.get_mut(&CPos(x, z)) { 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))); let z2 = min(16, max(0, z + d - (cz << 4)));
for cy in cy1..cy2 { for cy in cy1..cy2 {
if cy < 0 || cy > 15 { if !(0..=15).contains(&cy) {
continue; continue;
} }
let section = &chunk.sections[cy as usize]; 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) { fn flag_section_dirty(&mut self, x: i32, y: i32, z: i32) {
if y < 0 || y > 15 { if !(0..=15).contains(&y) {
return; return;
} }
let cpos = CPos(x, z); 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 { fn set_block(&mut self, x: i32, y: i32, z: i32, b: block::Block) -> bool {
let s_idx = y >> 4; let s_idx = y >> 4;
if s_idx < 0 || s_idx > 15 { if !(0..=15).contains(&s_idx) {
return false; return false;
} }
let s_idx = s_idx as usize; 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 { fn get_block(&self, x: i32, y: i32, z: i32) -> block::Block {
let s_idx = y >> 4; let s_idx = y >> 4;
if s_idx < 0 || s_idx > 15 { if !(0..=15).contains(&s_idx) {
return block::Missing {}; return block::Missing {};
} }
match self.sections[s_idx as usize].as_ref() { 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 { fn get_block_light(&self, x: i32, y: i32, z: i32) -> u8 {
let s_idx = y >> 4; let s_idx = y >> 4;
if s_idx < 0 || s_idx > 15 { if !(0..=15).contains(&s_idx) {
return 0; return 0;
} }
match self.sections[s_idx as usize].as_ref() { 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) { fn set_block_light(&mut self, x: i32, y: i32, z: i32, light: u8) {
let s_idx = y >> 4; let s_idx = y >> 4;
if s_idx < 0 || s_idx > 15 { if !(0..=15).contains(&s_idx) {
return; return;
} }
let s_idx = s_idx as usize; 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 { fn get_sky_light(&self, x: i32, y: i32, z: i32) -> u8 {
let s_idx = y >> 4; let s_idx = y >> 4;
if s_idx < 0 || s_idx > 15 { if !(0..=15).contains(&s_idx) {
return 15; return 15;
} }
match self.sections[s_idx as usize].as_ref() { 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) { fn set_sky_light(&mut self, x: i32, y: i32, z: i32, light: u8) {
let s_idx = y >> 4; let s_idx = y >> 4;
if s_idx < 0 || s_idx > 15 { if !(0..=15).contains(&s_idx) {
return; return;
} }
let s_idx = s_idx as usize; let s_idx = s_idx as usize;