Skip to content

Update Clippy #92437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 86 commits into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
e1225bf
Auto merge of #7810 - camsteffen:if-then-panic-pedantic, r=flip1995
bors Oct 28, 2021
d23a338
Format backport to pass CI
flip1995 Nov 3, 2021
00e31fa
Auto merge of #7925 - flip1995:backport, r=flip1995
bors Nov 3, 2021
17c1ff9
let-else: use hir::Let in clippy
cormacrelf Oct 13, 2021
a89a063
Remove `SymbolStr`.
nnethercote Dec 14, 2021
ecd4919
Remove unnecessary sigils around `Symbol::as_str()` calls.
nnethercote Dec 15, 2021
a83c935
Remove unnecessary sigils around `Ident::as_str()` calls.
nnethercote Dec 15, 2021
ece0946
Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup
flip1995 Dec 17, 2021
4e3fac9
Merge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 Dec 17, 2021
50d4e56
Auto merge of #8135 - flip1995:backport_remerge, r=flip1995
bors Dec 17, 2021
80e9864
Update changelog
Manishearth Dec 17, 2021
8160ccd
Update CHANGELOG.md
Manishearth Dec 17, 2021
69bd99f
Update CHANGELOG.md
Manishearth Dec 17, 2021
0da30f1
Auto merge of #8136 - Manishearth:changelog, r=giraffate
bors Dec 17, 2021
13ad14b
update: ```Sugg::not()``` replacing the comparison operator. #7320
hotate29 Dec 10, 2021
adcd3de
Fix commits and formatting of CHANGELOG.md
flip1995 Dec 17, 2021
a3bf9d1
Auto merge of #8137 - flip1995:changelog, r=Manishearth
bors Dec 17, 2021
eba4413
Fix SAFETY comment tag casing in undocumented_unsafe_blocks
wooster0 Dec 17, 2021
af1eea3
Auto merge of #89841 - cormacrelf:let-else-typed, r=nagisa
bors Dec 17, 2021
4da5520
Ensure that RETURN_SELF_NOT_MUST_USE is not emitted if the method alr…
GuillaumeGomez Dec 18, 2021
25e90ec
Auto merge of #8143 - GuillaumeGomez:RETURN_SELF_NOT_MUST_USE, r=xFre…
bors Dec 18, 2021
879ecce
Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
bors Dec 19, 2021
07a00ef
Don't emit RETURN_SELF_NOT_MUST_USE lint if `Self` already is marked …
GuillaumeGomez Dec 19, 2021
1962ce0
Auto merge of #8146 - GuillaumeGomez:must-use-self, r=xFrednet
bors Dec 19, 2021
7905130
Auto merge of #8138 - r00ster91:safety, r=giraffate
bors Dec 20, 2021
eb47398
Test clippy_utils in CI
flip1995 Dec 20, 2021
fea103d
Auto merge of #8150 - flip1995:clippy_utils_test, r=xFrednet
bors Dec 20, 2021
5ad37b1
add suggestion for neg_multiply lint
Gh0stm4chine Dec 19, 2021
88e40bc
Add support for suggestion when using an expression
Gh0stm4chine Dec 21, 2021
01217f6
Bless clippy test.
m-ou-se Dec 22, 2021
dce3151
Add allow precedence lint to prevent rustfix from failing
Gh0stm4chine Dec 23, 2021
13cc452
Add allow unused
Gh0stm4chine Dec 23, 2021
9ae4043
Auto merge of #8144 - Gh0stm4chine:master, r=xFrednet
bors Dec 23, 2021
79cf412
Imrpove `unwrap_or_else_default`
pmnoxx Dec 24, 2021
26cc551
rewrite the PR
pmnoxx Dec 24, 2021
88871bf
Fix tests
pmnoxx Dec 24, 2021
db236e6
Fix tests
pmnoxx Dec 24, 2021
ab77c92
cargo dev fmt
pmnoxx Dec 24, 2021
8b19845
refactor
pmnoxx Dec 24, 2021
4b3a87f
clippy
pmnoxx Dec 24, 2021
01b7411
Refactor
pmnoxx Dec 24, 2021
2a47dbc
Simplify code
pmnoxx Dec 24, 2021
8529b2a
Auto merge of #8163 - pmnoxx:piotr-improve-unwrap-or-default, r=Manis…
bors Dec 24, 2021
b3b65a1
Add test
hotate29 Dec 14, 2021
0b6d1fd
refactor ```Sugg::BinOp```
hotate29 Dec 15, 2021
45a3b51
Use helper functions in ```Sugg``` tests.
hotate29 Dec 21, 2021
07b6927
Change ```floating_point_arthmetic::detect_hypot()``` to enclose the …
hotate29 Dec 24, 2021
a172439
Change to enclose both sides of Range in parentheses.
hotate29 Dec 21, 2021
1b67aa7
fix `shadow_reuse` false negative for if let bindings
ebobrow Dec 24, 2021
eb24acf
Auto merge of #8165 - ebobrow:shadow_reuse_fn, r=xFrednet
bors Dec 25, 2021
23ffa3c
fix an ICE on unwrapping a None
llogiq Dec 25, 2021
547efad
Auto merge of #8167 - rust-lang:fix-8166, r=xFredNet
bors Dec 25, 2021
f327f0e
Refactor `enum_variants`
dswij Dec 15, 2021
d58fdfb
Fix False Positive on `enum_variants` when prefixes are not camel-case
dswij Dec 22, 2021
c76e2d1
Add str_util helpers to split camelcase strings
dswij Dec 22, 2021
df2e4d1
update `enum_variants` test
dswij Dec 22, 2021
8ed723b
Update str_utils test
dswij Dec 23, 2021
c8f016f
Fix reversed suggestion on postfix
dswij Dec 23, 2021
6f7e5cb
Some minor cleanup
dswij Dec 24, 2021
b82c9ce
Add limitation description for `enum_variant_names`
dswij Dec 24, 2021
4ffd660
Fixes #8128
surechen Dec 17, 2021
bb7b6be
Auto merge of #8133 - surechen:fix_8128, r=xFrednet
bors Dec 26, 2021
3ebd2bc
new lint: `init-numbered-fields`
llogiq Dec 25, 2021
c749b2d
Readme: note that config changes don't apply to already compiled code
bors Dec 27, 2021
44719b5
Auto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq
bors Dec 27, 2021
adba132
Auto merge of #8170 - rust-lang:numbered-fields, r=xFrednet
bors Dec 27, 2021
b59ff58
Fixed some typos in README and CONTRIBUTING
ApamNapat Dec 27, 2021
ba70842
Limit the identity_op lint to integral operands.
alex-ozdemir Dec 28, 2021
5d194d1
Auto merge of #8181 - ApamNapat:typos_fixes, r=giraffate
bors Dec 28, 2021
8da9a82
cache test item names
llogiq Dec 27, 2021
3354876
Auto merge of #8182 - rust-lang:cache-test-items, r=giraffate
bors Dec 28, 2021
a11e5c2
Readme: note that config changes don't apply to already compiled code
bors Dec 28, 2021
3c1b3ec
Auto merge of #8175 - Kage-Yami:feature/document-8145, r=llogiq
bors Dec 28, 2021
fc72e91
`needless_return` suggest return unit type on void returns
bors Dec 28, 2021
526fb6b
Auto merge of #8185 - dswij:8177, r=llogiq
bors Dec 28, 2021
56ccd30
Auto merge of #8127 - dswij:8090, r=xFrednet
bors Dec 28, 2021
bc0579f
test
alex-ozdemir Dec 28, 2021
ee6d5c5
contants peel_refs to catch `x << &0`
alex-ozdemir Dec 28, 2021
d5c4119
Fixed issues with to_radians and to_degrees lints
ApamNapat Dec 28, 2021
a139949
Auto merge of #8187 - ApamNapat:fix_7651, r=llogiq
bors Dec 28, 2021
16ef044
Auto merge of #8183 - alex-ozdemir:limit-ident, r=camsteffen
bors Dec 28, 2021
c1cd64b
Auto merge of #8117 - hotate29:issue7320, r=camsteffen
bors Dec 28, 2021
e45842e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Dec 30, 2021
b0f9894
Bump nightly version -> 2021-12-30
flip1995 Dec 30, 2021
0eff589
Auto merge of #8196 - flip1995:rustup, r=flip1995
bors Dec 30, 2021
4bb6fde
Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup
flip1995 Dec 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/tools/clippy/.github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
working-directory: clippy_lints

