]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #7013 - Y-Nak:fix-needless-paren, r=flip1995
bors [Thu, 1 Apr 2021 15:09:46 +0000 (15:09 +0000)]
Auto merge of #7013 - Y-Nak:fix-needless-paren, r=flip1995

clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par

changelog: clippy_utils: fix needless parenthesis output from `sugg::Sugg::maybe_par`

fixes: #6767

3 years agoAuto merge of #7011 - Jarcho:redundant_clone_fp, r=flip1995
bors [Thu, 1 Apr 2021 14:06:04 +0000 (14:06 +0000)]
Auto merge of #7011 - Jarcho:redundant_clone_fp, r=flip1995

Fix `redundant_clone` fp

fixes: #5973
fixes: #5595
fixes: #6998

changelog: Fix `redundant_clone` fp  where the cloned value is modified while the clone is in use.

3 years agoAuto merge of #7002 - mgacek8:issue6983_wrong_self_convention_inside_trait_impls...
bors [Thu, 1 Apr 2021 05:48:16 +0000 (05:48 +0000)]
Auto merge of #7002 - mgacek8:issue6983_wrong_self_convention_inside_trait_impls, r=phansch

wrong_self_convention: fix FP inside trait impl for `to_*` method taking `&self`

fixes #6983
changelog: `wrong_self_convention`: fix FP inside trait impl for `to_*` method taking `&self`

3 years agoAuto merge of #6976 - Jarcho:manual_map_const, r=phansch
bors [Thu, 1 Apr 2021 05:34:34 +0000 (05:34 +0000)]
Auto merge of #6976 - Jarcho:manual_map_const, r=phansch

Don't lint `manual_map` in const functions

fixes: #6967

changelog: Don't lint `manual_map` in const functions

3 years agoclippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par
Yoshitomo Nakanishi [Thu, 1 Apr 2021 01:39:44 +0000 (10:39 +0900)]
clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par

3 years agoAuto merge of #7010 - camsteffen:if-chain-lint, r=llogiq
bors [Wed, 31 Mar 2021 21:57:48 +0000 (21:57 +0000)]
Auto merge of #7010 - camsteffen:if-chain-lint, r=llogiq

Internal `if_chain!` lints

changelog: none

We use `if_chain!` a lot. So this enforces some style rules around it, internal only.

Lints when...
* Nested `if`/`if_chain!` can be collapsed
* An `if_chain!` starts with `let` or ends with `let ..; then {..}`
* An `if_chain!` has only one `if`
* An `if_chain!` contains `if .. && ..;` that spans multiple lines

3 years agoFix `redundant_clone` fp where the cloned value is modified while the clone is in...
Jason Newcomb [Wed, 31 Mar 2021 18:58:17 +0000 (14:58 -0400)]
Fix `redundant_clone` fp where the cloned value is modified while the clone is in use.

3 years agoEat dogfood
Cameron Steffen [Tue, 30 Mar 2021 19:59:59 +0000 (14:59 -0500)]
Eat dogfood

3 years agoAdd if_chain lints
Cameron Steffen [Tue, 30 Mar 2021 18:35:30 +0000 (13:35 -0500)]
Add if_chain lints

3 years agoAuto merge of #7008 - matthiaskrgr:ltchk, r=camsteffen
bors [Wed, 31 Mar 2021 18:58:52 +0000 (18:58 +0000)]
Auto merge of #7008 - matthiaskrgr:ltchk, r=camsteffen

lintcheck: warn if we get a bad exit status while running clippy

Right now we won't notice if a crate fails to build.
Print a warning message to indicate that there is a problem of some sort.
I'll still have to do more investigation on why this actually happens.

I suspect that the problem is that `clippy fix` might run  --all-targets  but when we download the crate source from crates.io, some path deps (used for internal tests etc...) are not available (which is usually not a problem because the internal tests are not needed when using the crate as a lib..?)

changelog: none

