diff options
Diffstat (limited to '2024_rust/src/bin/day12.rs')
-rw-r--r-- | 2024_rust/src/bin/day12.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/2024_rust/src/bin/day12.rs b/2024_rust/src/bin/day12.rs index 4408980..d4a4cdf 100644 --- a/2024_rust/src/bin/day12.rs +++ b/2024_rust/src/bin/day12.rs @@ -38,7 +38,7 @@ fn region_v1(m: &Matrix, pos: matrix::Pos) -> (Price, HashSet<matrix::Pos>) { let mut visited: HashSet<matrix::Pos> = HashSet::new(); let mut pending: HashSet<matrix::Pos> = [pos].into(); let mut new_pending: HashSet<matrix::Pos>; - while pending.len() > 0 { + while !pending.is_empty() { new_pending = HashSet::new(); for p in pending { let adj = adj_same_region(m, p); @@ -161,7 +161,7 @@ fn region(m: &Matrix, pos: matrix::Pos, version: u8) -> (Price, HashSet<matrix:: fn region_v2(m: &Matrix, pos: matrix::Pos) -> HashSet<matrix::Pos> { let mut visited: HashSet<matrix::Pos> = HashSet::new(); let mut pending: HashSet<matrix::Pos> = [pos].into(); - while pending.len() > 0 { + while !pending.is_empty() { let mut new_pending: HashSet<matrix::Pos> = HashSet::new(); for pos in pending { // println!("Processing pos={pos:?}"); |