Skip to content

Lint cleanups#157689

Open
nnethercote wants to merge 7 commits into
rust-lang:mainfrom
nnethercote:lint-cleanups
Open

Lint cleanups#157689
nnethercote wants to merge 7 commits into
rust-lang:mainfrom
nnethercote:lint-cleanups

Conversation

@nnethercote

@nnethercote nnethercote commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

View all comments

Details in individual commits.

r? @GuillaumeGomez

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 10, 2026
@nnethercote

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 10, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 823510d (823510d73548f1ca5796a6ff7c04871b48c2ee61, parent: d56483a91d6cf5041351a3208b8d08f98f0c8b56)

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 10, 2026
@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Jun 12, 2026
@nnethercote

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 12, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 12, 2026
@nnethercote nnethercote marked this pull request as ready for review June 12, 2026 10:12
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 12, 2026
@rustbot

rustbot commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 12, 2026
@samueltardieu

Copy link
Copy Markdown
Member

@nnethercote Those changes will conflict on the Clippy side with the ones being currently merged: https://github.com/rust-lang/rust/pull/157779/changes#diff-87bfc7a19a52188bf03cd0c38999b9a1adf259e1631f5c493cd30704340dd602

Also, clippy_dev/src/new_lint.rs should probably be modified as well as it auto-generates the initialization line for added lints, which should probably now use b!() or similar.

@rust-bors

rust-bors Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f45cfe7 (f45cfe742c19a6dfd7dd26799f4fa71dbbe9998f, parent: 09a371361240e42b0d69438fd1179efcf212e576)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f45cfe7): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (secondary -3.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.6%, -2.8%] 3
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 517.481s -> 517.406s (-0.01%)
Artifact size: 401.31 MiB -> 400.78 MiB (-0.13%)

@rustbot rustbot removed the perf-regression Performance regression. label Jun 12, 2026
Comment thread compiler/rustc_lint/src/lib.rs Outdated
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@nnethercote

Copy link
Copy Markdown
Contributor Author

#157762 turns out to not be necessary but these cleanups are still worth merging. I removed the final commit that only affected Clippy.

@nnethercote

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 15, 2026
@rust-bors

rust-bors Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e117acb (e117acb473f5df1f81809e9264436858117b1d4a, parent: 3daae5e42ec9ba435212987331af1b7b8634fa90)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e117acb): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 0.1%, secondary 0.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
6.1% [6.1%, 6.1%] 1
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-5.8% [-5.8%, -5.8%] 1
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) 0.1% [-5.8%, 6.1%] 2

Cycles

Results (primary -1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.2% [-1.2%, -1.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.2% [-1.2%, -1.2%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 519.503s -> 523.672s (0.80%)
Artifact size: 401.51 MiB -> 401.00 MiB (-0.13%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@nnethercote

Copy link
Copy Markdown
Contributor Author

I rebased.

@rust-bors

This comment has been minimized.

By using `retain` instead of `into_iter`/`filter`/`collect`.
All the other paired methods in this trait have the form
`check_foo`/`check_foo_post`.
Currently the use points need to handle method attributes, due to a
single low-value doc comment in each macro's body. This commit moves
those doc comments so the use points can be simplified. The comments are
also made more accurate -- there are now multiple `_post` methods and
the comments now cover all of them, not just one of them.
That reflects how they're mostly used and avoids the need for some long
signatures. And it matches `{Early,Late}LintPassObject` nicely.
We check if `passes` is empty and then filter elements out of it. This
means we can miss optimizing some cases, e.g. when bootstrapping.

This commit moves the `is_empty` check after the filtering.
@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@nnethercote

Copy link
Copy Markdown
Contributor Author

I rebased again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants