mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Add ui/for_kv_map test for false positive in #1279
This commit is contained in:
parent
5b8b01e8dc
commit
5f0d46cd48
1 changed files with 7 additions and 4 deletions
|
@ -42,15 +42,18 @@ fn main() {
|
|||
for (k, _value) in rm {
|
||||
let _k = k;
|
||||
}
|
||||
test_for_kv_map();
|
||||
}
|
||||
|
||||
fn test_for_kv_map() {
|
||||
// The following should not produce warnings.
|
||||
|
||||
let m: HashMap<u64, u64> = HashMap::new();
|
||||
|
||||
// No error, _value is actually used
|
||||
for (k, _value) in &m {
|
||||
let _ = _value;
|
||||
let _k = k;
|
||||
}
|
||||
|
||||
let m: HashMap<u64, String> = Default::default();
|
||||
for (_, v) in m {
|
||||
let _v = v;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue