Skip to content

Clippy subtree update #141044

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

Merged
merged 121 commits into from
May 16, 2025
Merged

Clippy subtree update #141044

merged 121 commits into from
May 16, 2025

Conversation

flip1995
Copy link
Member

r? @Manishearth

Cargo.lock update due to Clippy version bump.

GuillaumeGomez and others added 30 commits April 17, 2025 16:31
The lint becomes part of stable in 1.87, not in 1.84
Supersedes rust-lang/rust-clippy#12550

`layout_of` no longer contains a `delay_bug` so there's no need for this
anymore.

changelog: None
I'm working on rust-lang/rust-clippy#14542 and
I decided to name the lint `unnecessary_map` originally. However when I
ran the command, I got:

```
thread 'main' panicked at clippy_dev/src/new_lint.rs:450:5:
Lint `unnecessary_map` already defined in `/home/imperio/rust/clippy/clippy_lints/src/methods/mod.rs`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

It's because there is already a `unnecessary_map_or`, which matches the
`.contains()` call. This PR strengthens this check.

changelog: Fix `new_lint` clippy command

r? @flip1995
Closes rust-lang/rust-clippy#14685

changelog: [`manual_slice_fill`] fix FP on `IndexMut` overload
add allow_unused config to missing_docs_in_private_items for underscored field
Fixes
rust-lang/rust-clippy#14397 (comment)

r? @samueltardieu

changelog: Don't warn about clippy.toml disallowed paths for crates that
were not loaded
Closes rust-lang/rust-clippy#14704

changelog: [`unused_async`] fix FP on default impl
Simplifies the implementation a bit, also makes the message an error
annotation

changelog: none
Closes rust-lang/rust-clippy#14716

changelog: [`manual_unwrap_or_default`] fix FP on ref binding
The `&[&str]` path based `clippy_utils` have been removed and replace
with a new type `PathLookup`:

-
[`match_trait_method`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_trait_method.html)
-
[`match_qpath`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_qpath.html)
-
[`match_path`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_path.html)
-
[`match_any_def_paths`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_any_def_paths.html)
-
[`match_def_path`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_def_path.html)
-
[`match_type`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/ty/fn.match_type.html)
-
[`get_trait_def_id`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.get_trait_def_id.html)

Internally `PathLookup` is a lazy call to `lookup_path` (the new name
for
[`def_path_res`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.def_path_res.html)
to distinguish it from
[`path_res`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.path_res.html))

The `invalid_paths` internal lint is removed, it could be reimplemented
but it feels redundant since every path should be covered by a test
anyway

### User facing changes

- `manual_saturating_arithmetic` now checks for `u32::MAX/MIN` instead
of only detecting the legacy numeric consts (`std::u32::MAX/MIN`),
`clippy::legacy_numeric_constants` will redirect usages of the legacy
versions to the new one

- `allow-invalid = true` now suppresses all invalid path warnings,
currently you can run into a warning that can't be ignored in some
situations, e.g. with `serde` without the `derive` feature

  ```
  warning: expected a macro, found a trait
   --> /home/gh-Alexendoo/temp/clippy.toml:2:5
    |
  2 |     { path = "serde::Serialize", allow-invalid = true },
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ```

- Re-exports of primitives types like `std::primitive::*` no longer work
in `disallowed-types`, this seems acceptable since it would be unusual
to deny a primitive this way rather than writing e.g. `usize`. Type
aliases such as `c_char` are unaffected

- A similar slight performance improvement to
rust-lang/rust-clippy#14650
  ```bash
$ hyperfine -w 2 -p 'touch src/cargo/lib.rs' 'cargo +master clippy'
'cargo +lazy-paths clippy'
  ```
  ```
  Benchmark 1: cargo +master clippy
Time (mean ± σ): 6.829 s ± 0.064 s [User: 6.079 s, System: 0.673 s]
    Range (min … max):    6.705 s …  6.907 s    10 runs

  Benchmark 2: cargo +lazy-paths clippy
Time (mean ± σ): 6.765 s ± 0.064 s [User: 5.984 s, System: 0.698 s]
    Range (min … max):    6.636 s …  6.834 s    10 runs

  Summary
    cargo +lazy-paths clippy ran
      1.01 ± 0.01 times faster than cargo +master clippy
  ```

changelog: none
Jarcho and others added 10 commits May 14, 2025 05:49
…ang#14740)

When a `non_std_lazy_statics` warning is generated about an item type
which can be replaced by a standard library one, ensure that the lint
happens on the item HIR node so that it can be expected.

changelog: [`non_std_lazy_statics`]: generate the warning onto the right
node

Fixes rust-lang/rust-clippy#14729

Note that this doesn't change anything on lints generated for the
`lazy_static::lazy_static` macro because the `expect` attribute cannot
be applied to a macro.
…tions` lint (rust-lang#14261)

changelog: [`module_name_repetitions`]: new configuration option
`allow_exact_repetitions`, enabled by default

Closes rust-lang#14226
Based on rust-lang/rust-clippy#13223

Various refactoring on `clippy_dev` before upgrading rename and
splitting `clippy_lints` into multiple crates.

Some improvements:
* The working directory is set to the root clippy directory. Running
from a subdirectory was kind of supported before sometimes. Now it just
works.
* File won't be written unless they're actually updated. Most of the
time they weren't written, but a few cases slipped through.
* Buffers are reused more for the negligible speed boost.

changelog: None
r? @ghost

changelog: none
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 15, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 15, 2025
@Manishearth
Copy link
Member

@bors r+ p=2 rollup=never

@bors
Copy link
Collaborator

bors commented May 16, 2025

📌 Commit 60750ca has been approved by Manishearth

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 May 16, 2025
@bors
Copy link
Collaborator

bors commented May 16, 2025

⌛ Testing commit 60750ca with merge 1b9efcd...

@bors
Copy link
Collaborator

bors commented May 16, 2025

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing 1b9efcd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 16, 2025
@bors bors merged commit 1b9efcd into rust-lang:master May 16, 2025
7 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 16, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing c79bbfa (parent) -> 1b9efcd (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 1b9efcd18f1cb95348c3ffadd4db47bfa15292e5 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-1: 10608.0s -> 7259.0s (-31.6%)
  2. dist-aarch64-apple: 5378.4s -> 6382.1s (18.7%)
  3. aarch64-apple: 3640.0s -> 4216.6s (15.8%)
  4. dist-arm-linux: 4778.3s -> 5456.0s (14.2%)
  5. dist-x86_64-apple: 9145.0s -> 8024.5s (-12.3%)
  6. x86_64-apple-2: 4915.0s -> 5306.3s (8.0%)
  7. dist-apple-various: 5659.0s -> 6020.4s (6.4%)
  8. x86_64-mingw-2: 7360.8s -> 6964.5s (-5.4%)
  9. dist-i686-mingw: 7971.5s -> 8328.7s (4.5%)
  10. dist-i686-msvc: 6908.7s -> 7214.3s (4.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1b9efcd): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -3.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-5.4%, -2.2%] 4
All ❌✅ (primary) - - 0

Cycles

Results (primary 1.6%, secondary 2.2%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.6% [1.6%, 1.6%] 1
Regressions ❌
(secondary)
2.6% [1.7%, 3.2%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) 1.6% [1.6%, 1.6%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 772.547s -> 771.756s (-0.10%)
Artifact size: 365.46 MiB -> 365.46 MiB (-0.00%)

@flip1995 flip1995 deleted the clippy-subtree-update branch May 17, 2025 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.