summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs
blob: e4721ba0193375fa464b34166123655c6ca19223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::collections::HashMap;
struct X(usize);
struct Y {
    v: u32,
}

fn main() {
    let _ = || {
        let mut buzz = HashMap::new();
        buzz.insert("a", Y { v: 0 });

        for mut t in buzz.values() {
            //~^ HELP
            //~| SUGGESTION values_mut()
            t.v += 1;
            //~^ ERROR cannot assign
        }
    };
}