Repository navigation
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.L-redundant_importsLint: redundant_importsLint: redundant_importsS-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.Status: Awaiting review from the assignee but also interested parties.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Description
I've noticed there is a lot of fallout from the changes in #117772 expanding redundant import checking. See discussion and backlinks on that issue as well as #118692 for some evidence.
I have a theory that redundant imports should be split out into their own lint group (this was discussed in the past), and that in the future as a matter of policy, disruptive expansions like this should come with a machine-applicable fix to make rollout smoother.
For now, I'm opening this issue to collect data and feedback that I want to use to inform future policy discussions around lint expansions.
Reacted by Chris
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.L-redundant_importsLint: redundant_importsLint: redundant_importsS-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.Status: Awaiting review from the assignee but also interested parties.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Activity
tmandry commentedon Feb 27, 2024
FYI @surechen @petrochenkov - Not trying to single you out here, but I would like your input. This is a problem I've noticed in past lint expansions, and it seems useful to focus discussion around a concrete incidence.
tmandry commentedon Feb 27, 2024
craterbot commentedon Feb 27, 2024
tmandry commentedon Feb 27, 2024
I'm interested to see what kind of numbers crater can give us.
@craterbot run name=redundant-imports start=master#6f726205a1b7992537ddec96c83f2b054b03e04f+rustflags=-Dunused-imports end=master#8b21296b5db6d5724d6b8440dcf459fa82fd88b5+rustflags=-Dunused-imports crates=top-1000 mode=check-only p=2
craterbot commentedon Feb 27, 2024
👌 Experiment
redundant-importscreated and queued.🔍 You can check out the queue and this experiment's details.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
tmandry commentedon Feb 27, 2024
Now I see that the only p=1 in the queue has a similar number of crates to build, so let's use the same priority.
@craterbot name=redundant-imports p=1
craterbot commentedon Feb 27, 2024
📝 Configuration of the
redundant-importsexperiment changed.ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
surechen commentedon Feb 28, 2024
Hi, thank you for starting the discussion.
As a newbie to compilers, this PR was originally intended to address a smaller scope issue #117448, detecting redundant imports which should only be imported by prelude, petrochenkov provided a lot of help in the comments. I very much recognized his comment: #117772 (comment) and asked for help, so he patiently guided me to develop this PR. So my views here may not be professional enough and can only represent my own.
I think Rust's powerful detection capabilities make me more confident in the code I develop. In my mind, ideally, the compiler can help me find all problems, so stricter checking of redundant imports will not cause too much trouble, but it will help me.
Of course, if some lints will invalidate a large amount of existing code, it will really increase my burden, so if the community has some future policies or some measures to make the changes smoother, then I will appreciate it very much, and I will also be very happy to participate in the discussion or do some development.
Robbepop commentedon Feb 28, 2024
Hi, today I noticed that this is causing a lot of trouble for my crates in the Wasmi workspace, particularly the
wasmi_corecrate. I mistakenly thought this was aclippyissue first and reported it there and got rerouted to this issue fortunately. For the sake of providing my use case that causes issues with the expanded import checking I will copy what I wrote in theclippybug report below.Summary
For my crate
wasmi_corein https://github.com/wasmi-labs/wasmi/tree/master/crates/core I see the following warnings when runningclippyrustcon nightly channel:Many more warnings pop up, but they all are very similar to the one above.
This import is required for proper
no_stdbuilds.In
lib.rswe do:Thus
allocis always available as crate root import.Lint Name
unused_imports
Reproducer
rev = a2f299af2f97af3691e195a4473abaa93bca72f7)rustcfrom currentnightlychannel.cargo +nightly check -p wasmi_coreVersion
craterbot commentedon Feb 28, 2024
🚧 Experiment
redundant-importsis now runningℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
72 remaining items
[cr133][Rust] unused imports.
[cr133][rust] Fix unused imports in brave code
[cr133][Rust] unused imports.
[cr133][rust] Fix unused imports in brave code
[cr133][Rust] unused imports.
[cr133][rust] Fix unused imports in brave code
[cr133][Rust] unused imports.
[cr133][rust] Fix unused imports in brave code
[cr133][Rust] unused imports.
[cr133][rust] Fix unused imports in brave code
[cr133][Rust] unused imports.
[cr133][rust] Fix unused imports in brave code
[cr133][Rust] unused imports.