Skip to content
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

Add REDUNDANT_IMPORTS lint for new redundant import detection #123813

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 11, 2024

Defaults to Allow for now. Stacked on #123744 to avoid merge conflict, but much easier to review all as one.

r? petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 11, 2024
@compiler-errors compiler-errors added the I-lang-nominated Nominated for discussion during a lang team meeting. label Apr 11, 2024
@compiler-errors
Copy link
Member Author

nominating for T-lang to see if we'd like to keep this as allow or make it warn, etc., and perhaps to follow-up on the policy.

for the record, I think this lint is perhaps noisy but also very useful, so I'd like to see it at Warn level eventually. just not curious what the best rollout strategy is for that.

@compiler-errors compiler-errors force-pushed the redundant-lint branch 2 times, most recently from ddb8dda to 114154c Compare April 11, 2024 18:40
@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov added T-lang Relevant to the language team, which will review and decide on the PR/issue. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2024
@traviscross
Copy link
Contributor

traviscross commented May 1, 2024

@rustbot labels -I-lang-nominated

We discussed this in the lang meeting today. We came to the consensus that we want to split out into a separate allow-by-default lint (or, alternatively, not lint at all) the case of an import that is redundant due to a glob import.

There are two reasons for this.

One, and most importantly, is that if we were to not do this, a warn-by-default lint here would make adding functions, statics, consts, etc. to a prelude (including the one in the standard library) so disruptive as to have to be treated almost like a breaking change.

Two is that not doing this would make it annoying to migrate away from a glob import incrementally.

Once this case is separated out, we're OK with the remainder of this lint going directly to warn-by-default.

@rustbot rustbot removed the I-lang-nominated Nominated for discussion during a lang team meeting. label May 1, 2024
@petrochenkov
Copy link
Contributor

Let's first land the renaming and the warn -> allow change, and then change the lint logic itself.
@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 2, 2024
@petrochenkov petrochenkov removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label May 2, 2024
@compiler-errors
Copy link
Member Author

OK, I fixed the one nit. Haven't split/suppressed the glob behavior. I can open an issue to do that later.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 30, 2024
@petrochenkov
Copy link
Contributor

r=me with #123813 (comment) addressed.
@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 30, 2024
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 30, 2024
@compiler-errors
Copy link
Member Author

What the heck, I thought I literally fixed that. Sorry haha

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 31, 2024

📌 Commit f6f587e has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 31, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 31, 2024
…petrochenkov

Add `REDUNDANT_IMPORTS` lint for new redundant import detection

Defaults to Allow for now. Stacked on rust-lang#123744 to avoid merge conflict, but much easier to review all as one.

r? petrochenkov
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 31, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection)
 - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm)
 - rust-lang#128162 (Cleanup sys module to match house style)
 - rust-lang#128296 (Update target-spec metadata for loongarch64 targets)
 - rust-lang#128417 (Add `f16` and `f128` math functions)
 - rust-lang#128431 (Add myself as VxWorks target maintainer for reference)
 - rust-lang#128437 (improve bootstrap to allow selecting llvm tools individually)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request Jul 31, 2024
…petrochenkov

Add `REDUNDANT_IMPORTS` lint for new redundant import detection

Defaults to Allow for now. Stacked on rust-lang#123744 to avoid merge conflict, but much easier to review all as one.

r? petrochenkov
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 31, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#117468 (Stabilize Wasm relaxed SIMD)
 - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection)
 - rust-lang#127060 (Migrate `symbol-visibility` `run-make` test to rmake)
 - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm)
 - rust-lang#128296 (Update target-spec metadata for loongarch64 targets)
 - rust-lang#128416 (android: Remove libstd hacks for unsupported Android APIs)
 - rust-lang#128431 (Add myself as VxWorks target maintainer for reference)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 31, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection)
 - rust-lang#126697 ([RFC] mbe: consider the `_` in 2024 an expression)
 - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm)
 - rust-lang#128244 (Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks)
 - rust-lang#128431 (Add myself as VxWorks target maintainer for reference)
 - rust-lang#128438 (Add special-case for [T, 0] in dropck_outlives)
 - rust-lang#128457 (Fix docs for OnceLock::get_mut_or_init)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection)
 - rust-lang#126697 ([RFC] mbe: consider the `_` in 2024 an expression)
 - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm)
 - rust-lang#128244 (Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks)
 - rust-lang#128431 (Add myself as VxWorks target maintainer for reference)
 - rust-lang#128438 (Add special-case for [T, 0] in dropck_outlives)
 - rust-lang#128457 (Fix docs for OnceLock::get_mut_or_init)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 20379e4 into rust-lang:master Aug 1, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 1, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2024
Rollup merge of rust-lang#123813 - compiler-errors:redundant-lint, r=petrochenkov

Add `REDUNDANT_IMPORTS` lint for new redundant import detection

Defaults to Allow for now. Stacked on rust-lang#123744 to avoid merge conflict, but much easier to review all as one.

r? petrochenkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants