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

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>
2 years agoAuto merge of #8813 - evantypanski:redundant_alloc_fat_ptr, r=Alexendoo
bors [Fri, 13 May 2022 15:02:58 +0000 (15:02 +0000)]
Auto merge of #8813 - evantypanski:redundant_alloc_fat_ptr, r=Alexendoo

Fix redundant_allocation warning for Rc<Box<str>>

changelog: [`redundant_allocation`] Fixes #8604

Fixes false positives where a fat pointer with `str` type was made thin by another allocation, but that thinning allocation was marked as redundant

2 years agoComment why `hir_ty_to_ty` is safe in `check_ty`
Evan Typanski [Fri, 13 May 2022 09:55:50 +0000 (05:55 -0400)]
Comment why `hir_ty_to_ty` is safe in `check_ty`

2 years agoAuto merge of #8825 - ydah:fix_spelling, r=giraffate
bors [Fri, 13 May 2022 06:03:39 +0000 (06:03 +0000)]
Auto merge of #8825 - ydah:fix_spelling, r=giraffate

Tweak some words improved representation

Hello! Thank you for this awesome project!

This PR has implemented improved representation.

- Use "lib" instead of "lifb"
- Use "triggered" instead of "triggere"
- Use "blacklisted_name" instead of "blackisted_name"
- Use "stabilization" instead of "stabilisation"
- Use "behavior" instead of "behaviour"
- Use "target" instead of "tartet"
- Use "checked_add" instead of "chcked_add"
- Use "anti-pattern" instead of "antipattern"
- Use "suggestion" instead of "suggesttion"
- Use "example" instead of "exampel"
- Use "Cheat Sheet" instead of "Cheatsheet"

---

changelog: none

2 years agoTweak some words improved representation
ydah [Fri, 13 May 2022 05:20:25 +0000 (14:20 +0900)]
Tweak some words improved representation

This PR has implemented improved representation.

- Use "lib" instead of "lifb"
- Use "triggered" instead of "triggere"
- Use "blacklisted_name" instead of "blackisted_name"
- Use "stabilization" instead of "stabilisation"
- Use "behavior" instead of "behaviour"
- Use "target" instead of "tartet"
- Use "checked_add" instead of "chcked_add"
- Use "anti-pattern" instead of "antipattern"
- Use "suggestion" instead of "suggesttion"
- Use "example" instead of "exampel"
- Use "Cheat Sheet" instead of "Cheatsheet"

2 years agoAuto merge of #8799 - Alexendoo:lintcheck-common, r=giraffate
bors [Thu, 12 May 2022 23:56:31 +0000 (23:56 +0000)]
Auto merge of #8799 - Alexendoo:lintcheck-common, r=giraffate

Some lintcheck cleanup

A grab bag of smaller changes:

Panics if a crate source isn't valid, and fixes the `ryu` crate entry so it's picked up. Took me a while to realise why I couldn't do `cargo lintcheck --only ryu` ðŸ˜…

