cargo fix
on unused use
statements leaves empty lines behind.
#120296
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Run
cargo fix
on the following:Current output
cargo fix will remove the unused
use
statements but will leave an empty line behind for each one. In this case that is 3 empty lines:Desired output
No empty lines left behind:
Rationale and extra context
Leaving those empty lines around means they need to be manually cleaned up and I dont think there is ever a scenario where someone would want the empty line left behind.
I'm not sure if this is a cargo bug or a rustc bug.
I know rustc emits some kind of span to tell cargo what change needs to occur?
But maybe its cargo not interpreting the span correctly?
Other cases
No response
Rust Version
It has been this way for as long as I can remember but: rustc 1.75.0 (82e1608df 2023-12-21) binary: rustc commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112 commit-date: 2023-12-21 host: x86_64-unknown-linux-gnu release: 1.75.0 LLVM version: 17.0.6
Anything else?
No response
The text was updated successfully, but these errors were encountered: