cargo clippy --fix
leaves blank lines when removing entire use
statements
#121751
Labels
C-bug
Category: This is a bug.
Summary
cargo clippy --fix
can remove entireuse
statements if all of the imported names are unused, but it leaves a blank line behind. With a large number ofuse
lines, this can result in imports being fragmented into multiple blocks that won't ever be joined back together. If clippy removes an entireuse
statement, it should remove the trailing newline at the end, too.Reproducer
I tried this code:
I expected to see this happen:
Running
cargo clippy --fix
should have removed theuse
lines forAny
andResult
and kept the block of imports together, like this:Instead, this happened:
cargo clippy --fix
left blank lines, splitting the block of imports:Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: