In the following snippet, rustc suggests to remove just the & instead of removing the &mut, resulting in an invalid suggestion: mut format!("").
fn main() {
let _: String = &mut format!("");
}
error[E0308]: mismatched types
--> src/main.rs:2:21
|
2 | let _: String = &mut format!("");
| ------ ^^^^^^^^^^^^^^^^
| | |
| | expected struct `String`, found `&mut String`
| | help: consider removing the borrow: `mut format!("")`
| expected due to this
In the following snippet, rustc suggests to remove just the
&instead of removing the&mut, resulting in an invalid suggestion:mut format!("").