]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #8906 - rust-lang:copy-large-enum-variants, r=Jarcho
bors [Thu, 2 Jun 2022 16:37:09 +0000 (16:37 +0000)]
Auto merge of #8906 - rust-lang:copy-large-enum-variants, r=Jarcho

remove `large_enum_variant` suggestion for `Copy` types

Replaces the (erroneous) suggestion on `large_enum_variant` for `Copy` types by a note. This fixes #8894.

---

changelog: none

2 years agoAuto merge of #8905 - c410-f3r:arith, r=llogiq
bors [Thu, 2 Jun 2022 12:05:27 +0000 (12:05 +0000)]
Auto merge of #8905 - c410-f3r:arith, r=llogiq

[1/N] Implement Arithmetic lint

Assuming that https://github.com/rust-lang/rust-clippy/issues/8903 is OK, this PR starts the creation of the `Arithmetic` lint with configurable types.

My current struggle to get a rustc review inspired me to create smaller PRs in order to easy review and make merges as fast as possible. So the first step here only moves the `arithmetic.rs` file to `numeric_arithmetic.rs` to make room for the new lint.

--
changelog: none

2 years agoaccount for generics
Andre Bogus [Tue, 31 May 2022 07:23:17 +0000 (09:23 +0200)]
account for generics

2 years agoAuto merge of #8908 - Serial-ATA:doc-comment-issues, r=xFrednet
bors [Thu, 2 Jun 2022 07:38:01 +0000 (07:38 +0000)]
Auto merge of #8908 - Serial-ATA:doc-comment-issues, r=xFrednet

Make docs more consistent

changelog: none

This just fixes some docs to make them more consistent. I mostly just changed `// Good`, `// Bad`, etc to `Use instead:`.

2 years agoCombine doc examples
Serial [Wed, 1 Jun 2022 22:36:02 +0000 (18:36 -0400)]
Combine doc examples

2 years agoAuto merge of #8869 - Jarcho:derive_partial_eq_without_eq, r=flip1995
bors [Wed, 1 Jun 2022 19:27:54 +0000 (19:27 +0000)]
Auto merge of #8869 - Jarcho:derive_partial_eq_without_eq, r=flip1995

Set correct `ParamEnv` for `derive_partial_eq_without_eq`

fixes #8867

changelog: Handle differing predicates applied by `#[derive(PartialEq)]` and `#[derive(Eq)]` in `derive_partial_eq_without_eq`

2 years agoAuto merge of #7930 - lengyijun:needless_deref_new, r=Jarcho
bors [Wed, 1 Jun 2022 16:43:14 +0000 (16:43 +0000)]
Auto merge of #7930 - lengyijun:needless_deref_new, r=Jarcho

new lint: `borrow_deref_ref`

changelog: ``[`borrow_deref_ref`]``

Related pr: #6837 #7577
`@Jarcho` Could you please give a review?

`cargo lintcheck` gives no false negative (but tested crates are out-of-date).

TODO:
1. Not sure the name. `deref_on_immutable_ref` or some others?

2 years agosplit into borrow_deref_ref.rs and borrow_deref_ref_unfixable.rs
lengyijun [Wed, 1 Jun 2022 15:32:26 +0000 (15:32 +0000)]
split into borrow_deref_ref.rs and borrow_deref_ref_unfixable.rs

2 years agoAuto merge of #8916 - Jarcho:swap_ptr_to_ref, r=Manishearth
bors [Tue, 31 May 2022 17:47:01 +0000 (17:47 +0000)]
Auto merge of #8916 - Jarcho:swap_ptr_to_ref, r=Manishearth

New lint `swap_ptr_to_ref`

fixes: #7381

changelog: New lint `swap_ptr_to_ref`

2 years agoAdd lint `swap_ptr_to_ref`
Jason Newcomb [Mon, 30 May 2022 16:36:05 +0000 (12:36 -0400)]
Add lint `swap_ptr_to_ref`

2 years agoAuto merge of #8884 - evantypanski:manual_range_contains_multiple, r=Manishearth
bors [Tue, 31 May 2022 16:17:12 +0000 (16:17 +0000)]
Auto merge of #8884 - evantypanski:manual_range_contains_multiple, r=Manishearth

Fix `manual_range_contains` false negative with chains of `&&` and `||`

Fixes #8745

Since the precedence for `&&` is the same as itself the HIR for a chain of `&&` ends up with a right skewed tree like:

```
     &&
    /  \
  &&   c2
 /  \
... c1
```

So only the leftmost `&&` was actually "fully" checked, the top level was just `c2` and `&&` so the `manual_range_contains` lint won't apply. This change makes it also check `c2` with `c1`.

There's a bit of a hacky solution in the [second commit](https://github.com/rust-lang/rust-clippy/commit/257f09776a9c68ac903d1f23b80c414b70de1185) to check if the number of open/closing parens in the snippet match. This is to prevent a case like `((x % 2 == 0) || (x < 0)) || (x >= 10)` from offering a suggestion like `((x % 2 == 0) || !(0..10).contains(&x)` which now won't compile.

Any suggestions for that paren hack welcome, kinda new to working on this so not too sure about possible solutions :) it's weird because I don't know how else to check for parens in HIR considering they're removed when lowering AST.

changelog: Fix [`manual_range_contains`] false negative with chains of `&&` and `||`

2 years agoAuto merge of #8564 - Jarcho:transmute_erase_regions, r=Alexendoo
bors [Tue, 31 May 2022 15:57:27 +0000 (15:57 +0000)]
Auto merge of #8564 - Jarcho:transmute_erase_regions, r=Alexendoo

Don't lint `useless_transmute` on types with erased regions

fixes #6356
fixes #3340
fixes #2906

This should get a proper fix at some point, but this at least gets the lint running on some types.

cc #5343

changelog: Don't lint `useless_transmute` on types with erased regions

2 years agoAuto merge of #8876 - Alexendoo:cast-abs-to-different-uint, r=dswij,xFrednet
bors [Tue, 31 May 2022 15:40:03 +0000 (15:40 +0000)]
Auto merge of #8876 - Alexendoo:cast-abs-to-different-uint, r=dswij,xFrednet

`cast_abs_to_unsigned`: do not remove cast if it's required

Fixes #8873

If `iX` is not cast to `uX` then keep the cast rather than removing it

changelog: [`cast_abs_to_unsigned`]: do not remove cast if it's required

2 years agoMove `useless_transmute` back to `complexity`
Jason Newcomb [Fri, 18 Mar 2022 04:59:48 +0000 (00:59 -0400)]
Move `useless_transmute` back to `complexity`

2 years agoDon't lint `useless_transmute` on types with erased regions
Jason Newcomb [Fri, 18 Mar 2022 04:58:03 +0000 (00:58 -0400)]
Don't lint `useless_transmute` on types with erased regions

2 years agoAuto merge of #8918 - Jarcho:almost_complete_letter_range, r=llogiq
bors [Tue, 31 May 2022 05:10:42 +0000 (05:10 +0000)]
Auto merge of #8918 - Jarcho:almost_complete_letter_range, r=llogiq

Add lint `almost_complete_letter_range`

fixes #7269

changelog: Add lint `almost_complete_letter_range`

2 years agoAdd lint `almost_complete_letter_range`
Jason Newcomb [Tue, 31 May 2022 02:07:49 +0000 (22:07 -0400)]
Add lint `almost_complete_letter_range`

2 years agoAuto merge of #8912 - Alexendoo:needless-late-init-ice, r=giraffate
bors [Tue, 31 May 2022 00:46:52 +0000 (00:46 +0000)]
Auto merge of #8912 - Alexendoo:needless-late-init-ice, r=giraffate

needless_late_init: fix ICE when all branches return the never type

Fixes #8911

When the assignment is done in a match guard or the if condition and all of the branches return the never type `assignment_suggestions` would return an empty `Vec` which caused the ICE. It now returns `None` in that scenario

Also moves some tests to the top of the file

changelog: ICE Fixes: [`needless_late_init`] #8911

2 years agoAuto merge of #8913 - InfRandomness:ICE-#8748, r=giraffate
bors [Tue, 31 May 2022 00:17:52 +0000 (00:17 +0000)]
Auto merge of #8913 - InfRandomness:ICE-#8748, r=giraffate

Fix #8748

Thank you for making Clippy better!

changelog: Fix ICE #8748 in shadow.rs

2 years agoAuto merge of #8899 - botahamec:use-self-tuple-struct-variants, r=Alexendoo
bors [Mon, 30 May 2022 22:05:13 +0000 (22:05 +0000)]
Auto merge of #8899 - botahamec:use-self-tuple-struct-variants, r=Alexendoo

Fix `[use_self]` false negative with on struct and tuple struct patterns

fixes #8845

changelog: Triggered the warning for ``[`use_self`]`` on `TupleStruct` and `Struct` patterns, whereas currently it's only triggered for `Path` patterns

2 years agoFix #8748
InfRandomness [Sun, 29 May 2022 20:00:11 +0000 (20:00 +0000)]
Fix #8748

2 years agoTriggered the lint on tuple struct and struct patterns
Micha White [Thu, 26 May 2022 16:52:43 +0000 (12:52 -0400)]
Triggered the lint on tuple struct and struct patterns

2 years agorun-rustfix
lengyijun [Mon, 30 May 2022 01:49:46 +0000 (01:49 +0000)]
run-rustfix

2 years agoneedless_deref
lyj [Sun, 29 May 2022 01:57:15 +0000 (09:57 +0800)]
needless_deref

2 years agoneedless_late_init: fix ICE when all branches return the never type
Alex Macleod [Sun, 29 May 2022 18:28:34 +0000 (18:28 +0000)]
needless_late_init: fix ICE when all branches return the never type

2 years agoAuto merge of #8385 - cameron1024:doc_link_with_quotes, r=llogiq
bors [Sat, 28 May 2022 14:27:51 +0000 (14:27 +0000)]
Auto merge of #8385 - cameron1024:doc_link_with_quotes, r=llogiq

add doc_link_with_quotes lint

I'm not sure about wording, it seems OK to me but happy to change if other people have better ideas

closes #8383

---
changelog: add [`doc_link_with_quotes`] lint

2 years agoUpdate lint creation docs
Serial [Sat, 28 May 2022 13:50:14 +0000 (09:50 -0400)]
Update lint creation docs

2 years agoMake docs more consistent
Serial [Sat, 28 May 2022 13:22:59 +0000 (09:22 -0400)]
Make docs more consistent

2 years agoAuto merge of #8844 - smoelius:fixed-paths, r=Alexendoo
bors [Sat, 28 May 2022 11:28:04 +0000 (11:28 +0000)]
Auto merge of #8844 - smoelius:fixed-paths, r=Alexendoo

Check `.fixed` paths' existence in `run_ui`

This PR adds a test to check that there exists a `.fixed` file for every `.stderr` file in `tests/ui` that mentions a `MachineApplicable` lint. The test leverages `compiletest-rs`'s `rustfix_coverage` option.

I tried to add `.fixed` files where they appeared to be missing. However, 38 exceptional `.rs` files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.)

changelog: none

2 years agoMerge branch 'master' into doc_link_with_quotes
llogiq [Sat, 28 May 2022 08:55:25 +0000 (10:55 +0200)]
Merge branch 'master' into doc_link_with_quotes

2 years agoremove `large_enum_variant` suggestion for `Copy` types
Andre Bogus [Fri, 27 May 2022 23:36:05 +0000 (01:36 +0200)]
remove `large_enum_variant` suggestion for `Copy` types

2 years ago[1/N] Implement Arithmetic lint
Caio [Fri, 27 May 2022 21:53:02 +0000 (18:53 -0300)]
[1/N] Implement Arithmetic lint

2 years agoIgnore `crashes` dir
Samuel E. Moelius III [Fri, 27 May 2022 20:38:28 +0000 (16:38 -0400)]
Ignore `crashes` dir

2 years agoAuto merge of #8892 - smoelius:fix-empty-line-false-positive, r=Manishearth
bors [Fri, 27 May 2022 20:34:06 +0000 (20:34 +0000)]
Auto merge of #8892 - smoelius:fix-empty-line-false-positive, r=Manishearth

Fix `empty_line_after_outer_attribute` false positive

This PR fixes a false positive in `empty_line_after_outer_attribute`.

Here is a minimal example that trigger the FP:
```rust
#[derive(clap::Parser)]
#[clap(after_help = "This ia a help message.

You're welcome.
")]
pub struct Args;
```

changelog: PF: [`empty_line_after_outer_attribute`]: No longer lints empty lines in inner string values.

2 years agoAuto merge of #8897 - tamaroning:improve_dbg, r=Alexendoo
bors [Fri, 27 May 2022 19:41:39 +0000 (19:41 +0000)]
Auto merge of #8897 - tamaroning:improve_dbg, r=Alexendoo

Introduce `allow-dbg-in-tests` config value

related to: Issue #8758,  PR https://github.com/rust-lang/rust-clippy/pull/8838

changelog: Introduced `allow-dbg-in-tests` config value. [dbg_macro] does not allow `dbg!` in test code by default.

2 years agoFix `assert!` message
Samuel E. Moelius III [Wed, 25 May 2022 11:22:04 +0000 (07:22 -0400)]
Fix `assert!` message

2 years agoAddress review comments
Samuel E. Moelius III [Tue, 24 May 2022 23:01:18 +0000 (19:01 -0400)]
Address review comments

2 years agoCheck `.fixed` paths' existence in `run_ui`
Samuel E. Moelius III [Thu, 19 May 2022 13:03:38 +0000 (09:03 -0400)]
Check `.fixed` paths' existence in `run_ui`

2 years agoAuto merge of #8885 - Serial-ATA:rc-clone-in-vec-init-weak, r=llogiq
bors [Fri, 27 May 2022 04:02:53 +0000 (04:02 +0000)]
Auto merge of #8885 - Serial-ATA:rc-clone-in-vec-init-weak, r=llogiq

Support `Weak` in [`rc_clone_in_vec_init`]

changelog: Support `Weak` in [`rc_clone_in_vec_init`]

2 years agoSupport `Weak` in [`rc_clone_in_vec_init`]
Serial [Wed, 25 May 2022 01:56:44 +0000 (21:56 -0400)]
Support `Weak` in [`rc_clone_in_vec_init`]

2 years agoAuto merge of #8896 - Alexendoo:fn_sig_ice, r=llogiq
bors [Thu, 26 May 2022 16:33:30 +0000 (16:33 +0000)]
Auto merge of #8896 - Alexendoo:fn_sig_ice, r=llogiq

Only return `DefId`s to `Fn`-like definitions in `clippy_utils::fn_def_id`

Fixes #8850

in `returns.rs` `tcx.fn_sig` is called on the result of `fn_def_id`, which panics if the def is a `const`/`static`/etc rather than a functions definition

https://github.com/rust-lang/rust-clippy/blob/bc4d39e5fea64970dded1e6d2132d41435c0ef24/clippy_lints/src/returns.rs#L294-L303

changelog: Fix ICE due to callable `static`/`const`s

2 years agofix
tamaron [Thu, 26 May 2022 16:30:44 +0000 (01:30 +0900)]
fix

2 years agoOnly return DefIds to Fn-like definitions in clippy_utils::fn_def_id
Alex Macleod [Thu, 26 May 2022 14:21:09 +0000 (14:21 +0000)]
Only return DefIds to Fn-like definitions in clippy_utils::fn_def_id

2 years agoAuto merge of #8866 - botahamec:unused-rounding, r=llogiq
bors [Thu, 26 May 2022 05:16:37 +0000 (05:16 +0000)]
Auto merge of #8866 - botahamec:unused-rounding, r=llogiq

Add new lint `[unused_rounding]`

fixes #39

changelog: added a ``[`unused_rounding`]`` lint to check for the rounding of whole-number literals

2 years agoFix `empty_line_after_outer_attribute` false positive
Samuel E. Moelius III [Wed, 25 May 2022 23:22:44 +0000 (19:22 -0400)]
Fix `empty_line_after_outer_attribute` false positive

2 years agoAuto merge of #8889 - Serial-ATA:remove-newlines, r=xFrednet
bors [Wed, 25 May 2022 21:59:28 +0000 (21:59 +0000)]
Auto merge of #8889 - Serial-ATA:remove-newlines, r=xFrednet

Remove newlines in [`match_str_case_mismatch`] example

changelog: none

2 years agoRemove newlines in [`match_str_case_mismatch`] example
Serial [Wed, 25 May 2022 21:37:57 +0000 (17:37 -0400)]
Remove newlines in [`match_str_case_mismatch`] example

2 years agoChanged the lint description
Micha White [Sun, 22 May 2022 21:22:10 +0000 (17:22 -0400)]
Changed the lint description

2 years agoFixed the test to not use an epsilon
Micha White [Sun, 22 May 2022 21:21:04 +0000 (17:21 -0400)]
Fixed the test to not use an epsilon

2 years agoAdded an unused_rounding lint
Micha White [Sat, 21 May 2022 21:02:00 +0000 (17:02 -0400)]
Added an unused_rounding lint

2 years agoAuto merge of #8882 - kyoto7250:get_first, r=llogiq
bors [Wed, 25 May 2022 01:35:55 +0000 (01:35 +0000)]
Auto merge of #8882 - kyoto7250:get_first, r=llogiq

feat(lint): impl lint about use first() instead of get(0)

close #8851

This PR adds new lint about considering replacing .get(0) with .first().

Thank you in advance.

changelog: adds new lint [`get_first`] to consider replacing .get(0) with .first()

2 years agorefactor: get the required variables with MethodCall
kyoto7250 [Wed, 25 May 2022 00:11:29 +0000 (09:11 +0900)]
refactor: get the required variables with MethodCall

