Skip to content

Commit

Permalink
Auto merge of #3622 - m-cat:master, r=phansch
Browse files Browse the repository at this point in the history
Add ui/for_kv_map test for false positive in #1279

Fixes #1279
  • Loading branch information
bors committed Jan 3, 2019
2 parents c7c75db + 5f0d46c commit 261ebcf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/ui/for_kv_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ fn main() {
for (k, _value) in rm {
let _k = k;
}
test_for_kv_map();
}

fn test_for_kv_map() {
let m: HashMap<u64, u64> = HashMap::new();
// 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;
}
}

0 comments on commit 261ebcf

Please sign in to comment.