diff --git a/tests/ui/for_kv_map.rs b/tests/ui/for_kv_map.rs index d79ea4beb..549187756 100644 --- a/tests/ui/for_kv_map.rs +++ b/tests/ui/for_kv_map.rs @@ -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 = HashMap::new(); - // No error, _value is actually used for (k, _value) in &m { let _ = _value; let _k = k; } + + let m: HashMap = Default::default(); + for (_, v) in m { + let _v = v; + } }