1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 #![warn(clippy::for_kv_map)]
11 #![allow(clippy::used_underscore_binding)]
13 use std::collections::*;
17 let m: HashMap<u64, u64> = HashMap::new();
22 let m: Rc<HashMap<u64, u64>> = Rc::new(HashMap::new());
25 // Here the `*` is not actually necessary, but the test tests that we don't
27 // `in *m.values()` as we used to
30 let mut m: HashMap<u64, u64> = HashMap::new();
31 for (_, v) in &mut m {
35 let m: &mut HashMap<u64, u64> = &mut HashMap::new();
36 for (_, v) in &mut *m {
40 let m: HashMap<u64, u64> = HashMap::new();
42 for (k, _value) in rm {
48 fn test_for_kv_map() {
49 let m: HashMap<u64, u64> = HashMap::new();
51 // No error, _value is actually used
52 for (k, _value) in &m {