-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint unused_qualifications should have a machine-applicable suggestion #92198
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
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.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
I second that |
jyn514
added
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
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.
labels
Apr 26, 2023
Mentoring instructions: Add a new rust/compiler/rustc_resolve/src/late.rs Lines 3843 to 3851 in df0d9b4
buffer_lint_with_diagnostic .
|
jyn514
added
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`.
labels
Apr 26, 2023
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jul 13, 2023
…gestion, r=b-naber Add machine-applicable suggestion for `unused_qualifications` lint ``` error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:17:5 | LL | foo::bar(); | ^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-qualifications-suggestion.rs:3:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with the unqualified path | LL | bar(); | ~~~ ``` Closes rust-lang#92198.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jul 13, 2023
…gestion, r=b-naber Add machine-applicable suggestion for `unused_qualifications` lint ``` error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:17:5 | LL | foo::bar(); | ^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-qualifications-suggestion.rs:3:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with the unqualified path | LL | bar(); | ~~~ ``` Closes rust-lang#92198.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jul 13, 2023
…gestion, r=b-naber Add machine-applicable suggestion for `unused_qualifications` lint ``` error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:17:5 | LL | foo::bar(); | ^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-qualifications-suggestion.rs:3:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with the unqualified path | LL | bar(); | ~~~ ``` Closes rust-lang#92198.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
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.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In the middle of a large refactoring that was mostly automated by rust-analyzer's structural-search-and-replace, I had a lot of qualified paths that shouldn't be qualified. I made do with a regular text-based search-and-replace since I couldn't find a better way, but I think that better way could have been
cargo fix
, because introducing an import for the relevant type once per file is much easier than replacing all uses manually.As such, it would be nice if the unnecessary qualification lint had a machine-applicable suggestion attached to it.
However, one interesting thing about this is that I also had warnings about the import for that same type being unused. I don't know whether it would be possible with the current compiler infrastructure to create mutually-exclusive suggestions. Either way the suggestion would be helpful, since a simple
#![allow(unused_imports)]
could disable the automatic removal of the imports.The text was updated successfully, but these errors were encountered: