Skip to content

Commit 5d8489b

Browse files
authored
Merge branch 'master' into chore/fix-manual-assert
2 parents 5e448ee + 49ae1d4 commit 5d8489b

File tree

3,544 files changed

+95346
-41162
lines changed

Some content is hidden

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

3,544 files changed

+95346
-41162
lines changed

.cargo/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ split-debuginfo = "unpacked"
2323
rustflags = ["--remap-path-prefix", "=clippy_dev"]
2424
[profile.dev.package.lintcheck]
2525
rustflags = ["--remap-path-prefix", "=lintcheck"]
26+
27+
# quine-mc_cluskey makes up a significant part of the runtime in dogfood
28+
# due to the number of conditions in the clippy_lints crate
29+
# and enabling optimizations for that specific dependency helps a bit
30+
# without increasing total build times.
31+
[profile.dev.package.quine-mc_cluskey]
32+
opt-level = 3

.github/ISSUE_TEMPLATE/new_lint.yml

Lines changed: 24 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
@@ -46,3 +48,24 @@ body:
4648
```
4749
validations:
4850
required: true
51+
- type: textarea
52+
id: comparison
53+
attributes:
54+
label: Comparison with existing lints
55+
description: |
56+
What makes this lint different from any existing lints that are similar, and how are those differences useful?
57+
58+
You can [use this playground template to see what existing lints are triggered by the bad code][playground]
59+
(make sure to use "Tools > Clippy" and not "Build").
60+
You can also look through the list of [rustc's allowed-by-default lints][allowed-by-default],
61+
as those won't show up in the playground above.
62+
63+
[allowed-by-default]: https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
64+
65+
[playground]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&code=%23%21%5Bwarn%28clippy%3A%3Apedantic%29%5D%0A%23%21%5Bwarn%28clippy%3A%3Anursery%29%5D%0A%23%21%5Bwarn%28clippy%3A%3Arestriction%29%5D%0A%23%21%5Bwarn%28clippy%3A%3Aall%29%5D%0A%23%21%5Ballow%28clippy%3A%3Ablanket_clippy_restriction_lints%2C+reason+%3D+%22testing+to+see+if+any+restriction+lints+match+given+code%22%29%5D%0A%0A%2F%2F%21+Template+that+can+be+used+to+see+what+clippy+lints+a+given+piece+of+code+would+trigger
66+
placeholder: Unlike `clippy::...`, the proposed lint would...
67+
- type: textarea
68+
id: context
69+
attributes:
70+
label: Additional Context
71+
description: Any additional context that you believe may be relevant.

.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)*

.github/driver.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ unset CARGO_MANIFEST_DIR
4747

4848
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
4949
# FIXME: How to match the clippy invocation in compile-test.rs?
50-
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/string_to_string.rs 2>string_to_string.stderr && exit 1
51-
sed -e "/= help: for/d" string_to_string.stderr > normalized.stderr
52-
diff -u normalized.stderr tests/ui/string_to_string.stderr
50+
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/char_lit_as_u8.rs 2>char_lit_as_u8.stderr && exit 1
51+
sed -e "/= help: for/d" char_lit_as_u8.stderr > normalized.stderr
52+
diff -u normalized.stderr tests/ui/char_lit_as_u8.stderr
5353

5454
# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
5555
SYSROOT=$(rustc --print sysroot)

.github/workflows/clippy_changelog.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,18 @@ jobs:
1515
changelog:
1616
runs-on: ubuntu-latest
1717

18-
defaults:
19-
run:
20-
shell: bash
21-
2218
steps:
2319
# Run
2420
- name: Check Changelog
2521
if: ${{ github.event_name == 'pull_request' }}
2622
run: |
27-
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR_NUMBER" | \
28-
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
29-
output=$(awk '/^changelog:\s*\S/ && !/changelog: \[.*\]: your change/' <<< "$body" | sed "s/changelog:\s*//g")
30-
if [ -z "$output" ]; then
31-
echo "ERROR: pull request message must contain 'changelog: ...' with your changelog. Please add it."
23+
if [[ -z $(grep -oP 'changelog: *\K\S+' <<< "$PR_BODY") ]]; then
24+
echo "::error::Pull request message must contain 'changelog: ...' with your changelog. Please add it."
3225
exit 1
33-
else
34-
echo "changelog: $output"
3526
fi
3627
env:
37-
PYTHONIOENCODING: 'utf-8'
38-
PR_NUMBER: '${{ github.event.number }}'
28+
PR_BODY: ${{ github.event.pull_request.body }})
29+
3930

4031
# We need to have the "conclusion" job also on PR CI, to make it possible
4132
# to add PRs to a merge queue.

.github/workflows/clippy_dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
# Setup
1818
- name: Checkout
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020
with:
2121
# Unsetting this would make so that any malicious package could get our Github Token
2222
persist-credentials: false

.github/workflows/clippy_mq.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ jobs:
2727
host: x86_64-pc-windows-msvc
2828
- os: macos-13
2929
host: x86_64-apple-darwin
30+
- os: macos-latest
31+
host: aarch64-apple-darwin
3032

3133
runs-on: ${{ matrix.os }}
3234

3335
# NOTE: If you modify this job, make sure you copy the changes to clippy.yml
3436
steps:
3537
# Setup
3638
- name: Checkout
37-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
3840
with:
3941
persist-credentials: false
4042

@@ -64,7 +66,7 @@ jobs:
6466
run: cargo test --features internal -- --skip dogfood
6567

6668
- name: Test clippy_lints
67-
run: cargo test --features internal
69+
run: cargo test
6870
working-directory: clippy_lints
6971

7072
- name: Test clippy_utils
@@ -94,7 +96,7 @@ jobs:
9496
steps:
9597
# Setup
9698
- name: Checkout
97-
uses: actions/checkout@v4
99+
uses: actions/checkout@v5
98100
with:
99101
persist-credentials: false
100102

@@ -112,7 +114,7 @@ jobs:
112114
steps:
113115
# Setup
114116
- name: Checkout
115-
uses: actions/checkout@v4
117+
uses: actions/checkout@v5
116118
with:
117119
persist-credentials: false
118120

@@ -168,7 +170,7 @@ jobs:
168170
steps:
169171
# Setup
170172
- name: Checkout
171-
uses: actions/checkout@v4
173+
uses: actions/checkout@v5
172174
with:
173175
persist-credentials: false
174176

.github/workflows/clippy_pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
# Setup
2626
- name: Checkout
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828
with:
2929
# Unsetting this would make so that any malicious package could get our Github Token
3030
persist-credentials: false
@@ -42,7 +42,7 @@ jobs:
4242
run: cargo test --features internal
4343

4444
- name: Test clippy_lints
45-
run: cargo test --features internal
45+
run: cargo test
4646
working-directory: clippy_lints
4747

4848
- name: Test clippy_utils

.github/workflows/deploy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
tags:
99
- rust-1.**
1010

11+
concurrency:
12+
group: ${{ github.workflow }}
13+
cancel-in-progress: false
14+
1115
env:
1216
TARGET_BRANCH: 'gh-pages'
1317
SHA: '${{ github.sha }}'
@@ -21,13 +25,13 @@ jobs:
2125
steps:
2226
# Setup
2327
- name: Checkout
24-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2529
with:
2630
# Unsetting this would make so that any malicious package could get our Github Token
2731
persist-credentials: false
2832

2933
- name: Checkout
30-
uses: actions/checkout@v4
34+
uses: actions/checkout@v5
3135
with:
3236
ref: ${{ env.TARGET_BRANCH }}
3337
path: 'out'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 content
20+
# of the pull request, as malicious code would be able to access the private
21+
# GitHub token.
22+
steps:
23+
- name: Add freeze warning comment
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
GITHUB_REPOSITORY: ${{ github.repository }}
27+
PR_NUMBER: ${{ github.event.pull_request.number }}
28+
run: |
29+
COMMENT=$(echo "**Seems that you are trying to add a new lint!**\n\
30+
\n\
31+
We 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](https://github.com/rust-lang/rust-clippy/issues/15086).\n\
32+
\n\
33+
Thanks a lot for your contribution, and sorry for the inconvenience.\n\
34+
\n\
35+
With ❤ from the Clippy team.\n\
36+
\n\
37+
@rustbot note Feature-freeze\n\
38+
@rustbot blocked\n\
39+
@rustbot label +A-lint"
40+
)
41+
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
42+
-H "Content-Type: application/vnd.github.raw+json" \
43+
-X POST \
44+
--data "{\"body\":\"${COMMENT}\"}" \
45+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments"

0 commit comments

Comments
 (0)