Closed
Description
Clippy gives confusing help-message for the following code:
let mut v = vec![1i8, 2, 3];
for ref mut val in &mut v {
...
}
warning: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
--> src/main.rs:3:9
|
3 | for ref mut _val in &mut v {
| ^^^^^^^^^^^^
|
= note: #[warn(toplevel_ref_arg)] on by default
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#toplevel_ref_arg
help: try
| let _val = &mut for ref mut _val in &mut v {
| };
ref mut
can simply be removed, let
isn't needed here.