Skip to content

Commit 1a385b8

Browse files
committed
Merge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup
2 parents 3cb1c11 + 61eb38a commit 1a385b8

File tree

142 files changed

+3185
-1086
lines changed

Some content is hidden

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

142 files changed

+3185
-1086
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
working-directory: clippy_workspace_tests
7272

7373
- name: Test cargo-clippy --fix
74-
run: ../target/debug/cargo-clippy clippy --fix -Zunstable-options
74+
run: ../target/debug/cargo-clippy clippy --fix
7575
working-directory: clippy_workspace_tests
7676

7777
- name: Test clippy-driver

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ jobs:
9090
- name: Checkout
9191
uses: actions/[email protected]
9292

93-
# FIXME: should not be necessary once 1.24.2 is the default version on the windows runner
94-
- name: Update rustup
95-
run: rustup self update
96-
if: runner.os == 'Windows'
97-
9893
- name: Install toolchain
9994
run: rustup show active-toolchain
10095

@@ -139,7 +134,7 @@ jobs:
139134
working-directory: clippy_workspace_tests
140135

141136
- name: Test cargo-clippy --fix
142-
run: ../target/debug/cargo-clippy clippy --fix -Zunstable-options
137+
run: ../target/debug/cargo-clippy clippy --fix
143138
working-directory: clippy_workspace_tests
144139

145140
- name: Test clippy-driver

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/[email protected]
2323

2424
- name: Install remark
25-
run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended
25+
run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended remark-gfm
2626

2727
# Run
2828
- name: Check *.md files

