rust/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
359 B
Rust
Raw Normal View History

2023-07-11 09:22:22 -05:00
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
}
};
}