Skip to content

Commit 5027575

Browse files
committed
Fix clippy lints in tests
1 parent 3bea5ce commit 5027575

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/map.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3556,6 +3556,7 @@ mod test_map {
35563556
assert_eq!(m.len(), 1);
35573557
assert!(m.insert(2, 4).is_none());
35583558
assert_eq!(m.len(), 2);
3559+
#[allow(clippy::redundant_clone)]
35593560
let m2 = m.clone();
35603561
assert_eq!(*m2.get(&1).unwrap(), 2);
35613562
assert_eq!(*m2.get(&2).unwrap(), 4);
@@ -4191,6 +4192,7 @@ mod test_map {
41914192
map.insert(2, 1);
41924193
map.insert(3, 4);
41934194

4195+
#[allow(clippy::no_effect)] // false positive lint
41944196
map[&4];
41954197
}
41964198

tests/set.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ fn test_hashset_insert_remove() {
1717
.map(|_| (rng.sample_iter(&Alphanumeric).take(32).collect()))
1818
.collect();
1919

20+
// more readable with explicit `true` / `false`
21+
#[allow(clippy::bool_assert_comparison)]
2022
for _ in 0..32 {
21-
for i in 0..4096 {
22-
assert_eq!(m.contains(&tx[i].clone()), false);
23-
assert_eq!(m.insert(tx[i].clone()), true);
23+
for x in tx.iter() {
24+
assert_eq!(m.contains(x), false);
25+
assert_eq!(m.insert(x.clone()), true);
2426
}
25-
for i in 0..4096 {
26-
println!("removing {} {:?}", i, tx[i]);
27-
assert_eq!(m.remove(&tx[i]), true);
27+
for (i, x) in tx.iter().enumerate() {
28+
println!("removing {} {:?}", i, x);
29+
assert_eq!(m.remove(x), true);
2830
}
2931
}
3032
}

0 commit comments

Comments
 (0)