Skip to content

Commit dfb672f

Browse files
author
The rustc-josh-sync Cronjob Bot
committed
Merge ref '82310651b93a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 82310651b93a594a3fd69015e1562186a080d94c Filtered ref: e13c0be8f13737c64082b89ce834546079767ac4 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents 169f787 + b396496 commit dfb672f

File tree

355 files changed

+7066
-1875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+7066
-1875
lines changed

.github/ISSUE_TEMPLATE/new_lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: New lint suggestion
2-
description: Suggest a new Clippy lint.
2+
description: |
3+
Suggest a new Clippy lint (currently not accepting new lints)
4+
Check out the Clippy book for more information about the feature freeze.
35
labels: ["A-lint"]
46
body:
57
- type: markdown

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ order to get feedback.
3232

3333
Delete this line and everything above before opening your PR.
3434

35+
Note that we are currently not taking in new PRs that add new lints. We are in a
36+
feature freeze. Check out the book for more information. If you open a
37+
feature-adding pull request, its review will be delayed.
38+
3539
---
3640

3741
*Please write a short comment explaining your change (or "none" for internal only changes)*
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Feature freeze check
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
branches:
8+
- master
9+
paths:
10+
- 'clippy_lints/src/declared_lints.rs'
11+
12+
jobs:
13+
auto-comment:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
pull-requests: write
18+
19+
# Do not in any case add code that runs anything coming from the the content
20+
# of the pull request, as malicious code would be able to access the private
21+
# GitHub token.
22+
steps:
23+
- name: Check PR Changes
24+
id: pr-changes
25+
run: echo "::set-output name=changes::${{ toJson(github.event.pull_request.changed_files) }}"
26+
27+
- name: Create Comment
28+
if: steps.pr-changes.outputs.changes != '[]'
29+
run: |
30+
# Use GitHub API to create a comment on the PR
31+
PR_NUMBER=${{ github.event.pull_request.number }}
32+
COMMENT="**Seems that you are trying to add a new lint!**\nWe are currently in a [feature freeze](https://doc.rust-lang.org/nightly/clippy/development/feature_freeze.html), so we are delaying all lint-adding PRs to September 18 and focusing on bugfixes.\nThanks a lot for your contribution, and sorry for the inconvenience.\nWith ❤ from the Clippy team\n\n@rustbot note Feature-freeze\n@rustbot blocked\n@rustbot label +A-lint\n"
33+
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
34+
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
35+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"

.github/workflows/lintcheck.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,27 @@ jobs:
128128
- name: Download JSON
129129
uses: actions/download-artifact@v4
130130

131+
- name: Store PR number
132+
run: echo ${{ github.event.pull_request.number }} > pr.txt
133+
131134
- name: Diff results
132-
# GH's summery has a maximum size of 1024k:
133-
# https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary
134-
# That's why we first log to file and then to the summary and logs
135+
# GH's summery has a maximum size of 1MiB:
136+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#step-isolation-and-limits
137+
# We upload the full diff as an artifact in case it's truncated
135138
run: |
136-
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json --truncate >> truncated_diff.md
137-
head -c 1024000 truncated_diff.md >> $GITHUB_STEP_SUMMARY
138-
cat truncated_diff.md
139-
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json >> full_diff.md
139+
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json --truncate | head -c 1M > $GITHUB_STEP_SUMMARY
140+
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json --write-summary summary.json > full_diff.md
140141
141142
- name: Upload full diff
142143
uses: actions/upload-artifact@v4
143144
with:
144-
name: diff
145-
if-no-files-found: ignore
145+
name: full_diff
146+
path: full_diff.md
147+
148+
- name: Upload summary
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: summary
146152
path: |
147-
full_diff.md
148-
truncated_diff.md
153+
summary.json
154+
pr.txt
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Lintcheck summary
2+
3+
# The workflow_run event runs in the context of the Clippy repo giving it write
4+
# access, needed here to create a PR comment when the PR originates from a fork
5+
#
6+
# The summary artifact is a JSON file that we verify in this action to prevent
7+
# the creation of arbitrary comments
8+
#
9+
# This action must not checkout/run code from the originating workflow_run
10+
# or directly interpolate ${{}} untrusted fields into code
11+
#
12+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_run
13+
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections
14+
15+
on:
16+
workflow_run:
17+
workflows: [Lintcheck]
18+
types: [completed]
19+
20+
# Restrict the default permission scope https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defining-access-for-the-github_token-scopes
21+
permissions:
22+
pull-requests: write
23+
24+
jobs:
25+
download:
26+
runs-on: ubuntu-latest
27+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
28+
steps:
29+
- name: Download artifact
30+
uses: actions/download-artifact@v4
31+
with:
32+
name: summary
33+
path: untrusted
34+
run-id: ${{ github.event.workflow_run.id }}
35+
github-token: ${{ github.token }}
36+
37+
- name: Format comment
38+
uses: actions/github-script@v7
39+
with:
40+
script: |
41+
const fs = require("fs");
42+
const assert = require("assert/strict");
43+
44+
function validateName(s) {
45+
assert.match(s, /^[a-z0-9_:]+$/);
46+
return s;
47+
}
48+
49+
function validateInt(i) {
50+
assert.ok(Number.isInteger(i));
51+
return i;
52+
}
53+
54+
function tryReadSummary() {
55+
try {
56+
return JSON.parse(fs.readFileSync("untrusted/summary.json"));
57+
} catch {
58+
return null;
59+
}
60+
}
61+
62+
const prNumber = parseInt(fs.readFileSync("untrusted/pr.txt"), 10);
63+
core.exportVariable("PR", prNumber.toString());
64+
65+
const untrustedSummary = tryReadSummary();
66+
if (!Array.isArray(untrustedSummary)) {
67+
return;
68+
}
69+
70+
let summary = `Lintcheck changes for ${context.payload.workflow_run.head_sha}
71+
72+
| Lint | Added | Removed | Changed |
73+
| ---- | ----: | ------: | ------: |
74+
`;
75+
76+
for (const untrustedRow of untrustedSummary) {
77+
const name = validateName(untrustedRow.name);
78+
79+
const added = validateInt(untrustedRow.added);
80+
const removed = validateInt(untrustedRow.removed);
81+
const changed = validateInt(untrustedRow.changed);
82+
83+
const id = name.replace("clippy::", "user-content-").replaceAll("_", "-");
84+
const url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${context.payload.workflow_run.id}#${id}`;
85+
86+
summary += `| [\`${name}\`](${url}) | ${added} | ${removed} | ${changed} |\n`;
87+
}
88+
89+
summary += "\nThis comment will be updated if you push new changes";
90+
91+
fs.writeFileSync("summary.md", summary);
92+
93+
- name: Create/update comment
94+
run: |
95+
if [[ -f summary.md ]]; then
96+
gh pr comment "$PR" --body-file summary.md --edit-last --create-if-none
97+
else
98+
# There were no changes detected by Lintcheck
99+
# - If a comment exists from a previous run that did detect changes, edit it (--edit-last)
100+
# - If no comment exists do not create one, the `gh` command exits with an error which
101+
# `|| true` ignores
102+
gh pr comment "$PR" --body "No changes for ${{ github.event.workflow_run.head_sha }}" --edit-last || true
103+
fi
104+
env:
105+
GH_TOKEN: ${{ github.token }}
106+
GH_REPO: ${{ github.repository }}

CHANGELOG.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,94 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[1e5237f4...master](https://github.com/rust-lang/rust-clippy/compare/1e5237f4...master)
9+
[03a5b6b9...master](https://github.com/rust-lang/rust-clippy/compare/03a5b6b9...master)
10+
11+
## Rust 1.88
12+
13+
Current stable, released 2025-06-26
14+
15+
[View all 126 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2025-03-21T10%3A30%3A57Z..2025-05-01T08%3A03%3A26Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`swap_with_temporary`] to `complexity` [#14046](https://github.com/rust-lang/rust-clippy/pull/14046)
20+
* Added [`redundant_test_prefix`] to `restriction` [#13710](https://github.com/rust-lang/rust-clippy/pull/13710)
21+
* Added [`manual_dangling_ptr`] to `style` [#14107](https://github.com/rust-lang/rust-clippy/pull/14107)
22+
* Added [`char_indices_as_byte_indices`] to `correctness` [#13435](https://github.com/rust-lang/rust-clippy/pull/13435)
23+
* Added [`manual_abs_diff`] to `complexity` [#14482](https://github.com/rust-lang/rust-clippy/pull/14482)
24+
* Added [`ignore_without_reason`] to `pedantic` [#13931](https://github.com/rust-lang/rust-clippy/pull/13931)
25+
26+
### Moves and Deprecations
27+
28+
* Moved [`uninlined_format_args`] to `style` (from `pedantic`)
29+
[#14160](https://github.com/rust-lang/rust-clippy/pull/14160)
30+
* [`match_on_vec_items`] deprecated in favor of [`indexing_slicing`]
31+
[#14217](https://github.com/rust-lang/rust-clippy/pull/14217)
32+
* Removed superseded lints: `transmute_float_to_int`, `transmute_int_to_char`,
33+
`transmute_int_to_float`, `transmute_num_to_bytes` (now in rustc)
34+
[#14703](https://github.com/rust-lang/rust-clippy/pull/14703)
35+
36+
### Enhancements
37+
38+
* Configuration renamed from `lint-inconsistent-struct-field-initializers`
39+
to `check-inconsistent-struct-field-initializers`
40+
[#14280](https://github.com/rust-lang/rust-clippy/pull/14280)
41+
* Paths in `disallowed_*` configurations are now validated
42+
[#14397](https://github.com/rust-lang/rust-clippy/pull/14397)
43+
* [`borrow_as_ptr`] now lints implicit casts as well
44+
[#14408](https://github.com/rust-lang/rust-clippy/pull/14408)
45+
* [`iter_kv_map`] now recognizes references on maps
46+
[#14596](https://github.com/rust-lang/rust-clippy/pull/14596)
47+
* [`empty_enum_variants_with_brackets`] no longer lints reachable enums or enums used
48+
as functions within same crate [#12971](https://github.com/rust-lang/rust-clippy/pull/12971)
49+
* [`needless_lifetimes`] now checks for lifetime uses in closures
50+
[#14608](https://github.com/rust-lang/rust-clippy/pull/14608)
51+
* [`wildcard_imports`] now lints on `pub use` when `warn_on_all_wildcard_imports` is enabled
52+
[#14182](https://github.com/rust-lang/rust-clippy/pull/14182)
53+
* [`collapsible_if`] now recognizes the `let_chains` feature
54+
[#14481](https://github.com/rust-lang/rust-clippy/pull/14481)
55+
* [`match_single_binding`] now allows macros in scrutinee and patterns
56+
[#14635](https://github.com/rust-lang/rust-clippy/pull/14635)
57+
* [`needless_borrow`] does not contradict the compiler's
58+
`dangerous_implicit_autorefs` lint even though the references
59+
are not mandatory
60+
[#14810](https://github.com/rust-lang/rust-clippy/pull/14810)
61+
62+
### False Positive Fixes
63+
64+
* [`double_ended_iterator_last`] and [`needless_collect`] fixed FP when iter has side effects
65+
[#14490](https://github.com/rust-lang/rust-clippy/pull/14490)
66+
* [`mut_from_ref`] fixed FP where lifetimes nested in types were not considered
67+
[#14471](https://github.com/rust-lang/rust-clippy/pull/14471)
68+
* [`redundant_clone`] fixed FP in overlapping lifetime
69+
[#14237](https://github.com/rust-lang/rust-clippy/pull/14237)
70+
* [`map_entry`] fixed FP where lint would trigger without insert calls present
71+
[#14568](https://github.com/rust-lang/rust-clippy/pull/14568)
72+
* [`iter_cloned_collect`] fixed FP with custom `From`/`IntoIterator` impl
73+
[#14473](https://github.com/rust-lang/rust-clippy/pull/14473)
74+
* [`shadow_unrelated`] fixed FP in destructuring assignments
75+
[#14381](https://github.com/rust-lang/rust-clippy/pull/14381)
76+
* [`redundant_clone`] fixed FP on enum cast
77+
[#14395](https://github.com/rust-lang/rust-clippy/pull/14395)
78+
* [`collapsible_if`] fixed FP on block stmt before expr
79+
[#14730](https://github.com/rust-lang/rust-clippy/pull/14730)
80+
81+
### ICE Fixes
82+
83+
* [`missing_const_for_fn`] fix ICE with `-Z validate-mir` compilation option
84+
[#14776](https://github.com/rust-lang/rust-clippy/pull/14776)
85+
86+
### Documentation Improvements
87+
88+
* [`missing_asserts_for_indexing`] improved documentation and examples
89+
[#14108](https://github.com/rust-lang/rust-clippy/pull/14108)
90+
91+
### Others
92+
93+
* We're testing with edition 2024 now
94+
[#14602](https://github.com/rust-lang/rust-clippy/pull/14602)
95+
* Don't warn about unloaded crates in `clippy.toml` disallowed paths
96+
[#14733](https://github.com/rust-lang/rust-clippy/pull/14733)
1097

1198
## Rust 1.87
1299

@@ -5729,6 +5816,7 @@ Released 2018-09-13
57295816
[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type
57305817
[`disallowed_types`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
57315818
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
5819+
[`doc_broken_link`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_broken_link
57325820
[`doc_comment_double_space_linebreaks`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_comment_double_space_linebreaks
57335821
[`doc_include_without_cfg`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_include_without_cfg
57345822
[`doc_lazy_continuation`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
@@ -5967,6 +6055,7 @@ Released 2018-09-13
59676055
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
59686056
[`manual_is_finite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_finite
59696057
[`manual_is_infinite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_infinite
6058+
[`manual_is_multiple_of`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of
59706059
[`manual_is_power_of_two`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_power_of_two
59716060
[`manual_is_variant_and`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_variant_and
59726061
[`manual_let_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

Cargo.toml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.89"
3+
version = "0.1.90"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"
@@ -24,16 +24,17 @@ path = "src/driver.rs"
2424
clippy_config = { path = "clippy_config" }
2525
clippy_lints = { path = "clippy_lints" }
2626
clippy_utils = { path = "clippy_utils" }
27+
declare_clippy_lint = { path = "declare_clippy_lint" }
2728
rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
2829
clippy_lints_internal = { path = "clippy_lints_internal", optional = true }
2930
tempfile = { version = "3.20", optional = true }
30-
termize = "0.1"
31+
termize = "0.2"
3132
color-print = "0.3.4"
3233
anstream = "0.6.18"
3334

3435
[dev-dependencies]
3536
cargo_metadata = "0.18.1"
36-
ui_test = "0.29.2"
37+
ui_test = "0.30.2"
3738
regex = "1.5.5"
3839
serde = { version = "1.0.145", features = ["derive"] }
3940
serde_json = "1.0.122"
@@ -44,20 +45,13 @@ itertools = "0.12"
4445
pulldown-cmark = { version = "0.11", default-features = false, features = ["html"] }
4546
askama = { version = "0.14", default-features = false, features = ["alloc", "config", "derive"] }
4647

47-
# UI test dependencies
48-
if_chain = "1.0"
49-
quote = "1.0.25"
50-
syn = { version = "2.0", features = ["full"] }
51-
futures = "0.3"
52-
parking_lot = "0.12"
53-
tokio = { version = "1", features = ["io-util"] }
54-
5548
[build-dependencies]
5649
rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
5750

5851
[features]
5952
integration = ["dep:tempfile"]
6053
internal = ["dep:clippy_lints_internal", "dep:tempfile"]
54+
jemalloc = []
6155

6256
[package.metadata.rust-analyzer]
6357
# This package uses #[feature(rustc_private)]

book/src/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Clippy
22

3+
[### IMPORTANT NOTE FOR CONTRIBUTORS ================](development/feature_freeze.md)
4+
5+
----
6+
37
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)
48

59
A collection of lints to catch common mistakes and improve your

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [GitLab CI](continuous_integration/gitlab.md)
1414
- [Travis CI](continuous_integration/travis.md)
1515
- [Development](development/README.md)
16+
- [IMPORTANT: FEATURE FREEZE](development/feature_freeze.md)
1617
- [Basics](development/basics.md)
1718
- [Adding Lints](development/adding_lints.md)
1819
- [Defining Lints](development/defining_lints.md)

book/src/development/adding_lints.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Adding a new lint
22

3+
[### IMPORTANT NOTE FOR CONTRIBUTORS ================](feature_freeze.md)
4+
5+
36
You are probably here because you want to add a new lint to Clippy. If this is
47
the first time you're contributing to Clippy, this document guides you through
58
creating an example lint from scratch.

0 commit comments

Comments
 (0)