2 years agoignore clippy::get_first
kyoto7250 [Tue, 24 May 2022 09:56:37 +0000 (18:56 +0900)]
ignore clippy::get_first

2 years agosuggest first() instead of get(0)
kyoto7250 [Tue, 24 May 2022 09:55:39 +0000 (18:55 +0900)]
suggest first() instead of get(0)

2 years agofeat(lint): impl lint about use first() instead of get(0)
kyoto7250 [Tue, 24 May 2022 09:54:49 +0000 (18:54 +0900)]
feat(lint): impl lint about use first() instead of get(0)

2 years agoAuto merge of #8862 - Alexendoo:get-last-with-len, r=Jarcho,xFrednet
bors [Tue, 24 May 2022 21:40:15 +0000 (21:40 +0000)]
Auto merge of #8862 - Alexendoo:get-last-with-len, r=Jarcho,xFrednet

`get_last_with_len`: lint `VecDeque` and any deref to slice

changelog: [`get_last_with_len`]: lint `VecDeque` and any deref to slice

Previously only `Vec`s were linted, this will now catch any usages on slices, arrays, etc. It also suggests `.back()` for `VecDeque`s

Also moves the lint into `methods/`

2 years agoAuto merge of #8880 - hellow554:rustfix_update, r=Manishearth
bors [Tue, 24 May 2022 21:20:57 +0000 (21:20 +0000)]
Auto merge of #8880 - hellow554:rustfix_update, r=Manishearth

Add some testcases for recent rustfix update

changelog: none

This adds a testcase for a bugfix that has been fixed by https://github.com/rust-lang/rustfix/tree/v0.6.1

`rustfix` is pulled in by `compiletest_rs`. So to test that the correct rustfix version is used, I added one (and a half) testcase.

I tried to add a testcase for #8734 as well, but interesting enough the rustfix is wrong:

```diff
 fn issue8734() {
     let _ = [0u8, 1, 2, 3]
         .into_iter()
-        .and_then(|n| match n {
+        .flat_map(|n| match n {
+            1 => [n
+                .saturating_add(1)
             1 => [n
                 .saturating_add(1)
                 .saturating_add(1)
                 .saturating_add(1)
                 .saturating_add(1)
                 .saturating_add(1)
                 .saturating_add(1)
                 .saturating_add(1)
                 .saturating_add(1)],
             n => [n],
         });
 }
```

this needs some investigation and then this testcase needs to be enabled by commenting it out

closes #8878
related to #8734

2 years agoAuto merge of #8786 - Alexendoo:identity-op-suggestions, r=dswij,xFrednet
bors [Tue, 24 May 2022 20:47:34 +0000 (20:47 +0000)]
Auto merge of #8786 - Alexendoo:identity-op-suggestions, r=dswij,xFrednet

`identity_op`: add parenthesis to suggestions where required

changelog: [`identity_op`]: add parenthesis to suggestions where required

Follow up to #8730, wraps the cases we can't lint as-is in parenthesis rather than ignoring them

Catches a couple new FPs with mixed operator precedences and `as` casts

```rust
// such as
0 + { a } * 2;
0 + a as usize;
```

The suggestions are now applied using `span_lint_and_sugg` rather than appearing in just the message and have a `run-rustfix` test

2 years agoFix issue with mismatched parens in suggestion
Evan Typanski [Tue, 24 May 2022 18:09:56 +0000 (14:09 -0400)]
Fix issue with mismatched parens in suggestion

2 years agoAuto merge of #8881 - dmarcoux:update-outdated-doc, r=llogiq
bors [Tue, 24 May 2022 17:11:45 +0000 (17:11 +0000)]
Auto merge of #8881 - dmarcoux:update-outdated-doc, r=llogiq

Fix imports for "Checking if a type defines a specific method"

The import of `clippy_utils::is_type_diagnostic_item` would cause this error:

```
error[E0432]: unresolved import `clippy_utils::is_type_diagnostic_item
```

changelog: none

2 years agoAuto merge of #8754 - guerinoni:no_effect_replace, r=llogiq
bors [Tue, 24 May 2022 16:55:06 +0000 (16:55 +0000)]
Auto merge of #8754 - guerinoni:no_effect_replace, r=llogiq

New lint `no_effect_replace`

Closes #1595

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
changelog: Add [`no_effect_replace`] lint.

2 years agoFix `manual_range_contains` with equal precedence
Evan Typanski [Tue, 24 May 2022 15:50:12 +0000 (11:50 -0400)]
Fix `manual_range_contains` with equal precedence

2 years agoFix imports for "Checking if a type defines a specific method"
Dany Marcoux [Tue, 24 May 2022 12:53:08 +0000 (14:53 +0200)]
Fix imports for "Checking if a type defines a specific method"

The import of `clippy_utils::is_type_diagnostic_item` would cause this
error:

```
error[E0432]: unresolved import `clippy_utils::is_type_diagnostic_item
```

