]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoFix bug in `referent_used_exactly_once`
Samuel Moelius [Tue, 11 Oct 2022 23:41:44 +0000 (19:41 -0400)]
Fix bug in `referent_used_exactly_once`

21 months agoAuto merge of #9617 - llogiq:cast-nan-to-int, r=Alexendoo
bors [Wed, 12 Oct 2022 11:48:30 +0000 (11:48 +0000)]
Auto merge of #9617 - llogiq:cast-nan-to-int, r=Alexendoo

add `cast-nan-to-int` lint

This fixes #371.

r? `@Alexendoo`

---

changelog: add [`cast-nan-to-int`] lint

21 months agoAuto merge of #9633 - royrustdev:fix_rc_buffer, r=llogiq
bors [Wed, 12 Oct 2022 11:31:38 +0000 (11:31 +0000)]
Auto merge of #9633 - royrustdev:fix_rc_buffer, r=llogiq

update Applicability of `rc_buffer` lint from `MachineApplicable` to `Unspecified`

`Unspecified`

This changes `rc_buffer` from MachineApplicable to Unspecified

```
changelog: change [`rc_buffer`] to Unspecified.
```

fixes #6241

---

changelog: change [`rc_buffer`] to Unspecified.

21 months agoadd `cast-nan-to-int` lint
Andre Bogus [Sat, 8 Oct 2022 21:33:23 +0000 (23:33 +0200)]
add `cast-nan-to-int` lint

21 months agoupdate Applicability of `rc_buffer` from `MachineApplicable` to
royrustdev [Wed, 12 Oct 2022 11:11:48 +0000 (16:41 +0530)]
update Applicability of `rc_buffer` from `MachineApplicable` to
`Unspecified`

21 months agoAuto merge of #9605 - nyurik:fix-inline-edition, r=llogiq
bors [Wed, 12 Oct 2022 07:16:23 +0000 (07:16 +0000)]
Auto merge of #9605 - nyurik:fix-inline-edition, r=llogiq

fix: uninlined_format_args shouldn't inline panic! before 2021ed

Before 2021 edition, `panic!("...")` was not treated as a format string.
Clippy autofix of `panic!("{}", foo)` into `panic!("{foo}")` is incorrect.

changelog: [`uninlined_format_args`]: Do not inline panic! macros before 2021 edition

21 months agoHandle panic! inline_format-arg before ed2021
Yuri Astrakhan [Sat, 8 Oct 2022 08:49:00 +0000 (04:49 -0400)]
Handle panic! inline_format-arg before ed2021

21 months agoAuto merge of #9629 - est31:let_else, r=Jarcho
bors [Tue, 11 Oct 2022 14:26:04 +0000 (14:26 +0000)]
Auto merge of #9629 - est31:let_else, r=Jarcho

Replace manual let else patterns with let else

Clears the codebase from places where the lint added by #8437 is firing, by adopting let else.

changelog: none

21 months agoAuto merge of #9616 - unvalley:add-default-to-lint-groups, r=xFrednet
bors [Tue, 11 Oct 2022 08:35:12 +0000 (08:35 +0000)]
Auto merge of #9616 - unvalley:add-default-to-lint-groups, r=xFrednet

Add Default to Clippy Lints Lint groups

- related to #7958