3 years agoAuto merge of #6913 - camsteffen:method-chain, r=flip1995
bors [Wed, 31 Mar 2021 18:30:32 +0000 (18:30 +0000)]
Auto merge of #6913 - camsteffen:method-chain, r=flip1995

Destructure args in `methods`

changelog: none

This changes the main pattern in `methods` to match and destructure the method call args at the same time as the method name, and pass individual arg `Expr`s to the lint impls.

```rust
// before
["expect", ..] => expect::check(cx, expr, arg_lists[0]);
// after
("expect", [arg]) => expect::check(cx, expr, recv, arg);
```

This makes the code safer since there is no risk of out of bounds `args[n]` everywhere. There will be no more collecting `method_names`, `arg_lists`, `method_spans` as a separate step - everything comes out of the `match`es. Chained methods are parsed in a nested `match`. This makes the code more verbose in some ways, but IMO it is much easier to follow.

~Definitely should wait for #6896. Just putting out the idea.~

3 years agoDestructure args in methods module
Cameron Steffen [Thu, 11 Mar 2021 05:40:20 +0000 (23:40 -0600)]
Destructure args in methods module

3 years agoAuto merge of #6342 - bbqbaron:issue-6061, r=flip1995
bors [Wed, 31 Mar 2021 16:19:07 +0000 (16:19 +0000)]
Auto merge of #6342 - bbqbaron:issue-6061, r=flip1995

Lint: filter(Option::is_some).map(Option::unwrap)

Fixes #6061

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog:
* add new lint for filter(Option::is_some).map(Option::unwrap)

First Rust PR, so I'm sure I've violated some idioms. Happy to change anything.

I'm getting one test failure locally -- a stderr diff for `compile_test`. I'm having a hard time seeing how I could be causing it, so I'm tentatively opening this in the hopes that it's an artifact of my local setup against `rustc`. Hoping it can at least still be reviewed in the meantime.

I'm gathering that since this is a method lint, and `.filter(...).map(...)` is already checked, the means of implementation needs to be a little different, so I didn't exactly follow the setup boilerplate. My way of checking for method calls seems a little too direct (ie, "is the second element of the expression literally the path for `Option::is_some`?"), but it seems like that's how some other lints work, so I went with it. I'm assuming we're not concerned about, eg, closures that just end up equivalent to `Option::is_some` by eta reduction.

3 years agoAuto merge of #6706 - Y-Nak:excessive-for-each, r=camsteffen
bors [Wed, 31 Mar 2021 15:59:55 +0000 (15:59 +0000)]
Auto merge of #6706 - Y-Nak:excessive-for-each, r=camsteffen

New Lint: needless_for_each

resolves: #6543

changelog: Added pedantic lint: `needless_for_each`

3 years agoSuggest `flatten` instead of `is_some` -> `unwrap`
Eric Loren [Sun, 15 Nov 2020 00:47:17 +0000 (19:47 -0500)]
Suggest `flatten` instead of `is_some` -> `unwrap`

3 years agoTweak a suggestion message of needless_for_each
Yoshitomo Nakanishi [Mon, 15 Mar 2021 03:01:39 +0000 (12:01 +0900)]
Tweak a suggestion message of needless_for_each

3 years agoSkip needless_for_each if an input stmt is local
Yoshitomo Nakanishi [Sun, 14 Mar 2021 01:22:28 +0000 (10:22 +0900)]
Skip needless_for_each if an input stmt is local

3 years agoFix codes that make dogfood fail
Yoshitomo Nakanishi [Sat, 13 Mar 2021 06:23:57 +0000 (15:23 +0900)]
Fix codes that make dogfood fail

3 years agoRemove method_calls
Yoshitomo Nakanishi [Sat, 13 Mar 2021 06:11:39 +0000 (15:11 +0900)]
Remove method_calls

