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

Silence unused_imports for redundant imports #123744

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

compiler-errors
Copy link
Member

Quick fix for #121708 (comment)

r? @petrochenkov cc @joshtriplett

I think this is right, would like confirmation. I also think it's weird that we're using = to assign to is_redundant but using per_ns for the actual spans. Seems like this could be weirdly order dependent, but that's unrelated to this change.

@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 10, 2024
@petrochenkov
Copy link
Contributor

Or should we just suppress all redundant imports?

Yes, this PR as is doesn't cover redundant stdlib prelude imports, which are the largest source of regressions (they don't look like globs from other crates).

I suggest just commenting out the buffer_lint_with_diagnostic call in fn check_for_redundant_imports on beta.
And migrate the whole logic to a new redundant_imports lint on master.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2024
@compiler-errors compiler-errors changed the title Silence unused_imports if import comes from glob Silence unused_imports for redundant imports Apr 11, 2024
@compiler-errors
Copy link
Member Author

@rustbot ready

Ok, just silenced the whole thing

@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 Apr 11, 2024
@compiler-errors
Copy link
Member Author

🤦 push didn't go through, one sec

@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 11, 2024
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

Ok, it's probably fine to land this on master as well.
@bors r+

@bors
Copy link
Contributor

bors commented Apr 11, 2024

📌 Commit 0db2a40 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#122882 (Avoid a panic in `set_output_capture` in the default panic handler)
 - rust-lang#123523 (Account for trait/impl difference when suggesting changing argument from ref to mut ref)
 - rust-lang#123744 (Silence `unused_imports` for redundant imports)
 - rust-lang#123784 (Replace `document.write` with `document.head.insertAdjacent`)
 - rust-lang#123798 (Avoid invalid socket address in length calculation)
 - rust-lang#123804 (Stop using `HirId` for fn-like parents since closures are not `OwnerNode`s)
 - rust-lang#123806 (Panic on overflow in `BorrowedCursor::advance`)
 - rust-lang#123820 (Add my former address to .mailmap)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit da75aaf into rust-lang:master Apr 11, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 12, 2024
Rollup merge of rust-lang#123744 - compiler-errors:redundant-due-to-glob, r=petrochenkov

Silence `unused_imports` for redundant imports

Quick fix for rust-lang#121708 (comment)

r? `@petrochenkov` cc `@joshtriplett`

I think this is right, would like confirmation. I also think it's weird that we're using `=` to assign to `is_redundant` but using `per_ns` for the actual spans. Seems like this could be weirdly order dependent, but that's unrelated to this change.
@compiler-errors compiler-errors deleted the redundant-due-to-glob branch April 12, 2024 16:29
@apiraino
Copy link
Contributor

Beta backport approved as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle.

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 18, 2024
@cuviper cuviper mentioned this pull request Apr 18, 2024
@cuviper cuviper modified the milestones: 1.79.0, 1.78.0 Apr 18, 2024
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
[beta] backports

- Silence `unused_imports` lint for redundant imports rust-lang#123744
- Call the panic hook for non-unwind panics in proc-macros rust-lang#123825
- rustdoc: check redundant explicit links with correct itemid rust-lang#123905

r? cuviper
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
[beta] backports

- Silence `unused_imports` lint for redundant imports rust-lang#123744
- Call the panic hook for non-unwind panics in proc-macros rust-lang#123825
- rustdoc: check redundant explicit links with correct itemid rust-lang#123905
- disable two debuginfo tests under gdb 15 rust-lang#123963

r? cuviper
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
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
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
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
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler 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