src/tools/clippy/.remarkrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"plugins": [
33
"remark-preset-lint-recommended",
4+
"remark-gfm",
45
["remark-lint-list-item-indent", false],
56
["remark-lint-no-literal-urls", false],
67
["remark-lint-no-shortcut-reference-link", false],

src/tools/clippy/CHANGELOG.md

+136-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,139 @@ document.
66

77
## Unreleased / In Rust Nightly
88

9-
[7c7683c...master](https://github.com/rust-lang/rust-clippy/compare/7c7683c...master)
9+
[3ae8faf...master](https://github.com/rust-lang/rust-clippy/compare/3ae8faf...master)
10+
11+
## Rust 1.54
12+
13+
Current beta, release 2021-07-29
14+
15+
[7c7683c...3ae8faf](https://github.com/rust-lang/rust-clippy/compare/7c7683c...3ae8faf)
16+
17+
### New Lints
18+
19+
- [`ref_binding_to_reference`]
20+
[#7105](https://github.com/rust-lang/rust-clippy/pull/7105)
21+
- [`needless_bitwise_bool`]
22+
[#7133](https://github.com/rust-lang/rust-clippy/pull/7133)
23+
- [`unused_async`] [#7225](https://github.com/rust-lang/rust-clippy/pull/7225)
24+
- [`manual_str_repeat`]
25+
[#7265](https://github.com/rust-lang/rust-clippy/pull/7265)
26+
- [`suspicious_splitn`]
27+
[#7292](https://github.com/rust-lang/rust-clippy/pull/7292)
28+
29+
### Moves and Deprecations
30+
31+
- Deprecate `pub_enum_variant_names` and `wrong_pub_self_convention` in favor of
32+
the new `avoid_breaking_exported_api` config option (see
33+
[Enhancements](#1-54-enhancements))
34+
[#7187](https://github.com/rust-lang/rust-clippy/pull/7187)
35+
- Move [`inconsistent_struct_constructor`] to `pedantic`
36+
[#7193](https://github.com/rust-lang/rust-clippy/pull/7193)
37+
- Move [`needless_borrow`] to `style` (now warn-by-default)
38+
[#7254](https://github.com/rust-lang/rust-clippy/pull/7254)
39+
- Move [`suspicious_operation_groupings`] to `nursery`
40+
[#7266](https://github.com/rust-lang/rust-clippy/pull/7266)
41+
- Move [`semicolon_if_nothing_returned`] to `pedantic`
42+
[#7268](https://github.com/rust-lang/rust-clippy/pull/7268)
43+
44+
### Enhancements <a name="1-54-enhancements"></a>
45+
46+
- [`while_let_on_iterator`]: Now also lints in nested loops
47+
[#6966](https://github.com/rust-lang/rust-clippy/pull/6966)
48+
- [`single_char_pattern`]: Now also lints on `strip_prefix` and `strip_suffix`
49+
[#7156](https://github.com/rust-lang/rust-clippy/pull/7156)
50+
- [`needless_collect`]: Now also lints on assignments with type annotations
51+
[#7163](https://github.com/rust-lang/rust-clippy/pull/7163)
52+
- [`if_then_some_else_none`]: Now works with the MSRV config
53+
[#7177](https://github.com/rust-lang/rust-clippy/pull/7177)
54+
- Add `avoid_breaking_exported_api` config option for the lints
55+
[`enum_variant_names`], [`large_types_passed_by_value`],
56+
[`trivially_copy_pass_by_ref`], [`unnecessary_wraps`],
57+
[`upper_case_acronyms`], and [`wrong_self_convention`]. We recommend to set
58+
this configuration option to `false` before a major release (1.0/2.0/...) to
59+
clean up the API [#7187](https://github.com/rust-lang/rust-clippy/pull/7187)
60+
- [`needless_collect`]: Now lints on even more data structures
61+
[#7188](https://github.com/rust-lang/rust-clippy/pull/7188)
62+
- [`missing_docs_in_private_items`]: No longer sees `#[<name> = "<value>"]` like
63+
attributes as sufficient documentation
64+
[#7281](https://github.com/rust-lang/rust-clippy/pull/7281)
65+
- [`needless_collect`], [`short_circuit_statement`], [`unnecessary_operation`]:
66+
Now work as expected when used with `allow`
67+
[#7282](https://github.com/rust-lang/rust-clippy/pull/7282)
68+
69+
### False Positive Fixes
70+
71+
- [`implicit_return`]: Now takes all diverging functions in account to avoid
72+
false positives [#6951](https://github.com/rust-lang/rust-clippy/pull/6951)
73+
- [`while_let_on_iterator`]: No longer lints when the iterator is a struct field
74+
and the struct is used in the loop
75+
[#6966](https://github.com/rust-lang/rust-clippy/pull/6966)
76+
- [`multiple_inherent_impl`]: No longer lints with generic arguments
77+
[#7089](https://github.com/rust-lang/rust-clippy/pull/7089)
78+
- [`comparison_chain`]: No longer lints in a `const` context
79+
[#7118](https://github.com/rust-lang/rust-clippy/pull/7118)
80+
- [`while_immutable_condition`]: Fix false positive where mutation in the loop
81+
variable wasn't picked up
82+
[#7144](https://github.com/rust-lang/rust-clippy/pull/7144)
83+
- [`default_trait_access`]: No longer lints in macros
84+
[#7150](https://github.com/rust-lang/rust-clippy/pull/7150)
85+
- [`needless_question_mark`]: No longer lints when the inner value is implicitly
86+
dereferenced [#7165](https://github.com/rust-lang/rust-clippy/pull/7165)
87+
- [`unused_unit`]: No longer lints when multiple macro contexts are involved
88+
[#7167](https://github.com/rust-lang/rust-clippy/pull/7167)
89+
- [`eval_order_dependence`]: Fix false positive in async context
90+
[#7174](https://github.com/rust-lang/rust-clippy/pull/7174)
91+
- [`unnecessary_filter_map`]: No longer lints if the `filter_map` changes the
92+
type [#7175](https://github.com/rust-lang/rust-clippy/pull/7175)
93+
- [`wrong_self_convention`]: No longer lints in trait implementations of
94+
non-`Copy` types [#7182](https://github.com/rust-lang/rust-clippy/pull/7182)
95+
- [`suboptimal_flops`]: No longer lints on `powi(2)`
96+
[#7201](https://github.com/rust-lang/rust-clippy/pull/7201)
97+
- [`wrong_self_convention`]: No longer lints if there is no implicit `self`
98+
[#7215](https://github.com/rust-lang/rust-clippy/pull/7215)
99+
- [`option_if_let_else`]: No longer lints on `else if let` pattern
100+
[#7216](https://github.com/rust-lang/rust-clippy/pull/7216)
101+
- [`use_self`], [`useless_conversion`]: Fix false positives when generic
102+
arguments are involved
103+
[#7223](https://github.com/rust-lang/rust-clippy/pull/7223)
104+
- [`manual_unwrap_or`]: Fix false positive with deref coercion
105+
[#7233](https://github.com/rust-lang/rust-clippy/pull/7233)
106+
- [`similar_names`]: No longer lints on `wparam`/`lparam`
107+
[#7255](https://github.com/rust-lang/rust-clippy/pull/7255)
108+
- [`redundant_closure`]: No longer lints on using the `vec![]` macro in a
109+
closure [#7263](https://github.com/rust-lang/rust-clippy/pull/7263)
110+
111+
### Suggestion Fixes/Improvements
112+
113+
- [`implicit_return`]
114+
[#6951](https://github.com/rust-lang/rust-clippy/pull/6951)
115+
- Fix suggestion for async functions
116+
- Improve suggestion with macros
117+
- Suggest to change `break` to `return` when appropriate
118+
- [`while_let_on_iterator`]: Now suggests `&mut iter` when necessary
119+
[#6966](https://github.com/rust-lang/rust-clippy/pull/6966)
120+
- [`match_single_binding`]: Improve suggestion when match scrutinee has side
121+
effects [#7095](https://github.com/rust-lang/rust-clippy/pull/7095)
122+
- [`needless_borrow`]: Now suggests to also change usage sites as needed
123+
[#7105](https://github.com/rust-lang/rust-clippy/pull/7105)
124+
- [`write_with_newline`]: Improve suggestion when only `\n` is written to the
125+
buffer [#7183](https://github.com/rust-lang/rust-clippy/pull/7183)
126+
- [`from_iter_instead_of_collect`]: The suggestion is now auto applicable also
127+
when a `<_ as Trait>::_` is involved
128+
[#7264](https://github.com/rust-lang/rust-clippy/pull/7264)
129+
- [`not_unsafe_ptr_arg_deref`]: Improved error message
130+
[#7294](https://github.com/rust-lang/rust-clippy/pull/7294)
131+
132+
### ICE Fixes
133+
134+
- Fix ICE when running Clippy on `libstd`
135+
[#7140](https://github.com/rust-lang/rust-clippy/pull/7140)
136+
- [`implicit_return`]
137+
[#7242](https://github.com/rust-lang/rust-clippy/pull/7242)
10138

11139
## Rust 1.53
12140

13-
Current beta, release 2021-06-17
141+
Current stable, released 2021-06-17
14142

15143
[6ed6f1e...7c7683c](https://github.com/rust-lang/rust-clippy/compare/6ed6f1e...7c7683c)
16144

@@ -194,7 +322,7 @@ Current beta, release 2021-06-17
194322

195323
## Rust 1.52
196324

197-
Current stable, released 2021-05-06
325+
Released 2021-05-06
198326

199327
[3e41797...6ed6f1e](https://github.com/rust-lang/rust-clippy/compare/3e41797...6ed6f1e)
200328

@@ -2295,6 +2423,7 @@ Released 2018-09-13
22952423
<!-- begin autogenerated links to lint list -->
22962424
[`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
22972425
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
2426+
[`append_instead_of_extend`]: https://rust-lang.github.io/rust-clippy/master/index.html#append_instead_of_extend
22982427
[`approx_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
22992428
[`as_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions
23002429
[`assertions_on_constants`]: https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
@@ -2358,6 +2487,8 @@ Released 2018-09-13
23582487
[`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
23592488
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
23602489
[`disallowed_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_method
2490+
[`disallowed_script_idents`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_script_idents
2491+
[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type
23612492
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
23622493
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
23632494
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
@@ -2527,6 +2658,7 @@ Released 2018-09-13
25272658
[`misrefactored_assign_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#misrefactored_assign_op
25282659
[`missing_const_for_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
25292660
[`missing_docs_in_private_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items
2661+
[`missing_enforced_import_renames`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_enforced_import_renames
25302662
[`missing_errors_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
25312663
[`missing_inline_in_public_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_inline_in_public_items
25322664
[`missing_panics_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
@@ -2574,6 +2706,7 @@ Released 2018-09-13
25742706
[`non_octal_unix_permissions`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_octal_unix_permissions
25752707
[`nonminimal_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
25762708
[`nonsensical_open_options`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonsensical_open_options
2709+
[`nonstandard_macro_braces`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces
25772710
[`not_unsafe_ptr_arg_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
25782711
[`ok_expect`]: https://rust-lang.github.io/rust-clippy/master/index.html#ok_expect
25792712
[`op_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#op_ref

src/tools/clippy/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ To work around this, you need to have a copy of the [rustc-repo][rustc_repo] ava
115115
`git clone https://github.com/rust-lang/rust/`.
116116
Then you can run a `cargo dev` command to automatically make Clippy use the rustc-repo via path-dependencies
117117
which `IntelliJ Rust` will be able to understand.
118-
Run `cargo dev ide_setup --repo-path <repo-path>` where `<repo-path>` is a path to the rustc repo
118+
Run `cargo dev setup intellij --repo-path <repo-path>` where `<repo-path>` is a path to the rustc repo
119119
you just cloned.
120120
The command will add path-dependencies pointing towards rustc-crates inside the rustc repo to
121121
Clippys `Cargo.toml`s and should allow `IntelliJ Rust` to understand most of the types that Clippy uses.

src/tools/clippy/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.54"
3+
version = "0.1.55"
44
authors = ["The Rust Clippy Developers"]
55
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
66
repository = "https://github.com/rust-lang/rust-clippy"

src/tools/clippy/README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ A collection of lints to catch common mistakes and improve your [Rust](https://g
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.
1212

13-
| Category | Description | Default level |
14-
| --------------------- | ----------------------------------------------------------------------- | ------------- |
15-
| `clippy::all` | all lints that are on by default (correctness, style, complexity, perf) | **warn/deny** |
16-
| `clippy::correctness` | code that is outright wrong or very useless | **deny** |
17-
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
18-
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
19-
| `clippy::perf` | code that can be written to run faster | **warn** |
20-
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
21-
| `clippy::nursery` | new lints that are still under development | allow |
22-
| `clippy::cargo` | lints for the cargo manifest | allow |
13+
| Category | Description | Default level |
14+
| --------------------- | ----------------------------------------------------------------------------------- | ------------- |
15+
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
16+
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
17+
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
18+
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
19+
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
20+
| `clippy::perf` | code that can be written to run faster | **warn** |
21+
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
22+
| `clippy::nursery` | new lints that are still under development | allow |
23+
| `clippy::cargo` | lints for the cargo manifest | allow |
2324

2425
More to come, please [file an issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
2526

@@ -75,11 +76,10 @@ cargo clippy
7576

7677
#### Automatically applying Clippy suggestions
7778

78-
Clippy can automatically apply some lint suggestions.
79-
Note that this is still experimental and only supported on the nightly channel:
79+
Clippy can automatically apply some lint suggestions, just like the compiler.
8080

8181
```terminal
82-
cargo clippy --fix -Z unstable-options
82+
cargo clippy --fix
8383
```
8484

8585
#### Workspaces

src/tools/clippy/clippy_dev/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2018"
88
bytecount = "0.6"
99
clap = "2.33"
1010
itertools = "0.9"
11-
opener = "0.4"
11+
opener = "0.5"
1212
regex = "1"
1313
shell-escape = "0.1"
1414
walkdir = "2"

src/tools/clippy/clippy_dev/src/fmt.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ pub fn run(check: bool, verbose: bool) {
6060
let entry = entry?;
6161
let path = entry.path();
6262

63-
if path.extension() != Some("rs".as_ref())
64-
|| entry.file_name() == "ice-3891.rs"
65-
// Avoid rustfmt bug rust-lang/rustfmt#1873
66-
|| cfg!(windows) && entry.file_name() == "implicit_hasher.rs"
67-
{
63+
if path.extension() != Some("rs".as_ref()) || entry.file_name() == "ice-3891.rs" {
6864
continue;
6965
}
7066

@@ -90,7 +86,7 @@ pub fn run(check: bool, verbose: bool) {
9086
},
9187
CliError::RaSetupActive => {
9288
eprintln!(
93-
"error: a local rustc repo is enabled as path dependency via `cargo dev ide_setup`.
89+
"error: a local rustc repo is enabled as path dependency via `cargo dev setup intellij`.
9490
Not formatting because that would format the local repo as well!
9591
Please revert the changes to Cargo.tomls first."
9692
);

0 commit comments

Comments
 (0)