Skip to content

Commit 561303d

Browse files
committed
Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyup
2 parents 6f65ef5 + d9c24d1 commit 561303d

File tree

516 files changed

+5241
-2537
lines changed

Some content is hidden

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

516 files changed

+5241
-2537
lines changed

src/tools/clippy/.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
5151
5252
- name: Build
53-
run: cargo build --features deny-warnings,internal
53+
run: cargo build --tests --features deny-warnings,internal
5454

5555
- name: Test
5656
run: cargo test --features deny-warnings,internal

src/tools/clippy/.github/workflows/clippy_bors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
echo "$SYSROOT/bin" >> $GITHUB_PATH
107107
108108
- name: Build
109-
run: cargo build --features deny-warnings,internal
109+
run: cargo build --tests --features deny-warnings,internal
110110

111111
- name: Test
112112
if: runner.os == 'Linux'

src/tools/clippy/CHANGELOG.md

Lines changed: 110 additions & 70 deletions
Large diffs are not rendered by default.

src/tools/clippy/Cargo.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.72"
3+
version = "0.1.73"
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"
@@ -36,6 +36,17 @@ walkdir = "2.3"
3636
filetime = "0.2"
3737
itertools = "0.10.1"
3838

39+
# UI test dependencies
40+
clippy_utils = { path = "clippy_utils" }
41+
derive-new = "0.5"
42+
if_chain = "1.0"
43+
quote = "1.0"
44+
serde = { version = "1.0.125", features = ["derive"] }
45+
syn = { version = "2.0", features = ["full"] }
46+
futures = "0.3"
47+
parking_lot = "0.12"
48+
tokio = { version = "1", features = ["io-util"] }
49+
3950
[build-dependencies]
4051
rustc_tools_util = "0.3.0"
4152

src/tools/clippy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
77

8-
[There are over 600 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are over 650 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

1010
Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
1111
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.

src/tools/clippy/book/src/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
A collection of lints to catch common mistakes and improve your
77
[Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are over 600 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are over 650 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

1111
Lints are divided into categories, each with a default [lint
1212
level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how

src/tools/clippy/book/src/development/infrastructure/changelog_update.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,6 @@ and open that file in your editor of choice.
5656
When updating the changelog it's also a good idea to make sure that `commit1` is
5757
already correct in the current changelog.
5858

59-
#### PR ranges
60-
61-
We developed the concept of PR ranges to help the user understand the size of a new update. To create a PR range,
62-
get the current release date and the date that the last version was released (YYYY-MM-DD) and use the following link:
63-
64-
```
65-
[**View <NUMBER OF PRs> PRs merged since 1.<LAST VERSION NUM>**](https://github.com/rust-lang/rust-clippy/pulls?q=is%3Apr+is%3Aclosed+merged%3A<LAST VERSION DATE>..<CURRENT VERSION DATE>+base%3Amaster+sort%3Amerged-desc+)
66-
```
67-
68-
> Note: Be sure to check click the link and check how many PRs got merged between
69-
70-
Example:
71-
72-
```
73-
[**View 85 PRs merged since 1.69**](https://github.com/rust-lang/rust-clippy/pulls?q=is%3Apr+is%3Aclosed+merged%3A2023-04-20..2023-06-01+base%3Amaster+sort%3Amerged-desc+)
74-
```
75-
76-
Which renders to:
77-
[**View 85 PRs merged since 1.69**](https://github.com/rust-lang/rust-clippy/pulls?q=is%3Apr+is%3Aclosed+merged%3A2023-04-20..2023-06-01+base%3Amaster+sort%3Amerged-desc+)
78-
79-
Note that **commit ranges should not be included**, only PR ranges.
80-
8159
### 3. Authoring the final changelog
8260

8361
The above script should have dumped all the relevant PRs to the file you
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Speedtest
2+
`SPEEDTEST` is the tool we use to measure lint's performance, it works by executing the same test several times.
3+
4+
It's useful for measuring changes to current lints and deciding if the performance changes too much. `SPEEDTEST` is
5+
accessed by the `SPEEDTEST` (and `SPEEDTEST_*`) environment variables.
6+
7+
## Checking Speedtest
8+
9+
To do a simple speed test of a lint (e.g. `allow_attributes`), use this command.
10+
11+
```sh
12+
$ SPEEDTEST=ui TESTNAME="allow_attributes" cargo uitest -- --nocapture
13+
```
14+
15+
This will test all `ui` tests (`SPEEDTEST=ui`) whose names start with `allow_attributes`. By default, `SPEEDTEST` will
16+
iterate your test 1000 times. But you can change this with `SPEEDTEST_ITERATIONS`.
17+
18+
```sh
19+
$ SPEEDTEST=toml SPEEDTEST_ITERATIONS=100 TESTNAME="semicolon_block" cargo uitest -- --nocapture
20+
```
21+
22+
> **WARNING**: Be sure to use `-- --nocapture` at the end of the command to see the average test time. If you don't
23+
> use `-- --nocapture` (e.g. `SPEEDTEST=ui` `TESTNAME="let_underscore_untyped" cargo uitest -- --nocapture`), this
24+
> will not show up.

src/tools/clippy/book/src/lint_configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ The maximum amount of nesting a block can reside in
175175

176176
## `disallowed-names`
177177
The list of disallowed names to lint about. NB: `bar` is not here since it has legitimate uses. The value
178-
`".."` can be used as part of the list to indicate, that the configured values should be appended to the
178+
`".."` can be used as part of the list to indicate that the configured values should be appended to the
179179
default configuration of Clippy. By default, any configuration will replace the default value.
180180

181181
**Default Value:** `["foo", "baz", "quux"]` (`Vec<String>`)

src/tools/clippy/clippy_dev/src/new_lint.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
358358

359359
let mod_file_path = ty_dir.join("mod.rs");
360360
let context_import = setup_mod_file(&mod_file_path, lint)?;
361+
let pass_lifetimes = match context_import {
362+
"LateContext" => "<'_>",
363+
_ => "",
364+
};
361365

362366
let name_upper = lint.name.to_uppercase();
363367
let mut lint_file_contents = String::new();
@@ -372,7 +376,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
372376
use super::{name_upper};
373377
374378
// TODO: Adjust the parameters as necessary
375-
pub(super) fn check(cx: &{context_import}, msrv: &Msrv) {{
379+
pub(super) fn check(cx: &{context_import}{pass_lifetimes}, msrv: &Msrv) {{
376380
if !msrv.meets(todo!("Add a new entry in `clippy_utils/src/msrvs`")) {{
377381
return;
378382
}}
@@ -389,7 +393,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
389393
use super::{name_upper};
390394
391395
// TODO: Adjust the parameters as necessary
392-
pub(super) fn check(cx: &{context_import}) {{
396+
pub(super) fn check(cx: &{context_import}{pass_lifetimes}) {{
393397
todo!();
394398
}}
395399
"#

0 commit comments

Comments
 (0)