Incorrect suggestion in useless_attribute
lint
#4467
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
L-suggestion
Lint: Improving, adding or fixing lint suggestions
The
useless_attribute
lint is meant to warn aboutextern crate
anduse
items with outer lint attributes (for example#[allow(dead_code)]
).However, when this lint triggers on items that are preceded by other items, applying the suggestion will fail to compile.
Minimal example (Playground Link):
Produces:
But applying the suggestion results in:
To fix this, we could
a) Try to find a way to detect if the
use
/extern crate
is preceded by any other itemsb) Remove the suggestion completely if a) turns out impossible
The text was updated successfully, but these errors were encountered: