Skip to content

Clippy subtree update - #159789

Closed
flip1995 wants to merge 190 commits into
rust-lang:mainfrom
flip1995:clippy-subtree-update
Closed

Clippy subtree update#159789
flip1995 wants to merge 190 commits into
rust-lang:mainfrom
flip1995:clippy-subtree-update

Conversation

@flip1995

@flip1995 flip1995 commented Jul 23, 2026

Copy link
Copy Markdown
Member

View all comments

r? Manishearth

Francisco-Andre-Martins and others added 30 commits March 25, 2026 15:56
This fix adds an aditional check, by checking if the previous
element was an image, and ignoring the lack of punctuation
for a subsequent link. An aditional test was added to account
for this case.

Closes rust-lang#16439
The main value of this help text is only provided when the
developer already provided all the fields. So a better example
is showing the developer that this lint can be used to clean
up those struct initalizations.

Besides the lint already points to the ...zero_point line
so the developer is inclined to remove it.
Because of the way this lint implements text splitting, I need to track
markdown and text lengths separately. This is fairly easy, since we can
exhaustively check every markdown event and count the characters inside.
test: supply test for issue 16954.

fix: suggest MethodCall for expr with type anchor.

fix: remove redudant is_lit check.

fix: missing parenthesis for a * b.

fix: remove redundant lit check.
This better matches how the argument is actually used.
See `rustc_hir::intravisit::{walk_expr,walk_pat_expr}`.
Detect `match` expressions where every arm is a block ending in the same
trailing expression and the `match` is in tail position, suggesting the
expression be hoisted out below the `match`.

changelog: [`branches_sharing_code`]: also lint `match` expressions whose
arms end with the same expression
…modes

Implement configuration-based approach with three options:
- alphabetical (default)
- trait_item_ordering
- alphabetical_or_trait_item_ordering

Fixes false positives for non-alphabetically-ordered trait definitions.
…ait_item_ordering` and `alphabetical_or_trait_item_ordering
The `opt.and_then(|x| { /* comment */ if .. { Some(x) } else { None } })`
to `filter` rewrite drops any comment inside the closure. Mark the
suggestion `MaybeIncorrect` when the replaced span contains a comment, so
`clippy --fix` no longer applies it silently. This matches the existing
`span_contains_comment` handling in manual_ok_err / manual_unwrap_or /
manual_flatten.
…ingjubilee

Carry the `b_offset` inside `BackendRepr::ScalarPair`

Inspired by rust-lang/compiler-team#1007 but doesn't actually change any of the layout rules just yet.

This turned out to be a nice change even if we didn't use the extra flexibility, IMHO, because it allowed so many things like

```diff
@@ -222,12 +224,12 @@ fn from_const_alloc<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
                 let val = read_scalar(offset, size, s, bx.immediate_backend_type(layout));
                 OperandRef { val: OperandValue::Immediate(val), layout, move_annotation: None }
             }
-            BackendRepr::ScalarPair(
-                a @ abi::Scalar::Initialized { .. },
-                b @ abi::Scalar::Initialized { .. },
-            ) => {
+            BackendRepr::ScalarPair {
+                a: a @ abi::Scalar::Initialized { .. },
+                b: b @ abi::Scalar::Initialized { .. },
+                b_offset,
+            } => {
                 let (a_size, b_size) = (a.size(bx), b.size(bx));
-                let b_offset = (offset + a_size).align_to(b.default_align(bx).abi);
                 assert!(b_offset.bytes() > 0);
                 let a_val = read_scalar(
                     offset,
```

as *oh my* was that little magic incantation copy-pasted all over the place.

Apologies for the pretty-giant PR.  I tried to make it as direct a change as I could: if it was `(..)` before it's `{ .. }` now, if it was `(_, _)` before it's `{ a: _, b: _, b_offset: _ }` now.  I kept the names the same so the code lines were unchanged even if normally I might have just renamed things, etc.  I'll add some inline notes for places of particular interest.

r? @workingjubilee
…is empty.

This matches the same check from disallowed_macros and skips unnecessary work when the rule has been enabled but not configured.
This PR enables [the community reviews
feature](https://forge.rust-lang.org/triagebot/pr-assignment.html#community-reviews)
in triagebot.

It's configured to require **2 approvals** before automatic assignment
kicks in; manual assignments (`r?`) bypass this requirement.

It's signaled (and controlled) on a PR with the
`S-waiting-on-community-reviews` label ~~(to be created)~~.

Context:
- [#general > Article: Open Code Review at
Bevy](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/Article.3A.20Open.20Code.20Review.20at.20Bevy/with/604251242)
- [#clippy > External approvals and
review](https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/External.20approvals.20and.20review/with/604254405)
- [Together for a healthier
Clippy](https://blog.rust-lang.org/inside-rust/2026/07/06/unite-for-clippy/)

cc @samueltardieu @blyxyas

changelog: "none"
@rust-timer

Copy link
Copy Markdown
Collaborator

Cannot parse build command: Missing SHA in build command

@Kobzol

Kobzol commented Aug 3, 2026

Copy link
Copy Markdown
Member

@rust-timer build 8092651 profiles=clippy

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8092651): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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)
7.9% [0.5%, 17.1%] 10
Improvements ✅
(primary)
-1.7% [-5.8%, -0.3%] 72
Improvements ✅
(secondary)
-2.8% [-28.4%, -0.3%] 48
All ❌✅ (primary) -1.7% [-5.8%, -0.3%] 72

Max RSS (memory usage)

Results (primary 1.1%, secondary 1.0%)

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

mean range count
Regressions ❌
(primary)
1.1% [0.4%, 2.5%] 69
Regressions ❌
(secondary)
1.2% [0.4%, 3.4%] 84
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-5.7%, -2.5%] 3
All ❌✅ (primary) 1.1% [0.4%, 2.5%] 69

Cycles

Results (primary -1.4%, secondary -0.7%)

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

mean range count
Regressions ❌
(primary)
0.9% [0.8%, 0.9%] 2
Regressions ❌
(secondary)
2.9% [0.4%, 13.7%] 27
Improvements ✅
(primary)
-1.5% [-4.4%, -0.4%] 77
Improvements ✅
(secondary)
-3.2% [-22.6%, -0.4%] 40
All ❌✅ (primary) -1.4% [-4.4%, 0.9%] 79

Binary size

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

Bootstrap: 491.018s -> 490.184s (-0.17%)
Artifact size: 390.29 MiB -> 390.23 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 3, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
To only update this specific test, also pass `--test-args linkage-attr/unreferenced-used-static-issue-127052.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/linkage-attr/unreferenced-used-static-issue-127052.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/linkage-attr/unreferenced-used-static-issue-127052" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

---
To only update this specific test, also pass `--test-args proc-macro/crt-static.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/proc-macro/crt-static.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/crt-static" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--crate-type" "proc-macro" "-Ctarget-feature="
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

---
To only update this specific test, also pass `--test-args proc-macro/no-missing-docs.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/proc-macro/no-missing-docs.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/no-missing-docs" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

---
To only update this specific test, also pass `--test-args proc-macro/no-mangle-in-proc-macro-issue-111888.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/no-mangle-in-proc-macro-issue-111888" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/no-mangle-in-proc-macro-issue-111888/auxiliary"
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

---
To only update this specific test, also pass `--test-args runtime/stdout-before-main.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/runtime/stdout-before-main.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/runtime/stdout-before-main/a" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

---
To only update this specific test, also pass `--test-args rust-2018/proc-macro-crate-in-paths.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/rust-2018/proc-macro-crate-in-paths.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/proc-macro-crate-in-paths" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

---
To only update this specific test, also pass `--test-args traits/dyn-drop-principal.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/dyn-drop-principal.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/dyn-drop-principal/a" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
libgccjit.so: warning: : ‘retain’ attribute ignored [-Wattributes]
------------------------------------------

Important

For more information how to resolve CI failures of this job, visit this link.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 3, 2026
@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

💔 Test for d8206ac failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@rust-bors rust-bors Bot 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 Aug 3, 2026
@JonathanBrouwer

JonathanBrouwer commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@bors treeclosed=1000
A PR got merged that is now failing the x86-gnu-gcc job on main somehow

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Tree closed for PRs with priority less than 1000.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors p=4
Scheduling

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 5, 2026
@rust-bors

rust-bors Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #160517) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

This pull request was unapproved.

@samueltardieu

Copy link
Copy Markdown
Member

@flip1995 How does this work in this case? Do you have to redo the merge and cherry-pick the commit I added on top (aaf848b)?

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Would simply rebasing this PR work or would that break the subtree sync process? I don't fully understand the process, just throwing out the suggestion

@flip1995

flip1995 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Tomorrow is the regular sync day anyway 😅 So I close this PR and redo it tomorrow, so we're back to the normal cycle.

@flip1995 flip1995 closed this Aug 5, 2026
@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 Aug 5, 2026
@flip1995

flip1995 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Would simply rebasing this PR work or would that break the subtree sync process? I don't fully understand the process, just throwing out the suggestion

No, rebasing would break the subtree sync process. The SHAs would not match the SHAs in the Clippy repo.

Let's hope this is the last sync ever done with git subtree tomorrow 🤞 (before switching to JOSH)

@flip1995
flip1995 deleted the clippy-subtree-update branch August 5, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. T-clippy Relevant to the Clippy team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.