unqualified_local_imports
lint does not trigger on import of local reimport of foreign item
#138908
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
I don’t know if this is intentional, but it surprised me that the lint would not trigger for an import whose first path segment is not
super
,self
,crate
or the name of an external crate.When using
rustfmt
withgroup_imports = "StdExternalCrate"
,use Prefilter::*
will be put into the “external” section byrustfmt
, even though it’s (from the point of view of the module) a local name.Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=37d2c33bbaf85ecf5d598009ac07ae3e
Playground link with reimport of local type: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=b8ab3ad23c3e4851c62f118d24d8bf83
Tracking issue: #138299
This simpler case also does not trigger the lint, but in this case, it’s easier to see where the imported item comes from than in the case with
use super::*;
, where the inner module can be in a different file than the original import of the item, but even in this case sorting the imports will probably make the code harder to read by moving both imports further away from each other.Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=9a73ab3b4b2a256d3dc3de46d009c15e
Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: