Skip to content

Commit ab7e525

Browse files
committed
Merge remote-tracking branch 'upstream/master' into rustup
2 parents 978ed96 + 41d7e45 commit ab7e525

File tree

377 files changed

+6364
-3662
lines changed

Some content is hidden

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

377 files changed

+6364
-3662
lines changed

.github/workflows/clippy_changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Check Changelog
2525
if: ${{ github.event_name == 'pull_request' }}
2626
run: |
27-
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR_NUMBER" | \
27+
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | \
2828
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
2929
output=$(awk '/^changelog:\s*\S/ && !/changelog: \[.*\]: your change/' <<< "$body" | sed "s/changelog:\s*//g")
3030
if [ -z "$output" ]; then

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 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 }}'

.github/workflows/lintcheck.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666

6767
- name: Run lintcheck
6868
if: steps.cache-json.outputs.cache-hit != 'true'
69-
run: ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
69+
run: env CLIPPY_CONF_DIR="$PWD/lintcheck/ci-config" ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
7070

7171
- name: Upload base JSON
7272
uses: actions/upload-artifact@v4
@@ -97,7 +97,7 @@ jobs:
9797
run: cargo build --manifest-path=lintcheck/Cargo.toml
9898

9999
- name: Run lintcheck
100-
run: ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
100+
run: env CLIPPY_CONF_DIR="$PWD/lintcheck/ci-config" ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
101101

102102
- name: Upload head JSON
103103
uses: actions/upload-artifact@v4

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5516,6 +5516,7 @@ Released 2018-09-13
55165516
[`cast_slice_different_sizes`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_different_sizes
55175517
[`cast_slice_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
55185518
[`cfg_not_test`]: https://rust-lang.github.io/rust-clippy/master/index.html#cfg_not_test
5519+
[`char_indices_as_byte_indices`]: https://rust-lang.github.io/rust-clippy/master/index.html#char_indices_as_byte_indices
55195520
[`char_lit_as_u8`]: https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8
55205521
[`chars_last_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp
55215522
[`chars_next_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_next_cmp
@@ -5681,6 +5682,7 @@ Released 2018-09-13
56815682
[`if_same_then_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
56825683
[`if_then_some_else_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none
56835684
[`ifs_same_cond`]: https://rust-lang.github.io/rust-clippy/master/index.html#ifs_same_cond
5685+
[`ignore_without_reason`]: https://rust-lang.github.io/rust-clippy/master/index.html#ignore_without_reason
56845686
[`ignored_unit_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
56855687
[`impl_hash_borrow_with_str_and_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#impl_hash_borrow_with_str_and_bytes
56865688
[`impl_trait_in_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#impl_trait_in_params
@@ -5789,6 +5791,7 @@ Released 2018-09-13
57895791
[`manual_c_str_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals
57905792
[`manual_clamp`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp
57915793
[`manual_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains
5794+
[`manual_dangling_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_dangling_ptr
57925795
[`manual_div_ceil`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
57935796
[`manual_filter`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter
57945797
[`manual_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter_map
@@ -6346,6 +6349,7 @@ Released 2018-09-13
63466349
[`await-holding-invalid-types`]: https://doc.rust-lang.org/clippy/lint_configuration.html#await-holding-invalid-types
63476350
[`cargo-ignore-publish`]: https://doc.rust-lang.org/clippy/lint_configuration.html#cargo-ignore-publish
63486351
[`check-incompatible-msrv-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-incompatible-msrv-in-tests
6352+
[`check-inconsistent-struct-field-initializers`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-inconsistent-struct-field-initializers
63496353
[`check-private-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items
63506354
[`cognitive-complexity-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#cognitive-complexity-threshold
63516355
[`disallowed-macros`]: https://doc.rust-lang.org/clippy/lint_configuration.html#disallowed-macros
@@ -6362,7 +6366,7 @@ Released 2018-09-13
63626366
[`future-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#future-size-threshold
63636367
[`ignore-interior-mutability`]: https://doc.rust-lang.org/clippy/lint_configuration.html#ignore-interior-mutability
63646368
[`large-error-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#large-error-threshold
6365-
[`lint-inconsistent-struct-field-initializers`]: https://doc.rust-lang.org/clippy/lint_configuration.html#lint-inconsistent-struct-field-initializers
6369+
[`lint-commented-code`]: https://doc.rust-lang.org/clippy/lint_configuration.html#lint-commented-code
63666370
[`literal-representation-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#literal-representation-threshold
63676371
[`matches-for-let-else`]: https://doc.rust-lang.org/clippy/lint_configuration.html#matches-for-let-else
63686372
[`max-fn-params-bools`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-fn-params-bools

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ walkdir = "2.3"
4242
filetime = "0.2.9"
4343
itertools = "0.12"
4444
pulldown-cmark = { version = "0.11", default-features = false, features = ["html"] }
45-
rinja = { version = "0.3", default-features = false, features = ["config"] }
45+
askama = { version = "0.13", default-features = false, features = ["alloc", "config", "derive"] }
4646

4747
# UI test dependencies
4848
clippy_utils = { path = "clippy_utils" }
@@ -71,3 +71,10 @@ harness = false
7171
[[test]]
7272
name = "dogfood"
7373
harness = false
74+
75+
# quine-mc_cluskey makes up a significant part of the runtime in dogfood
76+
# due to the number of conditions in the clippy_lints crate
77+
# and enabling optimizations for that specific dependency helps a bit
78+
# without increasing total build times.
79+
[profile.dev.package.quine-mc_cluskey]
80+
opt-level = 3

rinja.toml renamed to askama.toml

File renamed without changes.

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [Updating the Changelog](development/infrastructure/changelog_update.md)
3131
- [Release a New Version](development/infrastructure/release.md)
3232
- [The Clippy Book](development/infrastructure/book.md)
33+
- [Benchmarking Clippy](development/infrastructure/benchmarking.md)
3334
- [Proposals](development/proposals/README.md)
3435
- [Roadmap 2021](development/proposals/roadmap-2021.md)
3536
- [Syntax Tree Patterns](development/proposals/syntax-tree-patterns.md)

book/src/development/adding_lints.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,22 @@ struct A;
9999
impl A {
100100
pub fn fo(&self) {}
101101
pub fn foo(&self) {}
102+
//~^ foo_functions
102103
pub fn food(&self) {}
103104
}
104105

105106
// Default trait methods
106107
trait B {
107108
fn fo(&self) {}
108109
fn foo(&self) {}
110+
//~^ foo_functions
109111
fn food(&self) {}
110112
}
111113

112114
// Plain functions
113115
fn fo() {}
114116
fn foo() {}
117+
//~^ foo_functions
115118
fn food() {}
116119

117120
fn main() {
@@ -122,17 +125,20 @@ fn main() {
122125
}
123126
```
124127

125-
Now we can run the test with `TESTNAME=foo_functions cargo uibless`, currently
126-
this test is meaningless though.
128+
Note that we are adding comment annotations with the name of our lint to mark
129+
lines where we expect an error. Once we have implemented our lint we can run
130+
`TESTNAME=foo_functions cargo uibless` to generate the `.stderr` file. If our
131+
lint makes use of structured suggestions then this command will also generate
132+
the corresponding `.fixed` file.
127133

128134
While we are working on implementing our lint, we can keep running the UI test.
129135
That allows us to check if the output is turning into what we want by checking the
130136
`.stderr` file that gets updated on every test run.
131137

132-
Running `TESTNAME=foo_functions cargo uitest` should pass on its own. When we
133-
commit our lint, we need to commit the generated `.stderr` files, too. In
134-
general, you should only commit files changed by `cargo bless` for the
135-
specific lint you are creating/editing.
138+
Once we have implemented our lint running `TESTNAME=foo_functions cargo uitest`
139+
should pass on its own. When we commit our lint, we need to commit the generated
140+
`.stderr` and if applicable `.fixed` files, too. In general, you should only
141+
commit files changed by `cargo bless` for the specific lint you are creating/editing.
136142

137143
> _Note:_ you can run multiple test files by specifying a comma separated list:
138144
> `TESTNAME=foo_functions,test2,test3`.

book/src/development/basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ following:
147147

148148
First, take note of the toolchain
149149
[override](https://rust-lang.github.io/rustup/overrides.html) in
150-
`/rust-toolchain`. We will use this override to install Clippy into the right
150+
`/rust-toolchain.toml`. We will use this override to install Clippy into the right
151151
toolchain.
152152

153153
> Tip: You can view the active toolchain for the current directory with `rustup
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Benchmarking Clippy
2+
3+
Benchmarking Clippy is similar to using our Lintcheck tool, in fact, it even
4+
uses the same tool! Just by adding a `--perf` flag it will transform Lintcheck
5+
into a very simple but powerful benchmarking tool!
6+
7+
It requires having the [`perf` tool][perf] installed, as `perf` is what's actually
8+
profiling Clippy under the hood.
9+
10+
The lintcheck `--perf` tool generates a series of `perf.data` in the
11+
`target/lintcheck/sources/<package>-<version>` directories. Each `perf.data`
12+
corresponds to the package which is contained.
13+
14+
Lintcheck uses the `-g` flag, meaning that you can get stack traces for richer
15+
analysis, including with tools such as [flamegraph][flamegraph-perf]
16+
(or [`flamegraph-rs`][flamegraph-rs]).
17+
18+
Currently, we only measure instruction count, as it's the most reproducible metric
19+
and [rustc-perf][rustc-perf] also considers it the main number to focus on.
20+
21+
## Benchmarking a PR
22+
23+
Having a benchmarking tool directly implemented into lintcheck gives us the
24+
ability to benchmark any given PR just by making a before and after
25+
26+
Here's the way you can get into any PR, benchmark it, and then benchmark
27+
`master`.
28+
29+
The first `perf.data` will not have any numbers appended, but any subsequent
30+
benchmark will be written to `perf.data.number` with a number growing for 0.
31+
All benchmarks are compressed so that you can
32+
33+
```bash
34+
git fetch upstream pull/<PR_NUMBER>/head:<BRANCH_NAME>
35+
git switch BRANCHNAME
36+
37+
# Bench
38+
cargo lintcheck --perf
39+
40+
# Get last common commit, checkout that
41+
LAST_COMMIT=$(git log BRANCHNAME..master --oneline | tail -1 | cut -c 1-11)
42+
git switch -c temporary $LAST_COMMIT
43+
44+
# We're now on master
45+
46+
# Bench
47+
cargo lintcheck --perf
48+
perf diff ./target/lintcheck/sources/CRATE/perf.data ./target/lintcheck/sources/CRATE/perf.data.0
49+
```
50+
51+
52+
[perf]: https://perfwiki.github.io/main/
53+
[flamegraph-perf]: https://github.com/brendangregg/FlameGraph
54+
[flamegraph-rs]: https://github.com/flamegraph-rs/flamegraph
55+
[rustc-perf]: https://github.com/rust-lang/rustc-perf

0 commit comments

Comments
 (0)