Open
Description
When a suggestion removes a line the diff suggests removing and re-adding the previous line. We do these kinds of suggestions a fair bit in clippy to make --fix
actually remove the line.
e.g. in needless_return
the code:
fn main() {
if true {
println!("foo");
return;
} else {
println!("bar");
}
}
Gives the suggestion:
--> src/main.rs:3:25
|
3 | println!("foo");
| _________________________^
4 | | return;
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
3 - println!("foo");
4 - return;
3 + println!("foo");
|
This suggests to remove and re-add println!("foo");
rather than just remove the return
line. The lint span spanning multiple lines is entirely on clippy, but the suggestion display can't be fixed by us.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Too much output caused by a single piece of incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.