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
uses: actions-rs/toolchain@v1
with:
toolchain: 1.48.0
toolchain: 1.49.0
components: clippy, rustfmt
default: true
- name: Install dependencies

View File

@ -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**

View File

@ -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 {

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;