Parses messages with `cargo_metadata`, this catches a few more lints that were ignored because the message had an [expansion field](https://docs.rs/cargo_metadata/latest/cargo_metadata/diagnostic/struct.DiagnosticSpanMacroExpansion.html) that contained a path pointing into `.../.toolchains/...`. It also no longer emits some log lines with `null` as the column

It also merges the `run_clippy_lint` invocations and splits `LintcheckConfig` out into its own file

changelog: none

2 years agoinline construct_lint_suggestions
yonip23 [Thu, 12 May 2022 23:20:28 +0000 (02:20 +0300)]
inline construct_lint_suggestions

2 years agoCatch other thinning allocations using Ty
Evan Typanski [Thu, 12 May 2022 23:06:23 +0000 (19:06 -0400)]
Catch other thinning allocations using Ty

2 years agoAuto merge of #95562 - lcnr:attr-no-encode, r=davidtwco
bors [Thu, 12 May 2022 12:48:30 +0000 (12:48 +0000)]
Auto merge of #95562 - lcnr:attr-no-encode, r=davidtwco

don't encode only locally used attrs

Part of https://github.com/rust-lang/compiler-team/issues/505.

We now filter builtin attributes before encoding them in the crate metadata in case they should only be used in the local crate. To prevent accidental misuse `get_attrs` now requires the caller to state which attribute they are interested in. For places where that isn't trivially possible, I've added a method `fn get_attrs_unchecked` which I intend to remove in a followup PR.

After this pull request landed, we can then slowly move all attributes to only be used in the local crate while being certain that we don't accidentally try to access them from extern crates.

cc https://github.com/rust-lang/rust/pull/94963#issuecomment-1082924289

2 years agoSome lintcheck cleanup
Alex Macleod [Sat, 7 May 2022 21:10:56 +0000 (22:10 +0100)]
Some lintcheck cleanup

2 years agofix indentation + test
yonip23 [Thu, 12 May 2022 07:06:15 +0000 (10:06 +0300)]
fix indentation + test

2 years agofix
tamaron [Thu, 12 May 2022 03:33:05 +0000 (12:33 +0900)]
fix

2 years agofix clippy warning
yonip23 [Wed, 11 May 2022 20:16:49 +0000 (23:16 +0300)]
fix clippy warning

2 years agoAuto merge of #8818 - koic:use_rust_2021_prelude, r=flip1995
bors [Wed, 11 May 2022 20:16:42 +0000 (20:16 +0000)]
Auto merge of #8818 - koic:use_rust_2021_prelude, r=flip1995

Use the traits added to the Rust 2021 Edition prelude

Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html

---

changelog: none

2 years agofix review comments
yonip23 [Wed, 11 May 2022 20:11:52 +0000 (23:11 +0300)]
fix review comments

2 years agoAuto merge of #8726 - Serial-ATA:issue-8723, r=dswij,xFrednet
bors [Wed, 11 May 2022 17:39:25 +0000 (17:39 +0000)]
Auto merge of #8726 - Serial-ATA:issue-8723, r=dswij,xFrednet

Fix `match_single_binding` suggestion for assign expressions

changelog: Fix suggestion for assign expressions in [`match_single_binding`]
closes: #8723

2 years agoBless clippy.
Camille GILLOT [Wed, 11 May 2022 16:51:14 +0000 (18:51 +0200)]
Bless clippy.

2 years agoUse the traits added to the Rust 2021 Edition prelude
Koichi ITO [Tue, 10 May 2022 16:03:52 +0000 (01:03 +0900)]
Use the traits added to the Rust 2021 Edition prelude

Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html

2 years agoIntroduce EarlyBinder
Jack Huey [Sun, 8 May 2022 05:17:58 +0000 (01:17 -0400)]
Introduce EarlyBinder

2 years agoFix `match_single_binding` for assign expressions
Serial [Wed, 20 Apr 2022 14:14:11 +0000 (10:14 -0400)]
Fix `match_single_binding` for assign expressions

2 years agoadd suggestions to rc_clone_in_vec_init
yonip23 [Tue, 10 May 2022 21:46:20 +0000 (00:46 +0300)]
add suggestions to rc_clone_in_vec_init

2 years agoFix redundant_allocation warning for Rc<Box<str>>
Evan Typanski [Tue, 10 May 2022 18:21:51 +0000 (14:21 -0400)]
Fix redundant_allocation warning for Rc<Box<str>>

2 years agochore
tamaron [Tue, 10 May 2022 15:27:12 +0000 (00:27 +0900)]
chore

2 years agofix
tamaron [Tue, 10 May 2022 14:08:18 +0000 (23:08 +0900)]
fix

2 years agoAuto merge of #8796 - nsunderland1:master, r=giraffate
bors [Tue, 10 May 2022 13:25:27 +0000 (13:25 +0000)]
Auto merge of #8796 - nsunderland1:master, r=giraffate

New lint: [`derive_partial_eq_without_eq`]

Introduces a new lint, [`derive_partial_eq_without_eq`].

See: #1781 (doesn't close it though).

changelog: add lint [`derive_partial_eq_without_eq`]

2 years agoAuto merge of #8769 - yonip23:8719, r=xFrednet
bors [Tue, 10 May 2022 12:21:12 +0000 (12:21 +0000)]
Auto merge of #8769 - yonip23:8719, r=xFrednet

introduce rc_clone_in_vec_init lint

Closes #8719

changelog: Introduce [`rc_clone_in_vec_init`] lint

2 years agointroduce rc_clone_in_vec_init lint
yonip23 [Sun, 8 May 2022 19:20:25 +0000 (22:20 +0300)]
introduce rc_clone_in_vec_init lint

2 years agoupdate clippy
lcnr [Tue, 26 Apr 2022 12:04:23 +0000 (14:04 +0200)]
update clippy

2 years agoNew lint: [`derive_partial_eq_without_eq`]
nsunderland1 [Fri, 6 May 2022 07:10:11 +0000 (00:10 -0700)]
New lint: [`derive_partial_eq_without_eq`]

2 years agoAuto merge of #8809 - Alexendoo:metadata-collection-expect, r=xFrednet
bors [Mon, 9 May 2022 19:55:37 +0000 (19:55 +0000)]
Auto merge of #8809 - Alexendoo:metadata-collection-expect, r=xFrednet

Ignore unfulfilled_lint_expectations in metadata collection

r? `@xFrednet`

When metadata collection is enabled the regular early/late pass registrations are skipped, which the `#[expect()]`s were no fan of: https://github.com/rust-lang/rust-clippy/runs/6356675328?check_suite_focus=true

changelog: none

2 years agoIgnore unfulfilled_lint_expectations in metadata collection
Alex Macleod [Mon, 9 May 2022 19:30:06 +0000 (20:30 +0100)]
Ignore unfulfilled_lint_expectations in metadata collection

2 years agoAuto merge of #8797 - xFrednet:0000-expect-a-playground, r=flip1995
bors [Mon, 9 May 2022 17:14:43 +0000 (17:14 +0000)]
Auto merge of #8797 - xFrednet:0000-expect-a-playground, r=flip1995

Replace `#[allow]` with `#[expect]` in Clippy

Hey `@rust-lang/clippy,` `@Alexendoo,` `@dswij,` I'm currently working on the expect attribute as defined in [Rust RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html). With that, an `#[allow]` attribute can be replaced with a `#[expect]` attribute that suppresses the lint, but also emits a warning, if the lint isn't emitted in the expected scope.

With this PR I would like to test the attribute on a project scale and Clippy obviously came to mind. This PR replaces (almost) all `#[allow]` attributes in `clippy_utils` and `clippy_lints` with the `#[expect]` attribute. I was also able to remove some allows since, the related FPs have been fixed :tada:.

My question is now, are there any concerns regarding this? It's still okay to add normal `#[allow]` attributes, I see the need to nit-pick about that in new PRs, unless it's actually a FP. Also, I would not recommend using `#[expect]` in tests, as changes to a lint could the trigger the expect attribute in other files.

Additionally, I've noticed that Clippy has a bunch of `#[allow(clippy::too_many_lines)]` attributes. Should we maybe allow the lint all together or increase the threshold setting? To me, it seems like we mostly just ignore it in our code. :sweat_smile: :upside_down_face:

---

changelog: none

r? `@flip1995` (I've requested you for now, since you're also helping with reviewing the expect implementation. You are welcome to delegate this PR, even if it should be a simple review :upside_down_face: )

2 years agoDon't lint `cmp_owned` when `From::from` results in a copy type.
Jason Newcomb [Mon, 9 May 2022 16:29:31 +0000 (12:29 -0400)]
Don't lint `cmp_owned` when `From::from` results in a copy type.

2 years agoReduce unnecessary work in `cmp_owned`
Jason Newcomb [Mon, 9 May 2022 15:41:25 +0000 (11:41 -0400)]
Reduce unnecessary work in `cmp_owned`

2 years agoAuto merge of #8805 - Alexendoo:let-chain-docs, r=flip1995
bors [Mon, 9 May 2022 13:56:53 +0000 (13:56 +0000)]
Auto merge of #8805 - Alexendoo:let-chain-docs, r=flip1995

Recommend let chains over if_chain in docs

Switches over bit_mask.rs to let chains in order to create a nice example

While the rustfmt thing isn't resolved yet, my rust-analyzer isn't a fan of large `if_chains!`s, it stops giving me hover info and such after some number of if statements

changelog: none

2 years agofix clippy
SparrowLii [Mon, 9 May 2022 13:48:57 +0000 (21:48 +0800)]
fix clippy

2 years agoRecommend let chains over if_chain in docs
Alex Macleod [Mon, 9 May 2022 13:23:16 +0000 (14:23 +0100)]
Recommend let chains over if_chain in docs

2 years agouse let chains in bit_mask.rs
Alex Macleod [Mon, 9 May 2022 13:06:46 +0000 (14:06 +0100)]
use let chains in bit_mask.rs

2 years agoAuto merge of #95542 - xFrednet:rfc-2383-expect-query, r=wesleywiser
bors [Mon, 9 May 2022 00:02:55 +0000 (00:02 +0000)]
Auto merge of #95542 - xFrednet:rfc-2383-expect-query, r=wesleywiser

Support tool lints with the `#[expect]` attribute (RFC 2383)

This PR fixes the ICE https://github.com/rust-lang/rust/issues/94953 by making the assert for converted expectation IDs conditional.

Additionally, it moves the lint expectation check into a separate query to support rustdoc and other tools. On the way, I've also added some tests to ensure that the attribute works for Clippy and rustdoc lints.

The number of changes comes from the long test file. This may look like a monster PR, this may smell like a monster PR and this may be a monster PR, but it's a harmless monster. :sauropod:

---

Closes: https://github.com/rust-lang/rust/issues/94953
cc: https://github.com/rust-lang/rust/issues/85549

r? `@wesleywiser`

cc: `@rust-lang/rustdoc`