3 years agoRefactor excessive_for_each
Yoshitomo Nakanishi [Fri, 12 Mar 2021 15:42:43 +0000 (00:42 +0900)]
Refactor excessive_for_each

3 years agoUse ".." as default value of snippet in excessive_for_each
Yoshitomo Nakanishi [Sat, 27 Feb 2021 04:58:41 +0000 (13:58 +0900)]
Use ".." as default value of snippet in excessive_for_each

3 years agoImprove the document of excessive_for_each
Yoshitomo Nakanishi [Sat, 27 Feb 2021 04:50:22 +0000 (13:50 +0900)]
Improve the document of excessive_for_each

3 years agoAdd comments to clarify why RetCollector is needed
Yoshitomo Nakanishi [Tue, 23 Feb 2021 12:55:00 +0000 (21:55 +0900)]
Add comments to clarify why RetCollector is needed

3 years agoRefactor: Remove duplicated codes from excessive_for_each
Yoshitomo Nakanishi [Mon, 22 Feb 2021 12:41:38 +0000 (21:41 +0900)]
Refactor: Remove duplicated codes from excessive_for_each

3 years agoAvoid to suggest using label
Yoshitomo Nakanishi [Thu, 11 Feb 2021 03:50:20 +0000 (12:50 +0900)]
Avoid to suggest using label

3 years agoTrigger the lint iff exposure's body is ExprKind::Block.
Yoshitomo Nakanishi [Tue, 9 Feb 2021 15:53:53 +0000 (00:53 +0900)]
Trigger the lint iff exposure's body is ExprKind::Block.

3 years agoChange a category of excessive_for_each: Style -> Restriction
Yoshitomo Nakanishi [Tue, 9 Feb 2021 14:36:20 +0000 (23:36 +0900)]
Change a category of excessive_for_each: Style -> Restriction

3 years agoFix codes that fails dogfood
Yoshitomo Nakanishi [Tue, 9 Feb 2021 12:20:42 +0000 (21:20 +0900)]
Fix codes that fails dogfood

3 years agoNew Lint: excessive_for_each
Yoshitomo Nakanishi [Mon, 8 Feb 2021 15:24:23 +0000 (00:24 +0900)]
New Lint: excessive_for_each

3 years agoAuto merge of #6981 - matthiaskrgr:6803_take_2, r=flip1995
bors [Wed, 31 Mar 2021 15:02:40 +0000 (15:02 +0000)]
Auto merge of #6981 - matthiaskrgr:6803_take_2, r=flip1995

disable upper_case_acronyms for pub items - enum edition

Fixes https://github.com/rust-lang/rust-clippy/issues/6803 (again... :sweat_smile:  )

My previous fix did not work for enums because enum variants were checked separately in the `check_variant` function but it looks like we can't use that because we can't tell if the enum the variants belong to is declared as public or not (it always said `Inherited` for me)

I went and special-cased enums and iterated over all the variants "manually", but only, if the enums is not public.

---