2 years agoprepare test for 8734
Marcel Hellwig [Tue, 24 May 2022 12:42:08 +0000 (14:42 +0200)]
prepare test for 8734

2 years agoadd testcase for #8878
Marcel Hellwig [Tue, 24 May 2022 12:41:23 +0000 (14:41 +0200)]
add testcase for #8878

2 years agoNew lint `no_effect_replace`
Federico Guerinoni [Mon, 25 Apr 2022 14:12:48 +0000 (16:12 +0200)]
New lint `no_effect_replace`

Closes #1595

changelog: Add no_effect_replace lint.

2 years agoAuto merge of #8872 - hellow554:dependency_update, r=llogiq
bors [Tue, 24 May 2022 06:52:41 +0000 (06:52 +0000)]
Auto merge of #8872 - hellow554:dependency_update, r=llogiq

update dependencies

changelog: none

Updating some dependencies, but the biggest one is clap to v3, but without using the derive struct thingy.

2 years agoAuto merge of #8870 - Serial-ATA:issue-8865, r=xFrednet
bors [Mon, 23 May 2022 17:29:23 +0000 (17:29 +0000)]
Auto merge of #8870 - Serial-ATA:issue-8865, r=xFrednet

Strip `clippy::` prefix from search strings

changelog: none
closes: #8865

r? `@xFrednet`

2 years agocast_abs_to_unsigned: do not remove cast if it's required
Alex Macleod [Mon, 23 May 2022 12:19:25 +0000 (12:19 +0000)]
cast_abs_to_unsigned: do not remove cast if it's required

2 years agoupdate dependencies
Marcel Hellwig [Mon, 23 May 2022 07:23:35 +0000 (09:23 +0200)]
update dependencies

2 years agoStrip `clippy::` prefix from search strings
Serial [Sun, 22 May 2022 19:24:47 +0000 (15:24 -0400)]
Strip `clippy::` prefix from search strings

2 years agoSet correct `ParamEnv` for `derive_partial_eq_without_eq`
Jason Newcomb [Sun, 22 May 2022 16:19:10 +0000 (12:19 -0400)]
Set correct `ParamEnv` for `derive_partial_eq_without_eq`

2 years agoget_last_with_len: lint VecDeque and any deref to slice
Alex Macleod [Fri, 20 May 2022 20:33:31 +0000 (20:33 +0000)]
get_last_with_len: lint VecDeque and any deref to slice

previously only vecs were supported

2 years agoAuto merge of #8848 - Serial-ATA:auto-detect-theme, r=xFrednet
bors [Sat, 21 May 2022 17:21:12 +0000 (17:21 +0000)]
Auto merge of #8848 - Serial-ATA:auto-detect-theme, r=xFrednet

Auto-detect preferred colorscheme

changelog: none

This just sets the theme to coal by default if the user prefers dark color schemes.

r? `@xFrednet`

2 years agoAuto merge of #8856 - xFrednet:rustup, r=Manishearth,Alexendoo
bors [Fri, 20 May 2022 21:35:14 +0000 (21:35 +0000)]
Auto merge of #8856 - xFrednet:rustup, r=Manishearth,Alexendoo

Rustup

`@rust-lang/clippy,` `@Jarcho,` `@dswij,` `@Alexendoo.` Could someone review this? It should be pretty straight forward since it's just a sync. I think it's also fine if either one of `@Jarcho,` `@dswij,` `@Alexendoo` approves this, as these are usually not reviewed. I just want to make sure that I didn't break something obvious :upside_down_face:

It should be enough to look at the merge commit :upside_down_face:

changelog: none
changelog: move [`significant_drop_in_scrutinee`] to `suspicious`

2 years agoRemove duplicated code and ignore deadlock test
xFrednet [Fri, 20 May 2022 21:32:09 +0000 (23:32 +0200)]
Remove duplicated code and ignore deadlock test

2 years agoAuto merge of #8852 - Alexendoo:indirect-disallowed-methods, r=Manishearth
bors [Fri, 20 May 2022 20:50:01 +0000 (20:50 +0000)]
Auto merge of #8852 - Alexendoo:indirect-disallowed-methods, r=Manishearth

