Auto merge of #3622 - m-cat:master, r=phansch

Add ui/for_kv_map test for false positive in #1279

Fixes #1279
This commit is contained in:
bors 2019-01-03 19:49:07 +00:00
commit 261ebcfbb4

View File

@ -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;
}
}