changelog: fix upper_case_acronyms still firing on public enums (#6803)

3 years agoAuto merge of #6938 - Y-Nak:refactor-types, r=flip1995
bors [Wed, 31 Mar 2021 14:35:48 +0000 (14:35 +0000)]
Auto merge of #6938 - Y-Nak:refactor-types, r=flip1995

Refactor types

r? `@flip1995`
This is the last PR to close #6724 :tada:
Also, this fixes #6936.

changelog: `vec_box`: Fix FN in `const` or `static`
changelog: `linkedlist`: Fix FN in `const` or `static`
changelog: `option_option`: Fix FN in `const` or `static`

3 years agoTrack bound vars
Jack Huey [Tue, 6 Oct 2020 00:41:46 +0000 (20:41 -0400)]
Track bound vars

3 years agolintcheck: warn if checking a program results in bad exit status
Matthias Krüger [Wed, 31 Mar 2021 12:36:56 +0000 (14:36 +0200)]
lintcheck: warn if checking a program results in bad exit status

3 years agoupdate lintcheck logs
Matthias Krüger [Wed, 31 Mar 2021 12:31:26 +0000 (14:31 +0200)]
update lintcheck logs

3 years agoFix hidden variant suggestion on single variant
Michael Wright [Sat, 27 Mar 2021 06:50:19 +0000 (08:50 +0200)]
Fix hidden variant suggestion on single variant

Fixes #6984

3 years agoAuto merge of #7007 - Y-Nak:result_unit_err, r=giraffate
bors [Wed, 31 Mar 2021 04:01:15 +0000 (04:01 +0000)]
Auto merge of #7007 - Y-Nak:result_unit_err, r=giraffate

result_unit_err: Fix typo

changelog: result_unit_err: fix typo in a diagnostic message

r? `@giraffate`
fixes https://github.com/rust-lang/rust-clippy/pull/6990#discussion_r603292920.

3 years agoresult_unit_err: Fix typo
Yoshitomo Nakanishi [Wed, 31 Mar 2021 02:18:48 +0000 (11:18 +0900)]
result_unit_err: Fix typo

3 years agoAuto merge of #7001 - ebobrow:non-octal-file-permissions, r=Manishearth
bors [Tue, 30 Mar 2021 23:23:50 +0000 (23:23 +0000)]
Auto merge of #7001 - ebobrow:non-octal-file-permissions, r=Manishearth

Add non_octal_unix_permissions lint

fixes #6934

changelog: add new lint that checks for non-octal values used to set unix file permissions

3 years agoAdd non_octal_unix_permissions lint
Elliot Bobrow [Mon, 29 Mar 2021 18:18:59 +0000 (11:18 -0700)]
Add non_octal_unix_permissions lint

3 years agoRemove hir::CrateItem.
Camille GILLOT [Tue, 30 Mar 2021 18:31:06 +0000 (20:31 +0200)]
Remove hir::CrateItem.

3 years agoDon't lint `manual_map` in const functions
Jason Newcomb [Fri, 26 Mar 2021 02:48:27 +0000 (22:48 -0400)]
Don't lint `manual_map` in const functions

3 years agoAuto merge of #7004 - Jarcho:manual_map_if_then_else, r=camsteffen
bors [Tue, 30 Mar 2021 14:03:54 +0000 (14:03 +0000)]
Auto merge of #7004 - Jarcho:manual_map_if_then_else, r=camsteffen

Fix `manual_map` at the end of an if chain

changelog: Fix `manual_map` suggestion at the end of an if chain

3 years agoFix `manual_map` at the end of an if chain
Jason Newcomb [Tue, 30 Mar 2021 00:39:28 +0000 (20:39 -0400)]
Fix `manual_map` at the end of an if chain

3 years agowrong_self_convention: fix FP inside trait impl for `to_*` method
Mateusz Gacek [Mon, 29 Mar 2021 19:51:23 +0000 (12:51 -0700)]
wrong_self_convention: fix FP inside trait impl for `to_*` method

When the `to_*` method takes `&self` and it is a trait implementation,
we don't trigger the lint.

3 years agoAuto merge of #7000 - Jarcho:clone_on_copy_fp, r=llogiq
bors [Tue, 30 Mar 2021 05:25:28 +0000 (05:25 +0000)]
Auto merge of #7000 - Jarcho:clone_on_copy_fp, r=llogiq

Improve `clone_on_copy`

This also removes the `clone_on_copy_mut` test as the same thing is covered in the `clone_on_copy` test.

changelog: `copy_on_clone` lint on chained method calls taking self by value
changelog: `copy_on_clone` only lint when using the `Clone` trait
changelog: `copy_on_clone` correct suggestion when the cloned value is a macro call.

3 years agoAuto merge of #6990 - Y-Nak:refactor-functions, r=giraffate
bors [Tue, 30 Mar 2021 03:59:45 +0000 (03:59 +0000)]
Auto merge of #6990 - Y-Nak:refactor-functions, r=giraffate

Organize functions into functions module

Ref: #6680
Rearrange lints in `functions`.

changelog: none

3 years agoImprove documents in functions group
Yoshitomo Nakanishi [Tue, 30 Mar 2021 02:45:54 +0000 (11:45 +0900)]
Improve documents in functions group

3 years agoAuto merge of #7003 - giraffate:use_uppercase_for_msrv, r=camsteffen
bors [Tue, 30 Mar 2021 00:55:42 +0000 (00:55 +0000)]
Auto merge of #7003 - giraffate:use_uppercase_for_msrv, r=camsteffen

Use uppercase for MSRV

A follow-up of <https://github.com/rust-lang/rust-clippy/pull/6977/files#diff-dac623e7b9c58138761aa527bf5f026bf113cda5b22eea61e655b44dd113389e>

changelog: none

3 years agoUse uppercase for MSRV
Takayuki Nakata [Mon, 29 Mar 2021 23:42:59 +0000 (08:42 +0900)]
Use uppercase for MSRV

3 years agoImprove `clone_on_copy`
Jason Newcomb [Mon, 29 Mar 2021 17:29:58 +0000 (13:29 -0400)]
Improve `clone_on_copy`
Lint on `_.clone().method()` when method takes self by value
Set applicability correctly
Correct suggestion when the cloned value is a macro call. e.g. `m!(x).clone()`
Don't lint when not using the `Clone` trait

3 years agoAuto merge of #6996 - Y-Nak:missing_panics_doc, r=Manishearth
bors [Mon, 29 Mar 2021 15:04:27 +0000 (15:04 +0000)]
Auto merge of #6996 - Y-Nak:missing_panics_doc, r=Manishearth

Allow missing panics doc if the panics occur only when debug-assertions is specified

fixes #6970

changelog: `missing_panics_doc`: Allow missing panics doc if the panics occur only when `debug-assertions` is specified.

3 years agomissing_panics_doc: Ignore usage of debug_assert family
Yoshitomo Nakanishi [Mon, 29 Mar 2021 08:19:05 +0000 (17:19 +0900)]
missing_panics_doc: Ignore usage of debug_assert family

3 years agoFix inconsistent test name
Yoshitomo Nakanishi [Mon, 29 Mar 2021 07:19:52 +0000 (16:19 +0900)]
Fix inconsistent test name

3 years agoAuto merge of #6993 - Jarcho:expl_impl_clone, r=llogiq
bors [Sun, 28 Mar 2021 23:30:56 +0000 (23:30 +0000)]
Auto merge of #6993 - Jarcho:expl_impl_clone, r=llogiq

Improve `expl_impl_clone_on_copy`

fixes: #1254

changelog: Check to see if the generic constraints are the same as if using derive for `expl_impl_clone_on_copy`

3 years agoAuto merge of #6991 - matthiaskrgr:5396, r=giraffate
bors [Sun, 28 Mar 2021 14:20:53 +0000 (14:20 +0000)]
Auto merge of #6991 - matthiaskrgr:5396, r=giraffate

redundant_pattern_matching: look inside Refs

look inside refs and detect if let &None = ...

Fixes https://github.com/rust-lang/rust-clippy/issues/5396

changelog:  redundant_pattern_matching: look inside Refs to fix FNs with "if let &None = .. "

3 years agoImprove `expl_impl_clone_on_copy`
Jason Newcomb [Sun, 28 Mar 2021 01:48:10 +0000 (21:48 -0400)]
Improve `expl_impl_clone_on_copy`
Check to see if the generic constraints are the same as if using derive

3 years agoTake into account sub modules
ThibsG [Sun, 28 Mar 2021 07:35:44 +0000 (09:35 +0200)]
Take into account sub modules

3 years agoFix FP in `single_component_path_imports` lint
ThibsG [Sun, 14 Mar 2021 18:35:35 +0000 (19:35 +0100)]
Fix FP in `single_component_path_imports` lint

3 years agoRemove (lots of) dead code
Joshua Nelson [Tue, 16 Mar 2021 05:50:34 +0000 (01:50 -0400)]
Remove (lots of) dead code

Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  https://github.com/rust-lang/compiler-team/issues/418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.

3 years agoredundant_pattern_matching: look inside Refs
Matthias Krüger [Sat, 27 Mar 2021 23:04:44 +0000 (00:04 +0100)]
redundant_pattern_matching: look inside Refs

look inside refs and detect if let &None = ...

Fixes https://github.com/rust-lang/rust-clippy/issues/5396

changelog:  redundant_pattern_matching: look inside Refs to fix FNs with "if let &None = .. "

3 years agoRollup merge of #82917 - cuviper:iter-zip, r=m-ou-se
Dylan DPC [Sat, 27 Mar 2021 19:37:07 +0000 (20:37 +0100)]
Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-se

Add function core::iter::zip

This makes it a little easier to `zip` iterators:

```rust
for (x, y) in zip(xs, ys) {}
// vs.
for (x, y) in xs.into_iter().zip(ys) {}
```

You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and
`iter()`, respectively. This can also support arbitrary nesting, where
it's easier to see the item layout than with arbitrary `zip` chains:

```rust
for ((x, y), z) in zip(zip(xs, ys), zs) {}
for (x, (y, z)) in zip(xs, zip(ys, zs)) {}
// vs.
for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {}
for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {}
```

It may also format more nicely, especially when the first iterator is a
longer chain of methods -- for example:

```rust
    iter::zip(
        trait_ref.substs.types().skip(1),
        impl_trait_ref.substs.types().skip(1),
    )
    // vs.
    trait_ref
        .substs
        .types()
        .skip(1)
        .zip(impl_trait_ref.substs.types().skip(1))
```

This replaces the tuple-pair `IntoIterator` in #78204.
There is prior art for the utility of this in [`itertools::zip`].

[`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html

3 years agoMove result_unit_err to its own module
Yoshitomo Nakanishi [Sat, 27 Mar 2021 13:48:25 +0000 (22:48 +0900)]
Move result_unit_err to its own module

3 years agoMove lints related to must_use to their own module
Yoshitomo Nakanishi [Sat, 27 Mar 2021 13:41:55 +0000 (22:41 +0900)]
Move lints related to must_use to their own module

3 years agomove not_unsafe_ptr_arg_deref to its own module
Yoshitomo Nakanishi [Sat, 27 Mar 2021 11:43:59 +0000 (20:43 +0900)]
move not_unsafe_ptr_arg_deref to its own module

3 years agoMove too_many_lines to its own module
Yoshitomo Nakanishi [Wed, 24 Mar 2021 14:20:31 +0000 (23:20 +0900)]
Move too_many_lines to its own module

3 years agoMove too_many_arguments to its own module
Yoshitomo Nakanishi [Wed, 24 Mar 2021 14:12:08 +0000 (23:12 +0900)]
Move too_many_arguments to its own module

3 years agoAuto merge of #6979 - flip1995:msrv_doc_fix, r=giraffate
bors [Sat, 27 Mar 2021 13:27:51 +0000 (13:27 +0000)]
Auto merge of #6979 - flip1995:msrv_doc_fix, r=giraffate

Add missing lints to MSRV config doc

r? `@giraffate`

changelog: Add missing lints to MSRV config doc

3 years agoAuto merge of #6980 - Jarcho:len_without_is_empty_sig, r=llogiq
bors [Sat, 27 Mar 2021 13:10:43 +0000 (13:10 +0000)]
Auto merge of #6980 - Jarcho:len_without_is_empty_sig, r=llogiq

`len_without_is_empty` improvements

fixes: #6958
fixes: #6972

changelog: Check the return type of `len`. Only integral types, or an `Option` or `Result` wrapping one.
changelog: Ensure the return type of `is_empty` matches. e.g. `Option<usize>` -> `Option<bool>`

3 years ago`len_without_is_empty` improvements
Jason Newcomb [Fri, 26 Mar 2021 20:27:19 +0000 (16:27 -0400)]
`len_without_is_empty` improvements
Check the return type of `len`. Only integral types, or an `Option` or `Result` wrapping one.
Ensure the return type of `is_empty` matches. e.g. `Option<usize>` -> `Option<bool>`

3 years agoformat macro argument parsing fix
Ömer Sinan Ağacan [Sun, 21 Mar 2021 14:29:21 +0000 (17:29 +0300)]
format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344

3 years agoupper_case_acronyms: add ui and ui-toml tests for private/public enums
Matthias Krüger [Fri, 26 Mar 2021 23:52:49 +0000 (00:52 +0100)]
upper_case_acronyms: add ui and ui-toml tests for private/public enums

3 years agoupper_case_acronyms: only lint enum variants if the enum is not public
Matthias Krüger [Fri, 26 Mar 2021 23:44:30 +0000 (00:44 +0100)]
upper_case_acronyms: only lint enum variants if the enum is not public

3 years agoUse iter::zip in src/tools/clippy/
Josh Stone [Mon, 8 Mar 2021 23:57:44 +0000 (15:57 -0800)]
Use iter::zip in src/tools/clippy/

3 years agoAdd missing lints to MSRV config doc
flip1995 [Fri, 26 Mar 2021 14:39:23 +0000 (15:39 +0100)]
Add missing lints to MSRV config doc

3 years agoAuto merge of #6977 - flip1995:or_patterns_msrv, r=llogiq
bors [Fri, 26 Mar 2021 15:12:50 +0000 (15:12 +0000)]
Auto merge of #6977 - flip1995:or_patterns_msrv, r=llogiq

Add MSRV options to `unnested_or_patterns`

changelog: [`unnested_or_patterns`] can now be configured with the `msrv` config/attribute.

Fixes #6953

3 years agoFix trailing whitespaces in doc/adding_lints.md
flip1995 [Fri, 26 Mar 2021 09:58:37 +0000 (10:58 +0100)]
Fix trailing whitespaces in doc/adding_lints.md

3 years agoImprove doc on how to add MSRV to a lint
flip1995 [Fri, 26 Mar 2021 09:57:51 +0000 (10:57 +0100)]
Improve doc on how to add MSRV to a lint

3 years agoAdd MSRV option to unnested_or_patterns lint
flip1995 [Fri, 26 Mar 2021 09:56:05 +0000 (10:56 +0100)]
Add MSRV option to unnested_or_patterns lint

3 years agoMerge type_complexity pass into types pass
Yoshitomo Nakanishi [Sat, 20 Mar 2021 06:32:19 +0000 (15:32 +0900)]
Merge type_complexity pass into types pass

3 years agoFix inconsistent test names
Yoshitomo Nakanishi [Fri, 19 Mar 2021 09:21:33 +0000 (18:21 +0900)]
Fix inconsistent test names

3 years agoFix FN that types lints don't work with const or static
Yoshitomo Nakanishi [Fri, 19 Mar 2021 09:14:48 +0000 (18:14 +0900)]
Fix FN that types lints don't work with const or static

3 years agoMove implicit_hasher to its own module
Yoshitomo Nakanishi [Thu, 18 Mar 2021 07:34:22 +0000 (16:34 +0900)]
Move implicit_hasher to its own module

3 years agoMove invalid_upcast_comparisons to its own module
Yoshitomo Nakanishi [Thu, 18 Mar 2021 07:15:19 +0000 (16:15 +0900)]
Move invalid_upcast_comparisons to its own module

3 years agoMove absurd_extreme_comparisons to its own module
Yoshitomo Nakanishi [Thu, 18 Mar 2021 07:03:56 +0000 (16:03 +0900)]
Move absurd_extreme_comparisons to its own module

3 years agoAuto merge of #6975 - Jarcho:redundant_slicing_fp, r=llogiq
bors [Fri, 26 Mar 2021 10:01:26 +0000 (10:01 +0000)]
Auto merge of #6975 - Jarcho:redundant_slicing_fp, r=llogiq

Improve `redundant_slicing`

fixes: #6968

changelog: Fix `redundant_slicing` suggestion when a reborrow might be required or when the value is from a macro call

3 years agoImprove `redundant_slicing`
Jason Newcomb [Fri, 26 Mar 2021 02:30:14 +0000 (22:30 -0400)]
Improve `redundant_slicing`
Fix bad suggestion when a reborrow might be required
Fix bad suggestion when the value being sliced is a macro call
Don't lint inside of a macro due to the previous context sensitive changes

3 years agoAuto merge of #6961 - xFrednet:changelog-1-52, r=flip1995
bors [Thu, 25 Mar 2021 18:39:19 +0000 (18:39 +0000)]
Auto merge of #6961 - xFrednet:changelog-1-52, r=flip1995

Update changelog for 1.52

I've underestimated the work that goes into this a bit, but it just shows that a lot has happened again in Clippy in 1.52 :upside_down_face:.

[Rendered](https://github.com/xFrednet/rust-clippy/blob/changelog-1-52/CHANGELOG.md)

---

changelog: none

3 years agoUpdated changelog for 1.52
xFrednet [Wed, 24 Mar 2021 00:05:19 +0000 (01:05 +0100)]
Updated changelog for 1.52

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agoMerge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup
flip1995 [Thu, 25 Mar 2021 18:29:11 +0000 (19:29 +0100)]
Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup

3 years agoAuto merge of #6971 - flip1995:rustup, r=flip1995
bors [Thu, 25 Mar 2021 17:49:06 +0000 (17:49 +0000)]
Auto merge of #6971 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump Clippy Version -> 0.1.53
flip1995 [Thu, 25 Mar 2021 17:48:48 +0000 (18:48 +0100)]
Bump Clippy Version -> 0.1.53

3 years agoBump nightly version -> 2021-03-25
flip1995 [Thu, 25 Mar 2021 17:38:52 +0000 (18:38 +0100)]
Bump nightly version -> 2021-03-25

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 25 Mar 2021 17:38:13 +0000 (18:38 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
bors [Thu, 25 Mar 2021 03:01:35 +0000 (03:01 +0000)]
Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen

Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint

3 years agocheck for `.to_string().into_bytes()` in string_lit_to_bytes
Elliot Bobrow [Wed, 24 Mar 2021 00:10:27 +0000 (17:10 -0700)]
check for `.to_string().into_bytes()` in string_lit_to_bytes

apply changes from review

3 years agoAuto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
bors [Wed, 24 Mar 2021 21:09:01 +0000 (21:09 +0000)]
Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth

Fix `new_ret_no_self` false positive

fixes: #1724

changelog: Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoRename `contains_adt` to `contains_adt_constructor`
Jason Newcomb [Wed, 24 Mar 2021 20:19:27 +0000 (16:19 -0400)]
Rename `contains_adt` to `contains_adt_constructor`

3 years agoFix false positive with `new_ret_no_self` when returning `Self` with different generi...
Jason Newcomb [Tue, 23 Mar 2021 01:38:14 +0000 (21:38 -0400)]
Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoAuto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq
bors [Wed, 24 Mar 2021 18:42:20 +0000 (18:42 +0000)]
Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq

Fix false positive in `manual_flatten`

This pull request fixes false positive in `manual_flatten` in case using a slice of references .

closes: #6893

changelog: fix false positive in `manual_flatten`

3 years agomerge imports
Takayuki Maeda [Wed, 24 Mar 2021 15:17:43 +0000 (00:17 +0900)]
merge imports