]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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`

2 years agoAuto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillot
bors [Tue, 17 May 2022 06:51:45 +0000 (06:51 +0000)]
Auto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillot

 Retire `ItemLikeVisitor` trait

Issue #95004
cc `@cjgillot`

2 years agoAuto merge of #8814 - yonip23:add-suggestion-to-rc-clone-in-vec-init, r=xFrednet
bors [Tue, 17 May 2022 05:46:00 +0000 (05:46 +0000)]
Auto merge of #8814 - yonip23:add-suggestion-to-rc-clone-in-vec-init, r=xFrednet

add suggestions to rc_clone_in_vec_init

A followup to https://github.com/rust-lang/rust-clippy/pull/8769
I also switch the order of the 2 suggestions, since the loop initialization one is probably the common case.

`@xFrednet` I'm not letting you guys rest for a minute ðŸ˜…
changelog: add suggestions to [`rc_clone_in_vec_init`]

2 years agoChange `Successors` to `impl Iterator<Item = BasicBlock>`
SparrowLii [Tue, 17 May 2022 00:41:01 +0000 (08:41 +0800)]
Change `Successors` to `impl Iterator<Item = BasicBlock>`

2 years agoAuto merge of #8835 - Jarcho:let_unit_ice, r=llogiq
bors [Mon, 16 May 2022 19:20:44 +0000 (19:20 +0000)]
Auto merge of #8835 - Jarcho:let_unit_ice, r=llogiq

Fix ICE in `let_unit_value` when calling a static or const callable type

fixes #8821

changelog: Fix ICE in `let_unit_value` when calling a static or const callable type

2 years agoAuto merge of #8752 - Serial-ATA:improve-filtering, r=xFrednet
bors [Mon, 16 May 2022 17:49:00 +0000 (17:49 +0000)]
Auto merge of #8752 - Serial-ATA:improve-filtering, r=xFrednet

Add version filtering option to the lint list

I'm no web dev, so I don't know if this is the best execution :smile:.

Here's how it looks:

![Desktop](https://user-images.githubusercontent.com/69764315/165403602-9e39fe0f-6a96-46cb-ba51-8b035e74cce4.gif)

And on mobile:

![Mobile](https://user-images.githubusercontent.com/69764315/165403908-fc4a0051-2ed4-48a3-b45b-b261f49ce259.png)

I've split this into two commits, in the second one I moved the JS into its own file to make it easier to work on. Is that alright? And if so, could the same thing be done to the css?

changelog: none
cc: #7958, `@repi`
r? `@xFrednet`

2 years agoFix ICE in `let_unit_value` when calling a static or const callable type
Jason Newcomb [Mon, 16 May 2022 14:00:32 +0000 (10:00 -0400)]
Fix ICE in `let_unit_value` when calling a static or const callable type

2 years agoAdd a query for checking whether a function is an intrinsic.
Oli Scherer [Fri, 13 May 2022 13:50:21 +0000 (13:50 +0000)]
Add a query for checking whether a function is an intrinsic.

2 years agoAuto merge of #8761 - tamaroning:fix_8505, r=Jarcho
bors [Mon, 16 May 2022 00:47:10 +0000 (00:47 +0000)]
Auto merge of #8761 - tamaroning:fix_8505, r=Jarcho

`undocumented_unsafe_blocks` does not trigger on unsafe trait impls

Closes #8505

changelog: This lint checks unsafe impls NOT from macro expansions and checks ones in macro declarations.
~~`unsafe impl`s from macro invocations don't trigger the lint for now.~~
~~This lint checks unsafe impls from/not from macro expansions~~

2 years agoAuto merge of #8699 - Jarcho:vec_init_then_push_7071, r=dswij,xFrednet
bors [Sun, 15 May 2022 21:51:24 +0000 (21:51 +0000)]
Auto merge of #8699 - Jarcho:vec_init_then_push_7071, r=dswij,xFrednet

Don't lint `vec_init_then_push` when further extended

fixes #7071

This will still lint when a larger number of pushes are done (four currently). The exact number could be debated, but this is more readable then a sequence of pushes so it shouldn't be too large.

changelog: Don't lint `vec_init_then_push` when further extended.
changelog: Remove `mut` binding from `vec_init_then_push` when possible.

2 years agoUpdate `vec_init_then_push` docs
Jason Newcomb [Sun, 24 Apr 2022 13:46:17 +0000 (09:46 -0400)]
Update `vec_init_then_push` docs

2 years agoAuto merge of #8621 - Jarcho:eval_order_dependence_4637, r=Jarcho
bors [Sun, 15 May 2022 21:36:24 +0000 (21:36 +0000)]
Auto merge of #8621 - Jarcho:eval_order_dependence_4637, r=Jarcho

Rename `eval_order_dependence` to `mixed_read_write_expression`, move to nursery

As per the [reference](https://doc.rust-lang.org/1.51.0/reference/expressions.html#evaluation-order-of-operands) evaluation order is now defined.

I'm pretty sure rust always compiled with this evaluation order anyways so there's no reason the put an msrv limit on the lint.

changelog: Rename `eval_order_dependence` to `mixed_read_write_expression`, move to nursery

2 years agoAdd renamed lints to the changelog link list
Jason Newcomb [Tue, 3 May 2022 15:03:08 +0000 (11:03 -0400)]
Add renamed lints to the changelog link list

2 years agoMove `mixed_read_write_in_expression` into `restriction`
Jason Newcomb [Tue, 3 May 2022 14:58:53 +0000 (10:58 -0400)]
Move `mixed_read_write_in_expression` into `restriction`

2 years agoRename `eval_order_dependence` to `mixed_read_write_in_expression`
Jason Newcomb [Tue, 3 May 2022 14:56:59 +0000 (10:56 -0400)]
Rename `eval_order_dependence` to `mixed_read_write_in_expression`

2 years agoImprove appearance on smaller screens
Serial [Sun, 15 May 2022 16:43:35 +0000 (12:43 -0400)]
Improve appearance on smaller screens

2 years agoUse early returns
Serial [Sun, 15 May 2022 15:30:00 +0000 (11:30 -0400)]
Use early returns

2 years agoAuto merge of #8832 - Alexendoo:duplicate-mod, r=Manishearth
bors [Sun, 15 May 2022 03:52:37 +0000 (03:52 +0000)]
Auto merge of #8832 - Alexendoo:duplicate-mod, r=Manishearth

Add `duplicate_mod` lint

Inspired by #8827, warns if there's a single file that is loaded by more than one `mod` item

```rust,ignore
// lib.rs
mod a;
mod b;
```
```rust,ignore
// a.rs
#[path = "./b.rs"]
mod b;
```

It adds a `canonicalize` call per `mod file;` encountered, which I don't think should be too heavy

Integration tests with common modules, e.g. [`test_utils`](https://github.com/rust-lang/rust-clippy/tree/2038084cf2253b57cf8b405ab000a92b68346f43/tests/test_utils) doesn't trigger it as each test is compiled separately, however I couldn't figure out a good way to add a test for that

changelog: Add [`duplicate_mod`] lint

2 years agoSwitch input to `type=number`; Separate version validation out of `byVersion`
Serial [Sun, 15 May 2022 00:08:10 +0000 (20:08 -0400)]
Switch input to `type=number`; Separate version validation out of `byVersion`

2 years agoAuto merge of #96883 - jackh726:early-binder-2, r=oli-obk
bors [Sat, 14 May 2022 23:53:11 +0000 (23:53 +0000)]
Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk

Add EarlyBinder

Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything  is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk.

Either way, tracking when we have or haven't already substituted out these in rustc can be helpful.

As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted.

r? `@nikomatsakis`

2 years agoAdd `duplicate_mod` lint
Alex Macleod [Sat, 14 May 2022 18:35:16 +0000 (19:35 +0100)]
Add `duplicate_mod` lint