diff --git a/mehlon-server/lib.rs b/mehlon-server/lib.rs index ebf5db0..c782722 100644 --- a/mehlon-server/lib.rs +++ b/mehlon-server/lib.rs @@ -223,17 +223,13 @@ impl Server { let msg = conn.try_recv(); match msg { Ok(Some(ClientToServerMsg::LogIn(nick))) => { - // TODO use range_contains once it becomes - // available - // https://github.com/rust-lang/rust/issues/32311 - // Check that the nick uses valid characters let nick_has_valid_chars = nick .bytes() .all(|b| - (b >= b'0' && b <= b'9') || - (b >= b'a' && b <= b'z') || - (b >= b'A' && b <= b'Z') || + (b'0' ..= b'9').contains(&b) || + (b'a' ..= b'z').contains(&b) || + (b'A' ..= b'Z').contains(&b) || (b == b'-' || b == b'_')); let id = { diff --git a/mehlon-server/mapgen.rs b/mehlon-server/mapgen.rs index 5ab1bb1..f844125 100644 --- a/mehlon-server/mapgen.rs +++ b/mehlon-server/mapgen.rs @@ -367,11 +367,9 @@ impl MapgenMap { for z in pos_min.z - ex ..= pos_max.z + ex { let pos = Vector3::new(x, y, z) * CHUNKSIZE; if let Some(c) = self.chunks.get(&pos) { - // TODO use range_contains once it's available - // https://github.com/rust-lang/rust/issues/32311 - if x >= pos_min.x && x < pos_max.x && - y >= pos_min.y && y < pos_max.y && - z >= pos_min.z && z < pos_max.z { + if (pos_min.x .. pos_max.x).contains(&x) && + (pos_min.y .. pos_max.y).contains(&y) && + (pos_min.z .. pos_max.z).contains(&z) { if c.generation_phase != GenerationPhase::Done { sth_to_generate = true; } @@ -390,11 +388,9 @@ impl MapgenMap { f(pos, &chn.data); self.chunks.insert(pos, chn); } else { - // TODO use range_contains once it's available - // https://github.com/rust-lang/rust/issues/32311 - if x >= pos_min.x && x < pos_max.x && - y >= pos_min.y && y < pos_max.y && - z >= pos_min.z && z < pos_max.z { + if (pos_min.x .. pos_max.x).contains(&x) && + (pos_min.y .. pos_max.y).contains(&y) && + (pos_min.z .. pos_max.z).contains(&z) { sth_to_generate = true; } }