- name: Test clippy_utils
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
working-directory: clippy_utils

- name: Test rustc_tools_util
run: cargo test --features deny-warnings
working-directory: rustc_tools_util
Expand Down
4 changes: 4 additions & 0 deletions src/tools/clippy/.github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ jobs:
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
working-directory: clippy_lints

- name: Test clippy_utils
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
working-directory: clippy_utils

- name: Test rustc_tools_util
run: cargo test --features deny-warnings
working-directory: rustc_tools_util
Expand Down
123 changes: 119 additions & 4 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,127 @@ document.

## Unreleased / In Rust Nightly

[b7f3f7f...master](https://github.com/rust-lang/rust-clippy/compare/b7f3f7f...master)
[e181011...master](https://github.com/rust-lang/rust-clippy/compare/e181011...master)

## Rust 1.58 (beta)

Current beta, release 2022-01-13

[00e31fa...e181011](https://github.com/rust-lang/rust-clippy/compare/00e31fa...e181011)

### New lints

* [`transmute_num_to_bytes`]
[#7805](https://github.com/rust-lang/rust-clippy/pull/7805)
* [`match_str_case_mismatch`]
[#7806](https://github.com/rust-lang/rust-clippy/pull/7806)
* [`format_in_format_args`], [`to_string_in_format_args`]
[#7743](https://github.com/rust-lang/rust-clippy/pull/7743)
* [`uninit_vec`]
[#7682](https://github.com/rust-lang/rust-clippy/pull/7682)
* [`fn_to_numeric_cast_any`]
[#7705](https://github.com/rust-lang/rust-clippy/pull/7705)
* [`undocumented_unsafe_blocks`]
[#7748](https://github.com/rust-lang/rust-clippy/pull/7748)
* [`trailing_empty_array`]
[#7838](https://github.com/rust-lang/rust-clippy/pull/7838)
* [`string_slice`]
[#7878](https://github.com/rust-lang/rust-clippy/pull/7878)

### Moves or deprecations of lints

* Move [`non_send_fields_in_send_ty`] to `suspicious`
[#7874](https://github.com/rust-lang/rust-clippy/pull/7874)
* Move [`non_ascii_literal`] to `restriction`
[#7907](https://github.com/rust-lang/rust-clippy/pull/7907)

### Changes that expand what code existing lints cover

* [`question_mark`] now covers `Result`
[#7840](https://github.com/rust-lang/rust-clippy/pull/7840)
* Make [`useless_format`] recognize bare `format!("")`
[#7801](https://github.com/rust-lang/rust-clippy/pull/7801)
* Lint on underscored variables with no side effects in [`no_effect`]
[#7775](https://github.com/rust-lang/rust-clippy/pull/7775)
* Expand [`match_ref_pats`] to check for multiple reference patterns
[#7800](https://github.com/rust-lang/rust-clippy/pull/7800)

### False positive fixes

* Fix false positive of [`implicit_saturating_sub`] with `else` clause
[#7832](https://github.com/rust-lang/rust-clippy/pull/7832)
* Fix [`question_mark`] when there is call in conditional predicate
[#7860](https://github.com/rust-lang/rust-clippy/pull/7860)
* [`mut_mut`] no longer lints when type is defined in external macros
[#7795](https://github.com/rust-lang/rust-clippy/pull/7795)
* Avoid [`eq_op`] in test functions
[#7811](https://github.com/rust-lang/rust-clippy/pull/7811)
* [`cast_possible_truncation`] no longer lints when cast is coming from `signum`
method call [#7850](https://github.com/rust-lang/rust-clippy/pull/7850)
* [`match_str_case_mismatch`] no longer lints on uncased characters
[#7865](https://github.com/rust-lang/rust-clippy/pull/7865)
* [`ptr_arg`] no longer lints references to type aliases
[#7890](https://github.com/rust-lang/rust-clippy/pull/7890)
* [`missing_safety_doc`] now also accepts "implementation safety" headers
[#7856](https://github.com/rust-lang/rust-clippy/pull/7856)
* [`missing_safety_doc`] no longer lints if any parent has `#[doc(hidden)]`
attribute [#7849](https://github.com/rust-lang/rust-clippy/pull/7849)
* [`if_not_else`] now ignores else-if statements
[#7895](https://github.com/rust-lang/rust-clippy/pull/7895)
* Avoid linting [`cast_possible_truncation`] on bit-reducing operations
[#7819](https://github.com/rust-lang/rust-clippy/pull/7819)
* Avoid linting [`field_reassign_with_default`] when `Drop` and `Copy` are
involved [#7794](https://github.com/rust-lang/rust-clippy/pull/7794)
* [`unnecessary_sort_by`] now checks if argument implements `Ord` trait
[#7824](https://github.com/rust-lang/rust-clippy/pull/7824)
* Fix false positive in [`match_overlapping_arm`]
[#7847](https://github.com/rust-lang/rust-clippy/pull/7847)
* Prevent [`needless_lifetimes`] false positive in `async` function definition
[#7901](https://github.com/rust-lang/rust-clippy/pull/7901)

### Suggestion fixes/improvements

* Keep an initial `::` when [`doc_markdown`] suggests to use ticks
[#7916](https://github.com/rust-lang/rust-clippy/pull/7916)
* Add a machine applicable suggestion for the [`doc_markdown`] missing backticks
lint [#7904](https://github.com/rust-lang/rust-clippy/pull/7904)
* [`equatable_if_let`] no longer expands macros in the suggestion
[#7788](https://github.com/rust-lang/rust-clippy/pull/7788)
* Make [`shadow_reuse`] suggestion less verbose
[#7782](https://github.com/rust-lang/rust-clippy/pull/7782)

### ICE fixes

* Fix ICE in [`enum_variant_names`]
[#7873](https://github.com/rust-lang/rust-clippy/pull/7873)
* Fix ICE in [`undocumented_unsafe_blocks`]
[#7891](https://github.com/rust-lang/rust-clippy/pull/7891)

### Documentation improvements

* Fixed naive doc formatting for `#[must_use]` lints ([`must_use_unit`],
[`double_must_use`], [`must_use_candidate`], [`let_underscore_must_use`])
[#7827](https://github.com/rust-lang/rust-clippy/pull/7827)
* Fix typo in example for [`match_result_ok`]
[#7815](https://github.com/rust-lang/rust-clippy/pull/7815)

### Others

* Allow giving reasons for [`disallowed_types`]
[#7791](https://github.com/rust-lang/rust-clippy/pull/7791)
* Fix [`manual_assert`] and [`match_wild_err_arm`] for `#![no_std]` and Rust
2021. [#7851](https://github.com/rust-lang/rust-clippy/pull/7851)
* Fix regression in [`semicolon_if_nothing_returned`] on macros containing while
loops [#7789](https://github.com/rust-lang/rust-clippy/pull/7789)
* Added a new configuration `literal-suffix-style` to enforce a certain style
writing [`unseparated_literal_suffix`]
[#7726](https://github.com/rust-lang/rust-clippy/pull/7726)

## Rust 1.57

Current beta, release 2021-12-02
Current stable, released 2021-12-02

[7bfc26e...b7f3f7f](https://github.com/rust-lang/rust-clippy/compare/7bfc26e...b7f3f7f)
[7bfc26e...00e31fa](https://github.com/rust-lang/rust-clippy/compare/7bfc26e...00e31fa)

### New Lints

Expand Down Expand Up @@ -161,7 +275,7 @@ Current beta, release 2021-12-02

## Rust 1.56

Current stable, released 2021-10-21
Released 2021-10-21

[74d1561...7bfc26e](https://github.com/rust-lang/rust-clippy/compare/74d1561...7bfc26e)

Expand Down Expand Up @@ -2912,6 +3026,7 @@ Released 2018-09-13
[`infinite_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#infinite_iter
[`inherent_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string
[`inherent_to_string_shadow_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string_shadow_display
[`init_numbered_fields`]: https://rust-lang.github.io/rust-clippy/master/index.html#init_numbered_fields
[`inline_always`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_always
[`inline_asm_x86_att_syntax`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_asm_x86_att_syntax
[`inline_asm_x86_intel_syntax`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_asm_x86_intel_syntax
Expand Down
8 changes: 4 additions & 4 deletions src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ which `IntelliJ Rust` will be able to understand.
Run `cargo dev setup intellij --repo-path <repo-path>` where `<repo-path>` is a path to the rustc repo
you just cloned.
The command will add path-dependencies pointing towards rustc-crates inside the rustc repo to
Clippys `Cargo.toml`s and should allow `IntelliJ Rust` to understand most of the types that Clippy uses.
Clippy's `Cargo.toml`s and should allow `IntelliJ Rust` to understand most of the types that Clippy uses.
Just make sure to remove the dependencies again before finally making a pull request!

[rustc_repo]: https://github.com/rust-lang/rust/
[IntelliJ_rust_homepage]: https://intellij-rust.github.io/

### Rust Analyzer
As of [#6869][6869], [`rust-analyzer`][ra_homepage] can understand that Clippy uses compiler-internals
using `extern crate` when `package.metadata.rust-analyzer.rustc_private` is set to `true` in Clippys `Cargo.toml.`
You will required a `nightly` toolchain with the `rustc-dev` component installed.
using `extern crate` when `package.metadata.rust-analyzer.rustc_private` is set to `true` in Clippy's `Cargo.toml.`
You will require a `nightly` toolchain with the `rustc-dev` component installed.
Make sure that in the `rust-analyzer` configuration, you set
```
{ "rust-analyzer.rustcSource": "discover" }
Expand Down Expand Up @@ -228,7 +228,7 @@ about `subtree`s in the Rust repository see [Rust's `CONTRIBUTING.md`][subtree].

### Patching git-subtree to work with big repos

Currently there's a bug in `git-subtree` that prevents it from working properly
Currently, there's a bug in `git-subtree` that prevents it from working properly
with the [`rust-lang/rust`] repo. There's an open PR to fix that, but it's stale.
Before continuing with the following steps, we need to manually apply that fix to
our local copy of `git-subtree`.
Expand Down
10 changes: 7 additions & 3 deletions src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ line. (You can swap `clippy::all` with the specific lint category you are target
## Configuration

Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a basic `variable =
value` mapping eg.
value` mapping e.g.

```toml
avoid-breaking-exported-api = false
Expand All @@ -155,6 +155,10 @@ cognitive-complexity-threshold = 30
See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which
lints can be configured and the meaning of the variables.

Note that configuration changes will not apply for code that has already been compiled and cached under `./target/`;
for example, adding a new string to `doc-valid-idents` may still result in Clippy flagging that string. To be sure that
any configuration changes are applied, you may want to run `cargo clean` and re-compile your crate from scratch.

To deactivate the “for further information visit *lint-link*” message you can
define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.

Expand Down Expand Up @@ -193,7 +197,7 @@ And to warn on `lint_name`, run
cargo clippy -- -W clippy::lint_name
```

This also works with lint groups. For example you
This also works with lint groups. For example, you
can run Clippy with warnings for all lints enabled:
```terminal
cargo clippy -- -W clippy::pedantic
Expand Down Expand Up @@ -228,7 +232,7 @@ fn main() {
You can also omit the patch version when specifying the MSRV, so `msrv = 1.30`
is equivalent to `msrv = 1.30.0`.

Note: `custom_inner_attributes` is an unstable feature so it has to be enabled explicitly.
Note: `custom_inner_attributes` is an unstable feature, so it has to be enabled explicitly.

Lints that recognize this configuration option can be found [here](https://rust-lang.github.io/rust-clippy/master/index.html#msrv)

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl ApproxConstant {
let s = s.as_str();
if s.parse::<f64>().is_ok() {
for &(constant, name, min_digits, msrv) in &KNOWN_CONSTS {
if is_approx_const(constant, &s, min_digits)
if is_approx_const(constant, s, min_digits)
&& msrv.as_ref().map_or(true, |msrv| meets_msrv(self.msrv.as_ref(), msrv))
{
span_lint_and_help(
Expand Down
6 changes: 4 additions & 2 deletions src/tools/clippy/clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,10 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
|| is_word(lint, sym::deprecated)
|| is_word(lint, sym!(unreachable_pub))
|| is_word(lint, sym!(unused))
|| extract_clippy_lint(lint).map_or(false, |s| s.as_str() == "wildcard_imports")
|| extract_clippy_lint(lint).map_or(false, |s| s.as_str() == "enum_glob_use")
|| extract_clippy_lint(lint)
.map_or(false, |s| s.as_str() == "wildcard_imports")
|| extract_clippy_lint(lint)
.map_or(false, |s| s.as_str() == "enum_glob_use")
{
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ pub(super) fn check(
if cast_from.kind() == cast_to.kind() =>
{
if let Some(src) = snippet_opt(cx, lit.span) {
let num_lit = NumericLiteral::from_lit_kind(&src, &lit.node).unwrap();
lint_unnecessary_cast(cx, expr, num_lit.integer, cast_from, cast_to);
if let Some(num_lit) = NumericLiteral::from_lit_kind(&src, &lit.node) {
lint_unnecessary_cast(cx, expr, num_lit.integer, cast_from, cast_to);
}
}
},
_ => {
Expand Down
Loading