length comparison to zero in /civ/mod.rs

warning: length comparison to zero
   --> world/src/civ/mod.rs:482:15
    |
482 |         while to_explore.len() > 0 {
    |               ^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!to_explore.is_empty()`
    |
    = note: `#[warn(clippy::len_zero)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

warning: length comparison to zero
   --> world/src/civ/mod.rs:489:19
    |
489 |             while to_floodfill.len() > 0 {
    |                   ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!to_floodfill.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
This commit is contained in:
floppy 2022-01-18 00:41:59 +01:00
parent fd920cea1d
commit 1a5c1ae319

View File

@ -479,14 +479,14 @@ impl Civs {
to_explore.insert(start_point);
explored.insert(start_point);
while to_explore.len() > 0 {
while !to_explore.is_empty() {
let exploring = *to_explore.iter().next().unwrap();
to_explore.remove(&exploring);
to_floodfill.insert(exploring);
// Should always be a chunk on the map
let biome = ctx.sim.chunks[exploring].get_biome();
biomes.push((biome, Vec::new()));
while to_floodfill.len() > 0 {
while !to_floodfill.is_empty() {
let filling = *to_floodfill.iter().next().unwrap();
to_explore.remove(&filling);
to_floodfill.remove(&filling);