Lint indirect usages in `disallowed_methods`

Fixes #8849

changelog: Lint indirect usages in [`disallowed_methods`]

2 years agoUpdate clippy version `0.1.62` -> `0.1.63`
xFrednet [Fri, 20 May 2022 19:12:41 +0000 (21:12 +0200)]
Update clippy version `0.1.62` -> `0.1.63`

2 years agomove to sus and fix dogfood
xFrednet [Fri, 20 May 2022 19:03:24 +0000 (21:03 +0200)]
move  to sus and fix dogfood

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
xFrednet [Fri, 20 May 2022 18:37:38 +0000 (20:37 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoLint indirect usages in `disallowed_methods`
Alex Macleod [Fri, 20 May 2022 12:39:15 +0000 (12:39 +0000)]
Lint indirect usages in `disallowed_methods`

2 years agoAuto-detect preferred colorscheme
Serial [Thu, 19 May 2022 22:33:16 +0000 (18:33 -0400)]
Auto-detect preferred colorscheme

2 years agoAuto merge of #8841 - Serial-ATA:remove-code-block, r=xFrednet
bors [Thu, 19 May 2022 21:46:18 +0000 (21:46 +0000)]
Auto merge of #8841 - Serial-ATA:remove-code-block, r=xFrednet

Remove code block from `pub_enum_variant_names`

changelog: none

Just noticed this empty code block that no other lint has :smile:.
![old](https://user-images.githubusercontent.com/69764315/169314573-098ce938-8a4c-4451-afd7-7b082823a0de.png)

r? `@xFrednet`

2 years agoAuto merge of #8840 - xFrednet:0000-mini-changelog-update, r=llogiq
bors [Thu, 19 May 2022 20:02:29 +0000 (20:02 +0000)]
Auto merge of #8840 - xFrednet:0000-mini-changelog-update, r=llogiq

Mini changelog update for Rust 1.61.0

I'll do the full release and sync tomorrow, as I sadly don't have the time today. This is a quick update to ensure that Rust's changelog will link to the correct section in our changelog.  The change is according to [our docs](https://github.com/rust-lang/rust-clippy/blob/8751e47bae68f6bf7ec833dbd42bde51a74f1a65/book/src/development/infrastructure/release.md#update-changelogmd)

changelog: none

2 years agoAuto merge of #8838 - tamaroning:fix_dbg, r=Jarcho,xFrednet
bors [Thu, 19 May 2022 15:46:35 +0000 (15:46 +0000)]
Auto merge of #8838 - tamaroning:fix_dbg, r=Jarcho,xFrednet

[dbg_macro] tolerates use of `dbg!` in items which have `#[cfg(test)]` attribute

fix: #8758
changelog: [dbg_macro] tolerates use of `dbg!` in items with `#[cfg(test)]` attribute

2 years agoRemove code block from `pub_enum_variant_names`
Serial [Thu, 19 May 2022 14:10:55 +0000 (10:10 -0400)]
Remove code block from `pub_enum_variant_names`

2 years agoMini changelog update for Rust 1.61.0
Fridtjof Stoldt [Thu, 19 May 2022 11:43:17 +0000 (13:43 +0200)]
Mini changelog update for Rust 1.61.0

2 years agofix
tamaron [Thu, 19 May 2022 09:58:59 +0000 (18:58 +0900)]
fix

2 years agoAuto merge of #8839 - Serial-ATA:copy-lint-name, r=xFrednet
bors [Wed, 18 May 2022 20:50:54 +0000 (20:50 +0000)]
Auto merge of #8839 - Serial-ATA:copy-lint-name, r=xFrednet

Add copy lint name button

changelog: Documentation: Add a *copy lint name*-button to Clippy's lint list

closes #7959

2 years ago`textContent` -> `innerHTML`
Serial [Wed, 18 May 2022 19:37:05 +0000 (15:37 -0400)]
`textContent` -> `innerHTML`

2 years ago`innerHTML` -> `textContent`
Serial [Wed, 18 May 2022 19:01:02 +0000 (15:01 -0400)]
`innerHTML` -> `textContent`

2 years agoAuto merge of #96863 - SparrowLii:let, r=michaelwoerister
bors [Wed, 18 May 2022 17:48:46 +0000 (17:48 +0000)]
Auto merge of #96863 - SparrowLii:let, r=michaelwoerister

use `hir::Let` in `hir::Guard::IfLet`

This PR fixes the FIXME about using `hir::Let` in `hir::Guard::IfLet`

2 years agoAuto merge of #8823 - smoelius:unknown-field, r=xFrednet
bors [Wed, 18 May 2022 17:15:38 +0000 (17:15 +0000)]
Auto merge of #8823 - smoelius:unknown-field, r=xFrednet

Improve "unknown field" error messages

Fixes #8806

Sample output:
```
error: error reading Clippy's configuration file `/home/smoelius/github/smoelius/rust-clippy/clippy.toml`: unknown field `foobar`, expected one of
           allow-expect-in-tests              enable-raw-pointer-heuristic-for-send    standard-macro-braces
           allow-unwrap-in-tests              enforced-import-renames                  third-party
           allowed-scripts                    enum-variant-name-threshold              too-large-for-stack
           array-size-threshold               enum-variant-size-threshold              too-many-arguments-threshold
           avoid-breaking-exported-api        literal-representation-threshold         too-many-lines-threshold
           await-holding-invalid-types        max-fn-params-bools                      trivial-copy-size-limit
           blacklisted-names                  max-include-file-size                    type-complexity-threshold
           cargo-ignore-publish               max-struct-bools                         unreadable-literal-lint-fractions
           cognitive-complexity-threshold     max-suggested-slice-pattern-length       upper-case-acronyms-aggressive
           cyclomatic-complexity-threshold    max-trait-bounds                         vec-box-size-threshold
           disallowed-methods                 msrv                                     verbose-bit-mask-threshold
           disallowed-types                   pass-by-value-size-limit                 warn-on-all-wildcard-imports
           doc-valid-idents                   single-char-binding-names-threshold
       at line 1 column 1
```

You can test this by (say) adding `foobar = 42` to Clippy's root `clippy.toml` file, and running `cargo run --bin cargo-clippy`.

Note that, to get the terminal width, this PR adds `termize` as a dependency to `cargo-clippy`. However, `termize` is also [how `rustc_errors` gets the terminal width](https://github.com/rust-lang/rust/blob/481db40311cdd241ae4d33f34f2f75732e44d8e8/compiler/rustc_errors/src/emitter.rs#L1607). So, hopefully, this is not a dealbreaker.

r? `@xFrednet`

changelog: Enhancements: the "unknown field" error messages for config files now wraps the field names.

2 years agoAdd copy lint name button
Serial [Wed, 18 May 2022 14:19:50 +0000 (10:19 -0400)]
Add copy lint name button

2 years agoImprove "unknown field" error messages
Samuel E. Moelius III [Thu, 12 May 2022 16:31:17 +0000 (12:31 -0400)]
Improve "unknown field" error messages

2 years agoAuto merge of #8807 - Jarcho:cmp_owned, r=giraffate
bors [Wed, 18 May 2022 00:19:36 +0000 (00:19 +0000)]
Auto merge of #8807 - Jarcho:cmp_owned, r=giraffate

Fix `cmp_owned` on copy types

fixes #8803
fixes #7365

changelog: Don't lint `cmp_owned` on `From::from` for copy types

2 years agofix
tamaron [Tue, 17 May 2022 15:37:12 +0000 (00:37 +0900)]
fix

2 years agoAuto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitor
bors [Tue, 17 May 2022 12:01:12 +0000 (12:01 +0000)]
Auto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #96329 (Add a couple tests for #90887 fixes)
 - #97009 (Allow `unused_macro_rules` in path tests)
 - #97075 (Add regression test for #81804)
 - #97079 (Change `Successors` to `impl Iterator<Item = BasicBlock>`)
 - #97080 (remove the `RelateResultCompare` trait)
 - #97093 (Migrate `maybe_recover_from_bad_type_plus` diagnostic)
 - #97102 (Update function pointer call error message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #97079 - SparrowLii:successors, r=lcnr
Yuki Okushi [Tue, 17 May 2022 10:01:32 +0000 (19:01 +0900)]
Rollup merge of #97079 - SparrowLii:successors, r=lcnr

Change `Successors` to `impl Iterator<Item = BasicBlock>`

This PR fixes the FIXME in `compiler\rustc_middle\src\mir\mod.rs`.
This can omit several `&`, `*` or `cloned` operations on Successros' generated elements

2 years agoAuto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwco
bors [Tue, 17 May 2022 09:39:26 +0000 (09:39 +0000)]
Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwco

Add a query for checking whether a function is an intrinsic.

work towards #93145

This will reduce churn when we add more ways to declare intrinsics

r? `@scottmcm`