]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoWhen setting suggestion, add suggestion for MoveAndClone for non-ref
Preston From [Tue, 24 May 2022 07:06:33 +0000 (01:06 -0600)]
When setting suggestion, add suggestion for MoveAndClone for non-ref

When trying to set the current suggestion, if the type of the expression
is not a reference and it is not trivially pure clone copy, we should still
trigger and emit a lint message. Since this fix may require cloning an
expensive-to-clone type, do not attempt to offer a suggested fix.

This change means that matches generated from TryDesugar and AwaitDesugar
would normally trigger a lint, but they are out of scope for this lint,
so we will explicitly ignore matches with sources of TryDesugar or
AwaitDesugar.

changelog: Update for [`significant_drop_in_scrutinee`] to correctly
emit lint messages for cases where the type is not a reference and
not trivially pure clone copy.

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 agoCollect renamed lints
Serial [Thu, 19 May 2022 14:49:32 +0000 (10:49 -0400)]
Collect renamed lints

2 years agotry to cache region_scope_tree as a query
Ding Xiang Fei [Wed, 25 May 2022 05:52:32 +0000 (13:52 +0800)]
try to cache region_scope_tree as a query

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 #96098 - JakobDegen:always-return-place, r=oli-obk
bors [Tue, 24 May 2022 07:13:26 +0000 (07:13 +0000)]
Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obk

Refactor call terminator to always include destination place

In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things.

cc `@RalfJung` `@eddyb` who were involved in the original conversation

r? rust-lang/mir-opt

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 agoRollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum
Yuki Okushi [Tue, 24 May 2022 03:18:31 +0000 (12:18 +0900)]
Rollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum

Lifetime variance fixes for clippy

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the clippy team can review independently.

2 years agoRefactor call terminator to always hold a destination place
Jakob Degen [Sat, 16 Apr 2022 13:27:54 +0000 (09:27 -0400)]
Refactor call terminator to always hold a destination place

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 agoLifetime variance fixes for clippy
Michael Goulet [Mon, 23 May 2022 15:48:17 +0000 (08:48 -0700)]
Lifetime variance fixes for clippy

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 agoRollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot
Dylan DPC [Mon, 23 May 2022 05:43:50 +0000 (07:43 +0200)]
Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot

Remove feature: `crate` visibility modifier

FCP completed in #53120.

2 years agoFix clippy explicit_write lint for new writeln implementation
David Tolnay [Mon, 23 May 2022 00:39:44 +0000 (17:39 -0700)]
Fix clippy explicit_write lint for new writeln implementation

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 agofactor out the rvalue lifetime rule
Ding Xiang Fei [Fri, 1 Apr 2022 13:12:18 +0000 (21:12 +0800)]
factor out the rvalue lifetime rule

remove region_scope_tree from RegionCtxt

Apply suggestions from code review

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2 years agoMerge crate and restricted visibilities
Jacob Pratt [Sat, 21 May 2022 18:45:14 +0000 (14:45 -0400)]
Merge crate and restricted visibilities

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 agoRemove feature: `crate` visibility modifier
Jacob Pratt [Sat, 21 May 2022 17:53:26 +0000 (13:53 -0400)]
Remove feature: `crate` visibility modifier

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 agoFix lint registration
xFrednet [Sat, 21 May 2022 11:50:11 +0000 (13:50 +0200)]
Fix lint registration

2 years agoMerge 'rust-clippy/master' into clippyup
xFrednet [Sat, 21 May 2022 11:24:00 +0000 (13:24 +0200)]
Merge 'rust-clippy/master' into clippyup

2 years agoAuto merge of #96923 - eholk:fix-fake-read, r=nikomatsakis
bors [Sat, 21 May 2022 04:21:38 +0000 (04:21 +0000)]
Auto merge of #96923 - eholk:fix-fake-read, r=nikomatsakis

Drop Tracking: Implement `fake_read` callback

This PR updates drop tracking's use of `ExprUseVisitor` so that we treat `fake_read` events as borrows. Without doing this, we were not handling match expressions correctly, which showed up as a breakage in the `addassign-yield.rs` test. We did not previously notice this because we still had rather large temporary scopes that we held borrows for, which changed in #94309.

This PR also includes a variant of the `addassign-yield.rs` test case to make sure we continue to have correct behavior here with drop tracking.

r? `@nikomatsakis`

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

2 years agoAdd bound_fn_sig
Jack Huey [Sun, 8 May 2022 19:43:18 +0000 (15:43 -0400)]
Add bound_fn_sig

2 years agoAdd bound_type_of
Jack Huey [Sun, 8 May 2022 19:12:56 +0000 (15:12 -0400)]
Add bound_type_of

2 years agoremove TestItemNamesVisitor
Miguel Guarniz [Sat, 7 May 2022 18:51:05 +0000 (14:51 -0400)]
remove TestItemNamesVisitor

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>