This PR adds a default (reset) button to Clippy Lints Lint groups. (change for website)
[The page](https://rust-lang.github.io/rust-clippy/master/index.html) sets only `Deprecated` to false by default.
Certainly it is easy to set only `deprecated` to false, but it may be a bit lazy for beginners.

https://user-images.githubusercontent.com/38400669/194831117-3ade7e0d-c4de-4189-9daf-3be8ea3cdd18.mov

changelog: none

21 months agoAuto merge of #9572 - Nilstrieb:as-ptr-cast-mut, r=dswij
bors [Tue, 11 Oct 2022 08:08:17 +0000 (08:08 +0000)]
Auto merge of #9572 - Nilstrieb:as-ptr-cast-mut, r=dswij

Add `as_ptr_cast_mut` lint

This lint detects calls to a `&self`-taking `as_ptr` method, where the result is then immediately cast to a `*mut T`. Code like this is probably invalid, as that pointer will not have write permissions, and `*mut T` is usually used to write through.

Examples of broken code with this pattern:
https://miri.saethlin.dev/ub?crate=lol_alloc&version=0.1.3
https://miri.saethlin.dev/ub?crate=sophon-wasm&version=0.19.0
https://miri.saethlin.dev/ub?crate=polars-core&version=0.24.2
https://miri.saethlin.dev/ub?crate=ach-cell&version=0.1.17

changelog: Add [`as_ptr_cast_mut`]

21 months agoReplace manual let else patterns with let else
est31 [Mon, 10 Oct 2022 20:37:42 +0000 (22:37 +0200)]
Replace manual let else patterns with let else

21 months agoAuto merge of #9610 - Jarcho:fix-9608, r=Alexendoo
bors [Mon, 10 Oct 2022 12:29:15 +0000 (12:29 +0000)]
Auto merge of #9610 - Jarcho:fix-9608, r=Alexendoo

Don't suggest moving tuple structs with a significant drop to late evaluation

fixes #9608

changelog: Don't suggest moving tuple structs with a significant drop to late evaluation

21 months agofix: change command order and remove waste condition
unvalley [Mon, 10 Oct 2022 09:00:15 +0000 (18:00 +0900)]
fix: change command order and remove waste condition

21 months agofeat: add Default to Lint groups
unvalley [Sun, 9 Oct 2022 14:35:52 +0000 (23:35 +0900)]
feat: add Default to Lint groups

21 months agoAuto merge of #9386 - smoelius:further-enhance-needless-borrow, r=Jarcho
bors [Sat, 8 Oct 2022 21:24:54 +0000 (21:24 +0000)]
Auto merge of #9386 - smoelius:further-enhance-needless-borrow, r=Jarcho

Further enhance `needless_borrow`, mildly refactor `redundant_clone`

This PR does the following:
* Moves some code from `redundant_clone` into a new `clippy_utils` module called `mir`, and wraps that code in a function called `dropped_without_further_use`.
* Relaxes the "is copyable" condition condition from #9136 by also suggesting to remove borrows from values dropped without further use. The changes involve the just mentioned function.
* Separates `redundant_clone` into modules.

Strictly speaking, the last bullet is independent of the others. `redundant_clone` is somewhat hairy, IMO. Separating it into modules makes it slightly less so, by helping to delineate what depends upon what.

I've tried to break everything up into digestible commits.

r? `@Jarcho`

(`@Jarcho` I hope you don't mind.)

changelog: continuation of #9136

21 months agoAuto merge of #9451 - kraktus:manual_filter2, r=dswij
bors [Sat, 8 Oct 2022 15:58:51 +0000 (15:58 +0000)]
Auto merge of #9451 - kraktus:manual_filter2, r=dswij

Add `manual_filter` lint for `Option`

Share much of its implementation with `manual_map` and should greatly benefit from its previous feedback.
I'm sure it's possible to even more refactor both and would gladly take input on that as well as any clippy idiomatic usage, since this is my first lint addition.

I've added the lint to the complexity section for now, I don't know if every new lint needs to go in nursery first.

The matching could be expanded to more than `Some(<value>)` to lint on arbitrary struct matching inside the `Some` but I've left it like it was for `manual_map` for now. `needless_match::pat_same_as_expr` provides a more generic match example.

close https://github.com/rust-lang/rust-clippy/issues/8822

changelog: Add lint [`manual_filter`] for `Option`

21 months agoDon't suggest moving tuple structs with a significant drop to late evaluation.
Jason Newcomb [Sat, 8 Oct 2022 15:23:05 +0000 (11:23 -0400)]
Don't suggest moving tuple structs with a significant drop to late evaluation.

21 months agoAuto merge of #9585 - rust-lang:extend-box-default, r=Alexendoo
bors [Fri, 7 Oct 2022 14:49:54 +0000 (14:49 +0000)]
Auto merge of #9585 - rust-lang:extend-box-default, r=Alexendoo

extend `box-default` lint, add suggestion

This extends the recently added `box-default` lint to also cover `Box::new(vec![])`, `Box::new(String::from(""))` and `Box::new(Vec::from([]))`. Also the lint now suggests a suitable replacement. I did not find a simple way to check whether the type is fully determined by the outside, so I at least checked for some variations to remove the turbofish in those cases.

---

changelog: none

21 months agoFix adjacent code
Samuel Moelius [Fri, 7 Oct 2022 09:07:09 +0000 (05:07 -0400)]
Fix adjacent code

21 months ago`needless_borrow` uses `used_exactly_once`
Samuel Moelius [Thu, 25 Aug 2022 00:14:21 +0000 (00:14 +0000)]
`needless_borrow` uses `used_exactly_once`

21 months agoAuto merge of #9595 - Alexendoo:author-let-chains, r=Jarcho
bors [Fri, 7 Oct 2022 02:52:47 +0000 (02:52 +0000)]
Auto merge of #9595 - Alexendoo:author-let-chains, r=Jarcho

Replace if_chain with let chains in `clippy::author` output

Should help nudge new contributors towards let chains

changelog: none

21 months agoAuto merge of #9601 - evantypanski:et/issue9575, r=Manishearth
bors [Thu, 6 Oct 2022 21:55:56 +0000 (21:55 +0000)]
Auto merge of #9601 - evantypanski:et/issue9575, r=Manishearth

[`match_single_binding`] Add curlies for more cases to fix suggestion causes error

Fixes #9575

changelog: [`match_single_binding`]: Add curlies for scrutinees with side effects for more cases

21 months agoFix flipped variable that made it through
Evan Typanski [Thu, 6 Oct 2022 19:36:28 +0000 (15:36 -0400)]
Fix flipped variable that made it through

21 months agoAdd curlies to scrutinees with side effects
Evan Typanski [Thu, 6 Oct 2022 19:14:55 +0000 (15:14 -0400)]
Add curlies to scrutinees with side effects

21 months agoAuto merge of #9593 - Andy-Python-Programmer:master, r=llogiq
bors [Thu, 6 Oct 2022 14:39:26 +0000 (14:39 +0000)]
Auto merge of #9593 - Andy-Python-Programmer:master, r=llogiq

lint::unsafe_removed_from_name: fix false positive result when allowed

changelog: [`unsafe_removed_from_name`] Fix allowing on imports produces a false positive on `useless_attribute`.

Fixes: #9197
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
21 months agoAuto merge of #9599 - nyurik:inline-crash, r=flip1995
bors [Thu, 6 Oct 2022 14:12:29 +0000 (14:12 +0000)]
Auto merge of #9599 - nyurik:inline-crash, r=flip1995

Add a temporary workaround for  multiline formart arg inlining

per suggestion in
https://github.com/rust-lang/rust/pull/102729#discussion_r988990080

workaround for an internal crash when handling multi-line format argument inlining.

changelog: none

(no point for changelog because it is still a new lint being introduced)

21 months agoextend `box-default` lint, add suggestion
Andre Bogus [Mon, 3 Oct 2022 15:29:38 +0000 (17:29 +0200)]
extend `box-default` lint, add suggestion

21 months agoAdd a temporary workaround for multiline formart arg inlining
Yuri Astrakhan [Thu, 6 Oct 2022 13:12:37 +0000 (09:12 -0400)]
Add a temporary workaround for  multiline formart arg inlining

per suggestion in
https://github.com/rust-lang/rust/pull/102729#discussion_r988990080

workaround for an internal crash when handling multi-line format
argument inlining.

21 months agoAuto merge of #9598 - nyurik:fix-comment, r=Alexendoo
bors [Thu, 6 Oct 2022 12:56:27 +0000 (12:56 +0000)]
Auto merge of #9598 - nyurik:fix-comment, r=Alexendoo

lint: fix a few comments

minor cleanup per `@Alexendoo` [comment](https://github.com/rust-lang/rust-clippy/pull/9586#discussion_r988991976)

changelog: none

21 months agolint: fix a few comments
Yuri Astrakhan [Thu, 6 Oct 2022 12:54:07 +0000 (08:54 -0400)]
lint: fix a few comments

21 months agoAuto merge of #9596 - flip1995:rustup, r=flip1995
bors [Thu, 6 Oct 2022 07:23:08 +0000 (07:23 +0000)]
Auto merge of #9596 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

21 months agoBump nightly version -> 2022-10-06
Philipp Krones [Thu, 6 Oct 2022 07:19:51 +0000 (09:19 +0200)]
Bump nightly version -> 2022-10-06

21 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 6 Oct 2022 07:19:29 +0000 (09:19 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

21 months agoReplace if_chain with let chains in `clippy::author` output
Alex Macleod [Wed, 5 Oct 2022 17:17:57 +0000 (17:17 +0000)]
Replace if_chain with let chains in `clippy::author` output

21 months agoAuto merge of #9586 - Alexendoo:format-args-commas, r=Manishearth
bors [Wed, 5 Oct 2022 16:27:03 +0000 (16:27 +0000)]
Auto merge of #9586 - Alexendoo:format-args-commas, r=Manishearth

FormatArgsExpn: Find comma spans and ignore weird proc macro spans

Fixes the following cases:

A missing `, 1` from the `expect_fun_call` suggestion:

```rust
Some(()).expect(&format!("{x} {}", 1));
```
```
warning: use of `expect` followed by a function call
 --> t.rs:7:14
  |
7 |     Some(()).expect(&format!("{x} {}", 1));
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{x} {}"))`
```

The suggestion removing from the comma in the comment rather than the one after the format string:

```rust
println!(
    "{}",
    // a comment, with a comma in it
    x
);
```
```
warning: variables can be used directly in the `format!` string
  --> t.rs:9:5
   |
9  | /     println!(
10 | |         "{}",
11 | |         // a comment, with a comma in it
12 | |         x
13 | |     );
   | |_____^
   |
help: change this to
   |
10 ~         "{x}",
11 ~         // a comment
   |
```

It also no longer accepts expansions where a format string or argument has a "weird" proc macro span, that is one where the literal/expression it outputs has the span of one of its inputs. Kind of like a `format_args` specific `clippy_utils::is_from_proc_macro`, e.g. `format!(indoc! {" ... "})`

changelog: [`expect_fun_call`]: Fix suggestion for `format!` using captured variables
changelog: [`print_literal`], [`write_literal`], [`uninlined_format_args`]: Fix suggestion when following a comment including a comma

21 months agoFormatArgsExpn: Find comma spans and ignore weird proc macro spans
Alex Macleod [Wed, 5 Oct 2022 16:10:52 +0000 (16:10 +0000)]
FormatArgsExpn: Find comma spans and ignore weird proc macro spans

21 months agoAuto merge of #9495 - Alexendoo:disallowed-macros, r=Jarcho
bors [Wed, 5 Oct 2022 14:49:31 +0000 (14:49 +0000)]
Auto merge of #9495 - Alexendoo:disallowed-macros, r=Jarcho

Add `disallowed_macros` lint

Closes #7790
Fixes #9558

`clippy_utils::def_path_res` already resolved macro definitions which is nice, it just needed a tweak to be able to disambiguate e.g. `std::vec` the module & `std::vec` the macro, and `serde::Serialize` the trait & `serde::Serialize` the derive macro

changelog: new lint: [`disallowed_macros`]
changelog: [`disallowed_methods`], [`disallowed_types`]: Fix false negative when a type/fn/macro share the same path

21 months agoAdd `disallowed_macros` lint
Alex Macleod [Wed, 5 Oct 2022 13:44:01 +0000 (13:44 +0000)]
Add `disallowed_macros` lint

21 months agolint::unsafe_removed_from_name: fix false positive result when allowed
Andy-Python-Programmer [Wed, 5 Oct 2022 07:59:01 +0000 (18:59 +1100)]
lint::unsafe_removed_from_name: fix false positive result when allowed

* Allowing `unsafe_removed_from_name` on imports produces a false
positive on `useless_attribute`.

Fixes: #9197
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
21 months agoIt's not about types or consts, but the lack of regions
Oli Scherer [Tue, 4 Oct 2022 09:43:34 +0000 (09:43 +0000)]
It's not about types or consts, but the lack of regions

21 months agoAuto merge of #9587 - c410-f3r:arith, r=Alexendoo
bors [Tue, 4 Oct 2022 11:05:24 +0000 (11:05 +0000)]
Auto merge of #9587 - c410-f3r:arith, r=Alexendoo

[arithmetic-side-effects] Do not ignore literal references

To my utter surprise, `rustc` does does not warn stuff like `let n: u8 = &255 + &1` or `let n: u8 = 255 + &1`.

changelog: [arithmetic-side-effects] Do not ignore literal references

21 months agoAuto merge of #9547 - nyurik:capt, r=flip1995
bors [Tue, 4 Oct 2022 07:20:24 +0000 (07:20 +0000)]
Auto merge of #9547 - nyurik:capt, r=flip1995

fallout: fix tests to allow uninlined_format_args

In order to switch `clippy::uninlined_format_args` from pedantic to style, all existing tests must not raise a warning. I did not want to change the actual tests, so this is a relatively minor change that:

* add `#![allow(clippy::uninlined_format_args)]` where needed
* normalizes all allow/deny/warn attributes
   * all allow attributes are grouped together
   * sorted alphabetically
   * the `clippy::*` attributes are listed separate from the other ones.
   * deny and warn attributes are listed before the allowed ones

See also https://github.com/rust-lang/rust-clippy/pull/9233, https://github.com/rust-lang/rust-clippy/pull/9525, https://github.com/rust-lang/rust-clippy/pull/9527

cc: `@llogiq` `@Alexendoo`

changelog: none

21 months agoDogfood
Caio [Mon, 3 Oct 2022 23:10:00 +0000 (20:10 -0300)]
Dogfood

21 months ago[arithmetic-side-effects] Do not ignore literal references
Caio [Mon, 3 Oct 2022 22:49:03 +0000 (19:49 -0300)]
[arithmetic-side-effects] Do not ignore literal references

21 months agoAuto merge of #9559 - c410-f3r:arith, r=Alexendoo
bors [Mon, 3 Oct 2022 21:54:08 +0000 (21:54 +0000)]
Auto merge of #9559 - c410-f3r:arith, r=Alexendoo

Fix #9544

Fix #9544

r? `@Alexendoo`

changelog: [`arithmetic_side_effects`]: Fix false negative for `CustomType / usize`, `CustomType * float` and similar

21 months agoAddress comments
Caio [Mon, 3 Oct 2022 21:36:12 +0000 (18:36 -0300)]
Address comments

21 months agoAuto merge of #9581 - ebobrow:mul-add-negative, r=Manishearth
bors [Mon, 3 Oct 2022 17:12:10 +0000 (17:12 +0000)]
Auto merge of #9581 - ebobrow:mul-add-negative, r=Manishearth

`suboptimal_flops` lint for multiply and subtract

fixes #9526

changelog: [`suboptimal_flops`] lint for multiply and subtract

21 months agoAuto merge of #9549 - royrustdev:manual_saturating_add, r=llogiq
bors [Mon, 3 Oct 2022 11:32:06 +0000 (11:32 +0000)]
Auto merge of #9549 - royrustdev:manual_saturating_add, r=llogiq

new `implicit_saturating_add` lint

This fixes #9393

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- \[x] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

---

changelog: add [`manual_saturating_add`] lint

21 months agoadd `implicit_saturating_add` lint
royrustdev [Wed, 28 Sep 2022 14:17:13 +0000 (19:47 +0530)]
add `implicit_saturating_add` lint

21 months agoAuto merge of #9580 - TennyZhuang:upper_case_acronyms-enum, r=llogiq
bors [Mon, 3 Oct 2022 09:01:05 +0000 (09:01 +0000)]
Auto merge of #9580 - TennyZhuang:upper_case_acronyms-enum, r=llogiq

let `upper_case_acronyms` check the enum name

Signed-off-by: TennyZhuang <zty0826@gmail.com>
Fix #9579

changelog: [`upper_case_acronyms`]: check the enum name

21 months agoMerge branch 'master' into mul-add-negative
Elliot Bobrow [Mon, 3 Oct 2022 04:27:57 +0000 (21:27 -0700)]
Merge branch 'master' into mul-add-negative

21 months ago`suboptimal_flops` lint for multiply and subtract
Elliot Bobrow [Mon, 3 Oct 2022 04:00:51 +0000 (21:00 -0700)]
`suboptimal_flops` lint for multiply and subtract

21 months agolet upper_case_acronyms check the enum name
TennyZhuang [Mon, 3 Oct 2022 02:11:57 +0000 (10:11 +0800)]
let upper_case_acronyms check the enum name

Signed-off-by: TennyZhuang <zty0826@gmail.com>
21 months agoAuto merge of #8762 - Jarcho:visitor, r=Jarcho
bors [Mon, 3 Oct 2022 00:05:05 +0000 (00:05 +0000)]
Auto merge of #8762 - Jarcho:visitor, r=Jarcho

Replace `expr_visitor` with  `for_each_expr`

This is a minor change which uses `ControlFlow` rather than a boolean. This also runs the visitor rather than returning the visitor, which results in a small readability win as well.

changelog: None

21 months agoWorkaround rustc bug
Jason Newcomb [Sun, 2 Oct 2022 21:11:10 +0000 (17:11 -0400)]
Workaround rustc bug

21 months agoUse `for_each_expr` in place of some visitors
Jason Newcomb [Fri, 29 Apr 2022 04:09:55 +0000 (00:09 -0400)]
Use `for_each_expr` in place of some visitors

21 months agoReplace `expr_visitor` with `for_each_expr`
Jason Newcomb [Thu, 28 Apr 2022 17:29:44 +0000 (13:29 -0400)]
Replace `expr_visitor` with `for_each_expr`

21 months agoAuto merge of #7962 - Jarcho:fix_match_type_on_diagnostic_items, r=llogiq
bors [Sun, 2 Oct 2022 19:46:46 +0000 (19:46 +0000)]
Auto merge of #7962 - Jarcho:fix_match_type_on_diagnostic_items, r=llogiq

Fix and improve `match_type_on_diagnostic_item`

This extracts the fix for the lint out of #7647. There's still a couple of other functions to check, but at least this will get lint working again.

The two added util functions (`is_diagnostic_item` and `is_lang_item`) are needed to handle `DefId` for unit and tuple struct/variant constructors. The `rustc_diagnostic_item` and `lang` attributes are attached to the struct/variant `DefId`, but most of the time they are used through their constructors which have a different `DefId`. The two utility functions will check if the `DefId` is for a constructor and switch to the associated struct/variant `DefId`.

There does seem to be a bug on rustc's side where constructor `DefId`s from external crates seem to be returning `DefKind::Variant` instead of `DefKind::Ctor()`. There's a workaround put in right.

changelog: None

21 months agofallout: fix tests to allow uninlined_format_args
Yuri Astrakhan [Sun, 2 Oct 2022 19:13:22 +0000 (15:13 -0400)]
fallout: fix tests to allow uninlined_format_args

In order to switch `clippy::uninlined_format_args` from pedantic to
style, all existing tests must not raise a warning. I did not want to
change the actual tests, so this is a relatively minor change that:

* add `#![allow(clippy::uninlined_format_args)]` where needed
* normalizes all allow/deny/warn attributes
   * all allow attributes are grouped together
   * sorted alphabetically
   * the `clippy::*` attributes are listed separate from the other ones.
   * deny and warn attributes are listed before the allowed ones

changelog: none

21 months agoAuto merge of #9574 - Alexendoo:unused-fixed, r=Jarcho
bors [Sun, 2 Oct 2022 19:06:58 +0000 (19:06 +0000)]
Auto merge of #9574 - Alexendoo:unused-fixed, r=Jarcho

Remove unused `.fixed` files, only run asm_syntax doctests on x86

Two small changes, removes some unused `.fixed` and makes `clippy_lints` doctests pass on non x86 arches

changelog: none

21 months agoFix and improve internal lint checking for `match_type` usages
Jason Newcomb [Thu, 11 Nov 2021 19:15:01 +0000 (14:15 -0500)]
Fix and improve internal lint checking for `match_type` usages

* Check for `const`s and `static`s from external crates
* Check for `LangItem`s
* Handle inherent functions which have the same name as a field
* Also check the following functions:
    * `match_trait_method`
    * `match_def_path`
    * `is_expr_path_def_path`
    * `is_qpath_def_path`
* Handle checking for a constructor to a diagnostic item or `LangItem`

21 months agoReplace `is_lang_ctor` with `is_res_lang_ctor`
Jason Newcomb [Wed, 29 Jun 2022 02:34:02 +0000 (22:34 -0400)]
Replace `is_lang_ctor` with `is_res_lang_ctor`

21 months agoupdate rust version introduction
kraktus [Sun, 2 Oct 2022 15:45:44 +0000 (17:45 +0200)]
update rust version introduction

21 months agorefactor `manual_filter`
kraktus [Mon, 3 Oct 2022 12:11:54 +0000 (14:11 +0200)]
refactor `manual_filter`

Move common functions to `manual_utils.rs`, better arm matching, use clippy utils `contains_unsafe_block`

21 months agoAuto merge of #9576 - TennyZhuang:unnecessary_cast_for_non_literal_expr, r=llogiq
bors [Sun, 2 Oct 2022 15:26:45 +0000 (15:26 +0000)]
Auto merge of #9576 - TennyZhuang:unnecessary_cast_for_non_literal_expr, r=llogiq

let unnecessary_cast work for trivial non_literal expressions

Signed-off-by: TennyZhuang <zty0826@gmail.com>
---

changelog: [`unnecessary_cast`]: fix for trivial non_literal expressions

Fixes #9562

21 months agoAuto merge of #9479 - kraktus:manual_assert2, r=llogiq
bors [Sun, 2 Oct 2022 15:13:32 +0000 (15:13 +0000)]
Auto merge of #9479 - kraktus:manual_assert2, r=llogiq

[`manual_assert`]: Preserve comments in the suggestion

close https://github.com/rust-lang/rust-clippy/issues/7730

changelog: [`manual_assert`]: Preserve comments in the suggestion

21 months agofix some logics
TennyZhuang [Sun, 2 Oct 2022 11:04:33 +0000 (19:04 +0800)]
fix some logics

Signed-off-by: TennyZhuang <zty0826@gmail.com>
21 months agoextract common codes
TennyZhuang [Sun, 2 Oct 2022 10:41:13 +0000 (18:41 +0800)]
extract common codes

Signed-off-by: TennyZhuang <zty0826@gmail.com>
21 months agoignore the lint on some test files
TennyZhuang [Sun, 2 Oct 2022 09:53:58 +0000 (17:53 +0800)]
ignore the lint on some test files

Signed-off-by: TennyZhuang <zty0826@gmail.com>
21 months agolet unnecessary_cast work for trivial non_literal expressions
TennyZhuang [Sun, 2 Oct 2022 09:12:08 +0000 (17:12 +0800)]
let unnecessary_cast work for trivial non_literal expressions

Signed-off-by: TennyZhuang <zty0826@gmail.com>
21 months agoAuto merge of #9577 - kraktus:unnecessary_cast, r=llogiq
bors [Sun, 2 Oct 2022 14:18:41 +0000 (14:18 +0000)]
Auto merge of #9577 - kraktus:unnecessary_cast, r=llogiq

[`unnecessary_cast`] add parenthesis when negative number uses a method

fix #9563

The issue was probably introduced by 90fe3bea52dd6ebd0cb02785ba523f182ff761e6

changelog: [`unnecessary_cast`] add parenthesis when negative number uses a method

r? llogiq

21 months agofix tests
kraktus [Sun, 2 Oct 2022 13:25:50 +0000 (15:25 +0200)]
fix tests

21 months agoAuto merge of #9571 - rust-lang:refactor-lit-ints, r=Jarcho
bors [Sun, 2 Oct 2022 13:11:21 +0000 (13:11 +0000)]
Auto merge of #9571 - rust-lang:refactor-lit-ints, r=Jarcho

use `is_integer_literal` more

I noticed that we have the `is_integer_literal` function in our `clippy_utils`, yet almost everywhere people still match int literal expressions manually. So I searched for instances to replace and shorten the code a bit.

---

changelog: none

21 months agofix indentation
kraktus [Sun, 2 Oct 2022 10:35:02 +0000 (12:35 +0200)]
fix indentation

21 months agorevert `manual_assert` suggestion refactor
kraktus [Fri, 16 Sep 2022 19:38:56 +0000 (21:38 +0200)]
revert `manual_assert` suggestion refactor

Because `Sugg` helper does not simplify multiple negations

21 months ago[`manual_assert`]: Preserve comments in the suggestion
kraktus [Wed, 14 Sep 2022 09:58:41 +0000 (11:58 +0200)]
[`manual_assert`]: Preserve comments in the suggestion

21 months ago[`unnecessary_cast`] add parenthesis when negative number uses a method
kraktus [Sun, 2 Oct 2022 12:30:26 +0000 (14:30 +0200)]
[`unnecessary_cast`] add parenthesis when negative number uses a method

21 months agoAuto merge of #9573 - Alexendoo:needless-borrowed-ref-slice, r=dswij
bors [Sun, 2 Oct 2022 10:39:04 +0000 (10:39 +0000)]
Auto merge of #9573 - Alexendoo:needless-borrowed-ref-slice, r=dswij

lint nested patterns and slice patterns in `needless_borrowed_reference`

Now lints in positions other than top level, e.g. `Some(&ref a)`. Or patterns are excluded as that can cause issues

Slice patterns of `ref`s are now linted, e.g. `&[ref a, ref b]`. An easy one to walk into as you might expect that to match against a slice you should use `&[]`,  then to get around a `cannot move out of type [T]` error you apply a `ref`

changelog: [`needless_borrowed_reference`]: lint nested patterns and slice patterns

21 months agoAuto merge of #9509 - schubart:fix_sorting, r=llogiq
bors [Sun, 2 Oct 2022 07:51:45 +0000 (07:51 +0000)]
Auto merge of #9509 - schubart:fix_sorting, r=llogiq

Fix sorting in ` cargo dev update_lints` script

changelog: none

The old code cloned and sorted `usable_lints` into `sorted_usable_lints`, but then failed to do anything with `sorted_usable_lints`.

This was discovered by my new `collection_is_never_read` lint (#9267) that I'm working on!

Fix: I renamed the sorted vector to `usable_lints`.  Therefore it now gets used where the unsorted one was used previously.

21 months agolint nested patterns and slice patterns in `needless_borrowed_reference`
Alex Macleod [Sat, 1 Oct 2022 21:54:22 +0000 (21:54 +0000)]
lint nested patterns and slice patterns in `needless_borrowed_reference`

21 months agoOnly run x86 asm doctests on x86
Alex Macleod [Sat, 1 Oct 2022 22:25:01 +0000 (22:25 +0000)]
Only run x86 asm doctests on x86

21 months agoRemove unused .fixed files
Alex Macleod [Sat, 1 Oct 2022 22:24:48 +0000 (22:24 +0000)]
Remove unused .fixed files

21 months agoAuto merge of #9484 - Xaeroxe:clamping-without-clamp, r=Alexendoo
bors [Sat, 1 Oct 2022 20:55:20 +0000 (20:55 +0000)]
Auto merge of #9484 - Xaeroxe:clamping-without-clamp, r=Alexendoo

Implement `manual_clamp` lint

Fixes #9477
Fixes #6751

Identifies common patterns where usage of the `clamp` function would be more succinct and clear, and suggests using the `clamp` function instead.

changelog: [`manual_clamp`]: Implement manual_clamp lint

21 months agoImplement manual_clamp lint
Jacob Kiesel [Fri, 16 Sep 2022 02:50:28 +0000 (20:50 -0600)]
Implement manual_clamp lint

21 months agoFix example
Nilstrieb [Sat, 1 Oct 2022 18:31:54 +0000 (20:31 +0200)]
Fix example

21 months agoImprove wording
Nilstrieb [Sat, 1 Oct 2022 18:10:43 +0000 (20:10 +0200)]
Improve wording

21 months agoAdd `as_ptr_cast_mut` lint
Nilstrieb [Sat, 1 Oct 2022 16:59:17 +0000 (18:59 +0200)]
Add `as_ptr_cast_mut` lint

This lint detects calls to a `&self`-taking `as_ptr` method, where
the result is then immediately cast to a `*mut T`. Code like this
is probably invalid, as that pointer will not have write permissions,
and `*mut T` is usually used to write through.

21 months agoAuto merge of #9569 - matthiaskrgr:rtu_from_cratesio, r=xFrednet
bors [Sat, 1 Oct 2022 16:22:58 +0000 (16:22 +0000)]
Auto merge of #9569 - matthiaskrgr:rtu_from_cratesio, r=xFrednet

use rustc_tools_util dependency from crates.io instead of this repo.

Fixes #9553

changelog: none

21 months agouse `is_integer_literal` more
Andre Bogus [Sat, 1 Oct 2022 15:55:22 +0000 (17:55 +0200)]
use `is_integer_literal` more

21 months agouse rustc_tools_util dependency from crates.io instead of this repo.
Matthias Krüger [Sat, 1 Oct 2022 14:40:10 +0000 (16:40 +0200)]
use rustc_tools_util dependency from crates.io instead of this repo.

Fixes #9553

21 months agoAuto merge of #9567 - rust-lang:doc-link-with-code, r=Alexendoo
bors [Sat, 1 Oct 2022 14:33:13 +0000 (14:33 +0000)]
Auto merge of #9567 - rust-lang:doc-link-with-code, r=Alexendoo

avoid doc-link-with-quotes in code blocks

This fixes #8961 by moving the lint into the docs code, thus being able to re-use the pulldown-cmark parser and simplifying the code.

---

changelog: none

21 months agoAuto merge of #9568 - matthiaskrgr:tools_util_bump, r=flip1995
bors [Sat, 1 Oct 2022 14:20:32 +0000 (14:20 +0000)]
Auto merge of #9568 - matthiaskrgr:tools_util_bump, r=flip1995

rustc_tool_utils: bump version in anticipation of a new release

cc https://github.com/rust-lang/rust-clippy/issues/9553

After this is merged, I will publish the 0.2.1 version to crates.io, and make another PR that switches clippy to use the dependency from crates.io.
The source can still be kept in the clippy repo though imo.

This will allow miri and clippy to "share" the crate in the rustc repo once they both depend on it.

reopen of #9561

changelog: release `rustc_tools_util` on `Crates.io`.

21 months agorustc_tool_utils bump version in anticipation of a new release
Matthias Krüger [Fri, 30 Sep 2022 22:52:25 +0000 (00:52 +0200)]
rustc_tool_utils bump version in anticipation of a new release

cc https://github.com/rust-lang/rust-clippy/issues/9553

21 months agoavoid doc-link-with-quotes in code blocks
Andre Bogus [Sat, 1 Oct 2022 09:57:34 +0000 (11:57 +0200)]
avoid doc-link-with-quotes in code blocks

21 months agoAuto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank
bors [Sat, 1 Oct 2022 10:44:25 +0000 (10:44 +0000)]
Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank

Move lint level source explanation to the bottom

So, uhhhhh

r? `@estebank`

## User-facing change

"note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic:
```diff
-   = note: `#[warn(unsupported_calling_conventions)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
+   = note: `#[warn(unsupported_calling_conventions)]` on by default
```

Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO.

## Developer-facing change

`struct_span_lint` and similar methods have a different signature.

Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)`
After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>`

The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion.

Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere.

## Subtle problem

By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings...

I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate.

## P.S.

I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢

21 months agobless clippy
Maybe Waffle [Thu, 22 Sep 2022 16:04:22 +0000 (20:04 +0400)]
bless clippy

21 months agoclippy: adopt to the new lint API
Maybe Waffle [Fri, 16 Sep 2022 15:07:01 +0000 (19:07 +0400)]
clippy: adopt to the new lint API

21 months agoAuto merge of #9510 - Alexendoo:lintcheck-server2, r=matthiaskrgr
bors [Fri, 30 Sep 2022 22:29:40 +0000 (22:29 +0000)]
Auto merge of #9510 - Alexendoo:lintcheck-server2, r=matthiaskrgr

Add `cargo lintcheck --recursive` to check dependencies of crates

r? `@matthiaskrgr`

This just adds the mode without changing how a regular run works

Takes a fair bit longer to run than a `-j4` or regular run

```
cargo lintcheck -j4  468.33s user 43.78s system 290% cpu 2:56.42 total
cargo lintcheck  428.81s user 41.85s system 199% cpu 3:55.37 total
cargo lintcheck --recursive  679.83s user 45.01s system 210% cpu 5:43.72 total
```

But finds more results:

<details>
<summary>Stats</summary>
<pre><code>clippy::explicit_counter_loop 0 =&gt; 1
clippy::needless_question_mark 0 =&gt; 3
clippy::unnecessary_cast 0 =&gt; 2
clippy::to_string_in_format_args 0 =&gt; 4
clippy::deprecated_cfg_attr 0 =&gt; 23
clippy::redundant_closure 0 =&gt; 9
clippy::drop_copy 0 =&gt; 4
clippy::double_must_use 0 =&gt; 1
clippy::transmute_num_to_bytes 0 =&gt; 9
clippy::bind_instead_of_map 0 =&gt; 14
clippy::float_cmp 0 =&gt; 16
clippy::is_digit_ascii_radix 0 =&gt; 16
clippy::manual_swap 0 =&gt; 1
clippy::needless_match 0 =&gt; 2
clippy::vec_init_then_push 0 =&gt; 1
clippy::never_loop 0 =&gt; 1
clippy::option_map_or_none 0 =&gt; 4
clippy::tabs_in_doc_comments 0 =&gt; 1
clippy::naive_bytecount 0 =&gt; 1
clippy::collapsible_if 0 =&gt; 24
clippy::copy_iterator 0 =&gt; 5
clippy::unused_io_amount 0 =&gt; 2
clippy::result_large_err 0 =&gt; 141
clippy::useless_conversion 0 =&gt; 24
clippy::flat_map_option 0 =&gt; 8
clippy::useless_format 0 =&gt; 2
clippy::module_inception 0 =&gt; 1
clippy::drop_ref 0 =&gt; 2
clippy::unnecessary_fold 0 =&gt; 2
clippy::neg_multiply 0 =&gt; 1
clippy::while_let_loop 0 =&gt; 6
clippy::missing_inline_in_public_items 0 =&gt; 37
clippy::unnecessary_mut_passed 0 =&gt; 1
unknown_lints 0 =&gt; 15
clippy::wildcard_dependencies 0 =&gt; 3
clippy::same_item_push 0 =&gt; 2
clippy::useless_asref 0 =&gt; 1
clippy::unnecessary_unwrap 0 =&gt; 4
clippy::iter_not_returning_iterator 0 =&gt; 5
clippy::comparison_to_empty 0 =&gt; 10
clippy::ref_option_ref 0 =&gt; 4
clippy::unused_peekable 0 =&gt; 1
clippy::needless_range_loop 0 =&gt; 8
clippy::absurd_extreme_comparisons 0 =&gt; 2
clippy::unnecessary_operation 0 =&gt; 2
clippy::for_kv_map 0 =&gt; 5
clippy::unnecessary_owned_empty_strings 0 =&gt; 3
clippy::transmutes_expressible_as_ptr_casts 0 =&gt; 1
clippy::toplevel_ref_arg 0 =&gt; 2
clippy::uninit_vec 0 =&gt; 3
clippy::filter_next 0 =&gt; 1
clippy::wildcard_in_or_patterns 0 =&gt; 6
clippy::cast_ptr_alignment 0 =&gt; 48
clippy::manual_memcpy 0 =&gt; 1
clippy::assign_op_pattern 0 =&gt; 313
clippy::unnecessary_lazy_evaluations 0 =&gt; 14
clippy::println_empty_string 0 =&gt; 2
clippy::redundant_pattern 0 =&gt; 2
clippy::declare_interior_mutable_const 0 =&gt; 8
clippy::large_stack_arrays 0 =&gt; 4
clippy::match_bool 0 =&gt; 4
clippy::unicode_not_nfc 0 =&gt; 2075
clippy::inconsistent_digit_grouping 0 =&gt; 4
clippy::no_effect_underscore_binding 0 =&gt; 2
clippy::let_and_return 0 =&gt; 5
clippy::transmute_ptr_to_ref 0 =&gt; 12
clippy::op_ref 0 =&gt; 13
clippy::unnecessary_join 0 =&gt; 4
clippy::into_iter_on_ref 0 =&gt; 13
clippy::from_str_radix_10 0 =&gt; 7
clippy::ptr_offset_with_cast 0 =&gt; 48
clippy::erasing_op 0 =&gt; 1
clippy::swap_ptr_to_ref 0 =&gt; 3
clippy::needless_bitwise_bool 0 =&gt; 2
clippy::extend_with_drain 0 =&gt; 19
clippy::only_used_in_recursion 0 =&gt; 4
clippy::needless_late_init 0 =&gt; 8
clippy::excessive_precision 0 =&gt; 1959
clippy::match_ref_pats 0 =&gt; 10
clippy::unit_arg 0 =&gt; 20
clippy::bool_comparison 0 =&gt; 4
clippy::bool_assert_comparison 0 =&gt; 1
clippy::eq_op 0 =&gt; 6
clippy::cast_abs_to_unsigned 0 =&gt; 6
clippy::format_in_format_args 0 =&gt; 1
clippy::iter_cloned_collect 0 =&gt; 4
clippy::ptr_eq 0 =&gt; 3
clippy::needless_bool 0 =&gt; 5
clippy::transmute_ptr_to_ptr 0 =&gt; 16
clippy::needless_option_take 0 =&gt; 2
clippy::flat_map_identity 0 =&gt; 1
clippy::needless_splitn 0 =&gt; 2
clippy::blocks_in_if_conditions 0 =&gt; 1
clippy::write_literal 0 =&gt; 1
clippy::manual_split_once 0 =&gt; 1
clippy::result_unit_err 0 =&gt; 36
clippy::unused_unit 0 =&gt; 11
clippy::single_match 0 =&gt; 22
clippy::manual_find 0 =&gt; 3
clippy::derive_ord_xor_partial_ord 0 =&gt; 6
clippy::char_lit_as_u8 0 =&gt; 2
clippy::let_unit_value 0 =&gt; 2
clippy::needless_continue 0 =&gt; 19
clippy::zero_sized_map_values 0 =&gt; 4
clippy::needless_arbitrary_self_type 0 =&gt; 6
clippy::partialeq_to_none 0 =&gt; 11
clippy::partialeq_ne_impl 0 =&gt; 1
clippy::invalid_upcast_comparisons 0 =&gt; 1
clippy::mut_range_bound 0 =&gt; 4
clippy::match_result_ok 0 =&gt; 2
clippy::ptr_arg 0 =&gt; 8
clippy::iter_nth_zero 0 =&gt; 18
clippy::needless_for_each 0 =&gt; 1
clippy::manual_unwrap_or 0 =&gt; 1
clippy::transmute_int_to_float 0 =&gt; 6
clippy::cast_slice_from_raw_parts 0 =&gt; 1
clippy::match_wild_err_arm 0 =&gt; 2
clippy::match_like_matches_macro 4 =&gt; 116
clippy::enum_glob_use 50 =&gt; 380
clippy::get_first 3 =&gt; 33
clippy::needless_doctest_main 10 =&gt; 26
clippy::struct_excessive_bools 19 =&gt; 51
clippy::cast_possible_wrap 46 =&gt; 538
clippy::manual_string_new 10 =&gt; 27
clippy::match_same_arms 53 =&gt; 1039
clippy::manual_non_exhaustive 1 =&gt; 33
clippy::redundant_pattern_matching 2 =&gt; 13
clippy::new_without_default 5 =&gt; 73
clippy::option_as_ref_deref 2 =&gt; 9
clippy::unwrap_or_else_default 2 =&gt; 4
clippy::case_sensitive_file_extension_comparisons 6 =&gt; 9
clippy::cast_precision_loss 45 =&gt; 110
clippy::needless_pass_by_value 26 =&gt; 187
clippy::redundant_closure_for_method_calls 170 =&gt; 539
clippy::let_underscore_drop 33 =&gt; 133
clippy::single_match_else 51 =&gt; 138
clippy::needless_borrow 24 =&gt; 382
clippy::redundant_else 37 =&gt; 151
clippy::type_complexity 2 =&gt; 22
clippy::ptr_as_ptr 93 =&gt; 1135
clippy::needless_lifetimes 7 =&gt; 100
clippy::single_char_add_str 2 =&gt; 22
clippy::similar_names 99 =&gt; 352
clippy::cargo_common_metadata 25 =&gt; 276
clippy::int_plus_one 1 =&gt; 2
clippy::missing_safety_doc 9 =&gt; 152
clippy::redundant_slicing 2 =&gt; 13
clippy::mut_mut 2 =&gt; 17
clippy::derive_partial_eq_without_eq 8 =&gt; 141
clippy::derive_hash_xor_eq 2 =&gt; 20
clippy::from_iter_instead_of_collect 2 =&gt; 17
clippy::verbose_bit_mask 1 =&gt; 8
clippy::too_many_lines 58 =&gt; 162
clippy::module_name_repetitions 178 =&gt; 1104
clippy::explicit_into_iter_loop 12 =&gt; 32
clippy::cast_lossless 45 =&gt; 478
clippy::many_single_char_names 9 =&gt; 23
clippy::unnested_or_patterns 27 =&gt; 127
clippy::upper_case_acronyms 5 =&gt; 29
clippy::needless_return 5 =&gt; 97
clippy::precedence 1 =&gt; 11
clippy::len_zero 2 =&gt; 70
clippy::manual_strip 2 =&gt; 30
clippy::derivable_impls 2 =&gt; 12
clippy::unused_self 20 =&gt; 187
clippy::enum_variant_names 1 =&gt; 6
clippy::self_named_constructors 1 =&gt; 3
clippy::explicit_auto_deref 19 =&gt; 314
clippy::semicolon_if_nothing_returned 137 =&gt; 1861
clippy::should_implement_trait 1 =&gt; 7
clippy::expl_impl_clone_on_copy 159 =&gt; 1318
clippy::stable_sort_primitive 4 =&gt; 12
clippy::mem_replace_with_default 7 =&gt; 46
clippy::borrow_deref_ref 5 =&gt; 140
clippy::large_enum_variant 1 =&gt; 4
clippy::map_unwrap_or 30 =&gt; 203
clippy::zero_ptr 3 =&gt; 25
clippy::filter_map_next 2 =&gt; 6
clippy::identity_op 5 =&gt; 76
clippy::checked_conversions 1 =&gt; 8
clippy::len_without_is_empty 9 =&gt; 47
clippy::missing_errors_doc 372 =&gt; 2333
clippy::fn_params_excessive_bools 3 =&gt; 7
clippy::single_component_path_imports 6 =&gt; 28
clippy::unreadable_literal 366 =&gt; 9814
clippy::field_reassign_with_default 1 =&gt; 5
clippy::redundant_clone 1 =&gt; 8
clippy::cloned_instead_of_copied 36 =&gt; 78
clippy::too_many_arguments 4 =&gt; 22
clippy::option_map_unit_fn 7 =&gt; 9
clippy::extra_unused_lifetimes 1 =&gt; 24
clippy::unnecessary_wraps 26 =&gt; 128
clippy::used_underscore_binding 1 =&gt; 50
clippy::inconsistent_struct_constructor 2 =&gt; 7
clippy::manual_range_contains 9 =&gt; 120
clippy::map_clone 7 =&gt; 46
clippy::cast_slice_different_sizes 1 =&gt; 4
clippy::missing_panics_doc 114 =&gt; 603
renamed_and_removed_lints 3 =&gt; 9
clippy::items_after_statements 155 =&gt; 309
clippy::inefficient_to_string 5 =&gt; 6
clippy::comparison_chain 1 =&gt; 19
clippy::crate_in_macro_def 3 =&gt; 6
clippy::write_with_newline 2 =&gt; 36
clippy::manual_saturating_arithmetic 1 =&gt; 2
clippy::clone_on_copy 1 =&gt; 86
clippy::negative_feature_names 3 =&gt; 16
clippy::redundant_field_names 112 =&gt; 1013
clippy::from_over_into 2 =&gt; 28
clippy::wildcard_imports 178 =&gt; 376
clippy::unusual_byte_groupings 19 =&gt; 65
clippy::option_option 2 =&gt; 10
clippy::nonminimal_bool 1 =&gt; 17
clippy::borrow_as_ptr 2 =&gt; 172
clippy::redundant_static_lifetimes 24 =&gt; 1701
clippy::or_fun_call 1 =&gt; 63
clippy::single_char_pattern 3 =&gt; 79
clippy::explicit_iter_loop 72 =&gt; 148
clippy::collapsible_else_if 2 =&gt; 27
clippy::manual_str_repeat 1 =&gt; 6
clippy::if_same_then_else 3 =&gt; 31
clippy::while_let_on_iterator 4 =&gt; 28
clippy::multiple_crate_versions 5 =&gt; 19
clippy::cast_possible_truncation 115 =&gt; 1172
clippy::explicit_deref_methods 1 =&gt; 38
clippy::default_trait_access 48 =&gt; 130
clippy::question_mark 2 =&gt; 28
clippy::must_use_candidate 612 =&gt; 5369
clippy::manual_map 1 =&gt; 12
clippy::bool_to_int_with_if 2 =&gt; 15
clippy::doc_markdown 202 =&gt; 1709
clippy::cast_sign_loss 60 =&gt; 477
clippy::wrong_self_convention 11 =&gt; 45
clippy::transmute_float_to_int 6 =&gt; 18
clippy::return_self_not_must_use 66 =&gt; 736
clippy::range_plus_one 1 =&gt; 36
clippy::manual_assert 11 =&gt; 62
clippy::trivially_copy_pass_by_ref 40 =&gt; 189
clippy::match_on_vec_items 2 =&gt; 7
clippy::inline_always 59 =&gt; 1079
clippy::if_not_else 31 =&gt; 205
clippy::implicit_clone 10 =&gt; 32
clippy::match_wildcard_for_single_variants 16 =&gt; 101
clippy::doc_link_with_quotes 7 =&gt; 35
clippy::redundant_feature_names 4 =&gt; 41
</code></pre></details>

changelog: none

21 months agoFix #9544
Caio [Fri, 30 Sep 2022 18:30:40 +0000 (15:30 -0300)]
Fix #9544

21 months agoAuto merge of #9556 - evantypanski:et/issue-9369, r=Alexendoo
bors [Fri, 30 Sep 2022 16:42:55 +0000 (16:42 +0000)]
Auto merge of #9556 - evantypanski:et/issue-9369, r=Alexendoo

[`redundant_closure`] Fix suggestion causes error for `impl FnMut`

Fixes #9369

changelog: [`redundant_closure`] Fix suggestion causes error with `impl FnMut` types