]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #9046 - xFrednet:rust-97660-expection-something-something, r=Jarcho
bors [Tue, 28 Jun 2022 18:28:38 +0000 (18:28 +0000)]
Auto merge of #9046 - xFrednet:rust-97660-expection-something-something, r=Jarcho

Fix `#[expect]` for most clippy lints

This PR fixes most `#[expect]` - lint interactions listed in rust-lang/rust#97660. [My comment in the issue](https://github.com/rust-lang/rust/issues/97660#issuecomment-1147269504) shows the current progress (Once this is merged). I plan to work on `duplicate_mod` and `multiple_inherent_impl` and leave the rest for later. I feel like stabilizing the feature is more important than fixing the last few nits, which currently also don't work with `#[allow]`.

---

changelog: none

r? `@Jarcho`

cc: rust-lang/rust#97660

2 years agoAuto merge of #8355 - Jarcho:explicit_auto_deref_2, r=flip1995
bors [Tue, 28 Jun 2022 18:09:26 +0000 (18:09 +0000)]
Auto merge of #8355 - Jarcho:explicit_auto_deref_2, r=flip1995

Add lint `explicit_auto_deref` take 2

fixes: #234
fixes: #8367
fixes: #8380

Still things to do:

* ~~This currently only lints `&*<expr>` when it doesn't trigger `needless_borrow`.~~
* ~~This requires a borrow after a deref to trigger. So `*<expr>` changing `&&T` to `&T` won't be caught.~~
* The `deref` and `deref_mut` trait methods aren't linted.
* Neither ~~field accesses~~, nor method receivers are linted.
* ~~This probably shouldn't lint reborrowing.~~
* Full slicing to deref should probably be handled here as well. e.g. `&vec[..]` when just `&vec` would do

changelog: new lint `explicit_auto_deref`

2 years agoAuto merge of #8921 - Jarcho:merge_passes, r=llogiq
bors [Tue, 28 Jun 2022 17:24:06 +0000 (17:24 +0000)]
Auto merge of #8921 - Jarcho:merge_passes, r=llogiq

Add `Operators` lint pass

changelog: None

2 years agoMove `SelfAssignment` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 14:43:02 +0000 (10:43 -0400)]
Move `SelfAssignment` into `Operators` lint pass

2 years agoFix dogfood
Jason Newcomb [Tue, 14 Jun 2022 15:44:43 +0000 (11:44 -0400)]
Fix dogfood

2 years agoMove `PtrEq` into `Operators` lin pass
Jason Newcomb [Wed, 1 Jun 2022 14:37:37 +0000 (10:37 -0400)]
Move `PtrEq` into `Operators` lin pass

2 years agoMove `NeedlessBitwiseBool` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 14:12:26 +0000 (10:12 -0400)]
Move `NeedlessBitwiseBool` into `Operators` lint pass

2 years agoMove `ModuloArithmetic` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 13:50:33 +0000 (09:50 -0400)]
Move `ModuloArithmetic` into `Operators` lint pass

2 years agoMove some lints from `Misc` to `Operators`
Jason Newcomb [Wed, 1 Jun 2022 06:06:12 +0000 (02:06 -0400)]
Move some lints from `Misc` to `Operators`

2 years agoMove `IntegerDivision` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 05:33:06 +0000 (01:33 -0400)]
Move `IntegerDivision` into `Operators` lint pass

2 years agoMove `IdentityOp` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 05:23:57 +0000 (01:23 -0400)]
Move `IdentityOp` into `Operators` lint pass

2 years agoMove `FloatEqualityWithoutAbs` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 05:06:56 +0000 (01:06 -0400)]
Move `FloatEqualityWithoutAbs` into `Operators` lint pass

2 years agoMove `ErasingOp` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 03:47:59 +0000 (23:47 -0400)]
Move `ErasingOp` into `Operators` lint pass

2 years agoMove `EqOp` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 03:39:00 +0000 (23:39 -0400)]
Move `EqOp` into `Operators` lint pass

2 years agoMove `DurationSubsec` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 02:48:17 +0000 (22:48 -0400)]
Move `DurationSubsec` into `Operators` lint pass

2 years agoMove `DoubleComparison` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 02:32:13 +0000 (22:32 -0400)]
Move `DoubleComparison` into `Operators` lint pass

2 years agoMove `BitMask` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 02:14:43 +0000 (22:14 -0400)]
Move `BitMask` into `Operators` lint pass

2 years agoMove `AssignOps` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 01:57:32 +0000 (21:57 -0400)]
Move `AssignOps` into `Operators` lint pass

2 years agoMove `Arithmetic` into `Operators` lint pass
Jason Newcomb [Wed, 1 Jun 2022 01:27:29 +0000 (21:27 -0400)]
Move `Arithmetic` into `Operators` lint pass

2 years agoAdd `Operators` lint pass
Jason Newcomb [Tue, 31 May 2022 18:07:50 +0000 (14:07 -0400)]
Add `Operators` lint pass

2 years agoAdd `explicit_auto_deref` test for variadic function
Jason Newcomb [Mon, 13 Jun 2022 17:09:52 +0000 (13:09 -0400)]
Add `explicit_auto_deref` test for variadic function

2 years agoCode cleanup
Jason Newcomb [Mon, 7 Feb 2022 15:29:45 +0000 (10:29 -0500)]
Code cleanup

2 years agoHandle future precedence issues in `explicit_auto_deref` + cleanup
Jason Newcomb [Mon, 31 Jan 2022 07:06:18 +0000 (02:06 -0500)]
Handle future precedence issues in `explicit_auto_deref` + cleanup

2 years agoFix `needless_borrow` suggestion when calling a trait method taking `self`
Jason Newcomb [Sun, 30 Jan 2022 01:29:43 +0000 (20:29 -0500)]
Fix `needless_borrow` suggestion when calling a trait method taking `self`

2 years agoRefactor `dereference.rs`
Jason Newcomb [Sat, 29 Jan 2022 23:06:14 +0000 (18:06 -0500)]
Refactor `dereference.rs`

Merge `Position` and `AutoDerefStability`

2 years agoLint `explicit_auto_deref` immediately after `needless_borrow`
Jason Newcomb [Sat, 29 Jan 2022 14:36:46 +0000 (09:36 -0500)]
Lint `explicit_auto_deref` immediately after `needless_borrow`

2 years agoLint `explicit_auto_deref` without a leading borrow
Jason Newcomb [Fri, 28 Jan 2022 19:54:28 +0000 (14:54 -0500)]
Lint `explicit_auto_deref` without a leading borrow

2 years agoOnly check parent node once in `dereference.rs`
Jason Newcomb [Fri, 28 Jan 2022 15:56:20 +0000 (10:56 -0500)]
Only check parent node once in `dereference.rs`

2 years agoLint field accesses in `explicit_auto_deref`
Jason Newcomb [Fri, 28 Jan 2022 14:12:34 +0000 (09:12 -0500)]
Lint field accesses in `explicit_auto_deref`

2 years agoMerge different parent walking loops in `dereference.rs`
Jason Newcomb [Fri, 28 Jan 2022 01:03:50 +0000 (20:03 -0500)]
Merge different parent walking loops in `dereference.rs`

`needless_borrow` will now walk further to find the target type.

2 years agoDon't lint `explicit_auto_deref` on reborrows
Jason Newcomb [Thu, 27 Jan 2022 15:17:14 +0000 (10:17 -0500)]
Don't lint `explicit_auto_deref` on reborrows

2 years agoAdd `explicit_auto_deref` lint
Jason Newcomb [Thu, 27 Jan 2022 03:47:09 +0000 (22:47 -0500)]
Add `explicit_auto_deref` lint

2 years agoBetter support projection types when finding the signature for an expression
Jason Newcomb [Tue, 25 Jan 2022 21:26:30 +0000 (16:26 -0500)]
Better support projection types when finding the signature for an expression

2 years agoUpdate `boxed_local` expect attribute location
xFrednet [Tue, 28 Jun 2022 10:38:52 +0000 (12:38 +0200)]
Update `boxed_local` expect attribute location

2 years agoAuto merge of #8774 - hellow554:cargo-rust-version, r=flip1995
bors [Tue, 28 Jun 2022 07:27:08 +0000 (07:27 +0000)]
Auto merge of #8774 - hellow554:cargo-rust-version, r=flip1995

try reading rust-version from Cargo.toml

Cargo.toml can contain a field `rust-version`, that acts like a MSRV of
clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
This will try to read that field and use it, if the clippy.toml config
has no `msrv` entry

changelog: respect `rust-version` from `Cargo.toml`

closes #8746
closes #7765

2 years agoAuto merge of #8639 - Jarcho:trivially_copy_pass_by_ref_5953, r=dswij
bors [Tue, 28 Jun 2022 07:03:57 +0000 (07:03 +0000)]
Auto merge of #8639 - Jarcho:trivially_copy_pass_by_ref_5953, r=dswij

`trivially_copy_pass_by_ref` fixes

fixes #5953
fixes #2961

The fix for #5953 is overly aggressive, but the suggestion is so bad that it's worth the false negatives. Basically three things together:
* It's not obviously wrong
* It compiles
* It may actually work when tested

changelog: Don't lint `trivially_copy_pass_by_ref` when unsafe pointers are used.
changelog: Better track lifetimes when linting `trivially_copy_pass_by_ref`.

2 years agoadd uitests for cargo rust-version field
Marcel Hellwig [Tue, 10 May 2022 12:46:05 +0000 (14:46 +0200)]
add uitests for cargo rust-version field

2 years agoparse `Cargo.toml` file in ui-cargo tests
Marcel Hellwig [Mon, 27 Jun 2022 09:11:52 +0000 (11:11 +0200)]
parse `Cargo.toml` file in ui-cargo tests

compiletest_rs is not meant to test full cargo projects, but instead
only files.
So we need to parse the `Cargo.toml` file ourself and set the
corresponding environment variable. In this case we just set
`CARGO_PKG_RUST_VERSION`, nothing more. But, of course, this can be
extended.

2 years agoupdate README.md to reflect rust-version in cargo.toml
Marcel Hellwig [Tue, 10 May 2022 11:09:28 +0000 (13:09 +0200)]
update README.md to reflect rust-version in cargo.toml

2 years agotry reading rust-version from Cargo.toml
Marcel Hellwig [Mon, 2 May 2022 09:31:39 +0000 (11:31 +0200)]
try reading rust-version from Cargo.toml

Cargo.toml can contain a field `rust-version`, that acts like a MSRV of
clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
This will try to read that field and use it, if the clippy.toml config
has no `msrv` entry

2 years agoAuto merge of #9045 - alex-semenyuk:self_assignment_example, r=llogiq
bors [Mon, 27 Jun 2022 17:33:31 +0000 (17:33 +0000)]
Auto merge of #9045 - alex-semenyuk:self_assignment_example, r=llogiq

Fix example `SELF_ASSIGNMENT`

changelog: Fix example in `SELF_ASSIGNMENT` docs

2 years agoAuto merge of #8649 - ebobrow:imperative_find, r=flip1995
bors [Mon, 27 Jun 2022 17:15:25 +0000 (17:15 +0000)]
Auto merge of #8649 - ebobrow:imperative_find, r=flip1995

add [`manual_find`] lint for function return case

part of the implementation discussed in #7143

changelog: add [`manual_find`] lint for function return case

2 years agoDon't lint `trivially_copy_pass_by_ref` when unsafe pointers are used
Jason Newcomb [Wed, 6 Apr 2022 02:48:47 +0000 (22:48 -0400)]
Don't lint `trivially_copy_pass_by_ref` when unsafe pointers are used

2 years agoActually check lifetimes in `trivially_copy_pass_by_ref`
Jason Newcomb [Wed, 6 Apr 2022 01:14:42 +0000 (21:14 -0400)]
Actually check lifetimes in `trivially_copy_pass_by_ref`

2 years agoFix example `SELF_ASSIGNMENT`
alexey semenyuk [Sat, 25 Jun 2022 11:57:32 +0000 (11:57 +0000)]
Fix example `SELF_ASSIGNMENT`

2 years agoAuto merge of #8972 - kyoto7250:use_retain, r=llogiq
bors [Mon, 27 Jun 2022 13:58:26 +0000 (13:58 +0000)]
Auto merge of #8972 - kyoto7250:use_retain, r=llogiq

feat(new lint): new lint `manual_retain`

close #8097

This PR is  a new  lint implementation.
This lint checks if the `retain` method is available.

Thank you in advance.

changelog: add new ``[`manual_retain`]`` lint

2 years agoAuto merge of #8990 - tsoutsman:master, r=llogiq
bors [Mon, 27 Jun 2022 13:38:50 +0000 (13:38 +0000)]
Auto merge of #8990 - tsoutsman:master, r=llogiq

Fix `let_undescore_lock` false-positive when binding without locking

Fixes #8486.

changelog: Fix `let_undescore_lock` false-positive when binding without locking.

2 years agoFix `let_undescore_lock` false-positive when binding without locking
Klim Tsoutsman [Mon, 13 Jun 2022 03:08:50 +0000 (13:08 +1000)]
Fix `let_undescore_lock` false-positive when binding without locking

Signed-off-by: Klim Tsoutsman <klimusha@gmail.com>
2 years agoAuto merge of #9054 - alex-semenyuk:string_add_example, r=giraffate
bors [Mon, 27 Jun 2022 06:08:00 +0000 (06:08 +0000)]
Auto merge of #9054 - alex-semenyuk:string_add_example, r=giraffate

STRING_ADD example

changelog: none
STRING_ADD example, how it should be

2 years agoAuto merge of #8871 - Serial-ATA:cargo-dev-deprecate, r=giraffate
bors [Mon, 27 Jun 2022 00:32:22 +0000 (00:32 +0000)]
Auto merge of #8871 - Serial-ATA:cargo-dev-deprecate, r=giraffate

Add `cargo dev deprecate`

changelog: none

I wrote this awhile ago when `regex` was still a dependency. Is it alright to add it back?

2 years agoAuto merge of #8939 - Jarcho:transmute_ptr_to_ref_lt, r=giraffate
bors [Mon, 27 Jun 2022 00:05:50 +0000 (00:05 +0000)]
Auto merge of #8939 - Jarcho:transmute_ptr_to_ref_lt, r=giraffate

Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`

fixes #8924

changelog: Suggest casting the pointer for any type containing lifetimes in `transmute_ptr_to_ref`.
changelog: Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`.

2 years agocargo dev update_lints
kyoto7250 [Sun, 26 Jun 2022 23:20:30 +0000 (08:20 +0900)]
cargo dev update_lints

2 years agofix for git rebase
kyoto7250 [Sat, 18 Jun 2022 09:56:46 +0000 (18:56 +0900)]
fix for git rebase

2 years agorename use_retain => manual_retain
kyoto7250 [Fri, 10 Jun 2022 12:02:43 +0000 (21:02 +0900)]
rename use_retain => manual_retain

2 years agocheck msrv
kyoto7250 [Fri, 10 Jun 2022 02:31:25 +0000 (11:31 +0900)]
check msrv

2 years agorewrite without if_chain macro
kyoto7250 [Thu, 9 Jun 2022 13:50:00 +0000 (22:50 +0900)]
rewrite without if_chain macro

2 years agocheck method
kyoto7250 [Thu, 9 Jun 2022 13:34:16 +0000 (22:34 +0900)]
check  method

2 years agochange lint type from style to perf
kyoto7250 [Thu, 9 Jun 2022 13:25:07 +0000 (22:25 +0900)]
change lint type from style to perf

2 years agoremove needless return
kyoto7250 [Thu, 9 Jun 2022 13:20:59 +0000 (22:20 +0900)]
remove needless return

2 years agoUpdate clippy_lints/src/use_retain.rs
kyoto7250 [Thu, 9 Jun 2022 12:52:40 +0000 (21:52 +0900)]
Update clippy_lints/src/use_retain.rs

Co-authored-by: llogiq <bogusandre@gmail.com>
2 years agofeat(new lint): new lint `use_retain`
kyoto7250 [Tue, 7 Jun 2022 03:11:33 +0000 (12:11 +0900)]
feat(new lint): new lint `use_retain`

2 years agoAuto merge of #9032 - kyoto7250:issue_9018, r=llogiq
bors [Sun, 26 Jun 2022 16:11:06 +0000 (16:11 +0000)]
Auto merge of #9032 - kyoto7250:issue_9018, r=llogiq

enum_variant_names should ignore when all prefixes are _

close #9018

When Enum prefix is only an underscore, we should not issue warnings.

changelog: fix false positive in enum_variant_names

2 years agoAuto merge of #9055 - kyoto7250:update_nodejs_in_github_action, r=Manishearth
bors [Sun, 26 Jun 2022 15:07:22 +0000 (15:07 +0000)]
Auto merge of #9055 - kyoto7250:update_nodejs_in_github_action, r=Manishearth

update node.js version in `remark.yml`

Optional chain (`?.`) is available in `node v14`, but node version in CI is `node v12`, so CI is failed now.

ref:
https://github.com/rust-lang/rust-clippy/runs/7059529735?check_suite_focus=true

optional chain:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining#browser_compatibility

Corresponding PR (maybe)
https://github.com/remarkjs/remark/pull/1007

changelog: None

2 years agoupdate node.js version
kyoto7250 [Sun, 26 Jun 2022 11:19:32 +0000 (20:19 +0900)]
update node.js version

2 years agoSTRING_ADD example
alexey semenyuk [Sun, 26 Jun 2022 08:36:50 +0000 (08:36 +0000)]
STRING_ADD example

2 years agoSTRING_ADD example
alexey semenyuk [Sun, 26 Jun 2022 08:14:37 +0000 (11:14 +0300)]
STRING_ADD example

2 years agouse all instead of join
kyoto7250 [Sun, 26 Jun 2022 07:11:04 +0000 (16:11 +0900)]
use all instead of join

2 years agotreat argument as a slice.
kyoto7250 [Sun, 26 Jun 2022 06:55:44 +0000 (15:55 +0900)]
treat argument as a slice.

Co-authored-by: llogiq <bogusandre@gmail.com>
2 years agoAuto merge of #8985 - botahamec:single-match-option, r=llogiq
bors [Sat, 25 Jun 2022 16:48:34 +0000 (16:48 +0000)]
Auto merge of #8985 - botahamec:single-match-option, r=llogiq

Lint `[single_match]` on `Option` matches

fixes #8928

changelog: did some cleanup of the logic for ``[`single_match`]`` and ``[`single_match_else`]`` which fixes the bug where `Option` matches were not linted unless a wildcard was used for one of the arms.

2 years agoGive clippy some Dogfood to make it happy =^.^=
xFrednet [Sat, 25 Jun 2022 12:53:54 +0000 (14:53 +0200)]
Give clippy some Dogfood to make it happy =^.^=

2 years agoAdd note to `is_lint_allowed` about lint emission
xFrednet [Sat, 25 Jun 2022 12:16:34 +0000 (14:16 +0200)]
Add note to `is_lint_allowed` about lint emission

2 years agoFix `#[expect]` for `clippy::manual_non_exhaustive`
xFrednet [Sat, 25 Jun 2022 12:16:33 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::manual_non_exhaustive`

2 years agoUpdate `useless_attribute` docs and allow `macro_use_imports`
xFrednet [Sat, 25 Jun 2022 12:16:33 +0000 (14:16 +0200)]
Update `useless_attribute` docs and allow `macro_use_imports`

2 years agoFix `#[expect]` for `clippy::macro_use_imports`
xFrednet [Sat, 25 Jun 2022 12:16:32 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::macro_use_imports`

2 years agoFix `#[expect]` for `unnecessary_unwrap`, `panicking_unwrap`
xFrednet [Sat, 25 Jun 2022 12:16:32 +0000 (14:16 +0200)]
Fix `#[expect]` for `unnecessary_unwrap`, `panicking_unwrap`

2 years agoFix `#[expect]` for `clippy::needless_return`
xFrednet [Sat, 25 Jun 2022 12:16:31 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::needless_return`

2 years agoFix `#[expect]` for `clippy::implicit_return`
xFrednet [Sat, 25 Jun 2022 12:16:31 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::implicit_return`

2 years agoFix `#[expect]` for `clippy::boxed_local`
xFrednet [Sat, 25 Jun 2022 12:16:30 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::boxed_local`

2 years agoFix `#[expect]` for `clippy::nonminimal_bool`
xFrednet [Sat, 25 Jun 2022 12:16:30 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::nonminimal_bool`

2 years agoFix `#[expect]` for `clippy::logic_bug`
xFrednet [Sat, 25 Jun 2022 12:16:30 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::logic_bug`

2 years agoTest `#[expect]` for `redundant_clone`
xFrednet [Sat, 25 Jun 2022 12:16:29 +0000 (14:16 +0200)]
Test `#[expect]` for `redundant_clone`

2 years agoFix `#[expect]` for `clippy::ptr_arg`
xFrednet [Sat, 25 Jun 2022 12:16:28 +0000 (14:16 +0200)]
Fix `#[expect]` for `clippy::ptr_arg`

2 years agoSuggest `pointer::cast` when possible in `transmute_ptr_to_ref`
Jason Newcomb [Sat, 4 Jun 2022 02:12:26 +0000 (22:12 -0400)]
Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`
Defensively add a cast to any type with lifetimes.

2 years agoAuto merge of #9015 - kyoto7250:issue_8493, r=Jarcho
bors [Sat, 25 Jun 2022 02:40:30 +0000 (02:40 +0000)]
Auto merge of #9015 - kyoto7250:issue_8493, r=Jarcho

ignore item in `thread_local!` macro

close #8493

This PR ignores `thread_local` macro in `declare_interior_mutable_const`.

changelog: ignore `thread_local!` macro in `declare_interior_mutable_const`

2 years agoAdd test for [`default_deprecation_reason`]
Serial [Fri, 24 Jun 2022 18:11:24 +0000 (14:11 -0400)]
Add test for [`default_deprecation_reason`]

2 years agoAuto merge of #9031 - evantypanski:manual_rem_euclid, r=Jarcho
bors [Fri, 24 Jun 2022 17:49:53 +0000 (17:49 +0000)]
Auto merge of #9031 - evantypanski:manual_rem_euclid, r=Jarcho

Add [`manual_rem_euclid`] lint

Closes #8883

Adds a lint for checking manual use of `rem_euclid(n)`

changelog: Add [`manual_rem_euclid`] lint

2 years agoAuto merge of #9037 - smoelius:fix-extra-unused-lifetimes-fp, r=dswij
bors [Fri, 24 Jun 2022 08:39:45 +0000 (08:39 +0000)]
Auto merge of #9037 - smoelius:fix-extra-unused-lifetimes-fp, r=dswij

Fix `extra_unused_lifetimes` false positive

This PR fixes #9014.

I confirmed the FP on the `crates.io` source as `@JohnTitor` mentioned, and confirmed that the FP is no longer present following this change.

I did not include a test in this PR because I think constructing one would be complicated, and the fix is pretty simple. But please let me know if this is unacceptable.

changelog: fix `extra_unused_lifetimes` FP

2 years agoAuto merge of #9036 - xFrednet:0000-force-warn-in-driver, r=dswij
bors [Fri, 24 Jun 2022 02:26:35 +0000 (02:26 +0000)]
Auto merge of #9036 - xFrednet:0000-force-warn-in-driver, r=dswij

Check for `--force-warn` in Clippy's driver run condition

Just a thing I've noticed while tinkering on the driver. Currently, the driver only checks for `--cap-lints=allow` to determine if Clippy should run on the code, but ignores possible `--force-warn` arguments

---

changelog: Others: Allowing all lints and only `--force-warn`ing some will now work with Clippy's driver

2 years agoAuto merge of #8953 - DevAccentor:slow_vector_initialization, r=Manishearth
bors [Thu, 23 Jun 2022 22:29:52 +0000 (22:29 +0000)]
Auto merge of #8953 - DevAccentor:slow_vector_initialization, r=Manishearth

add vec.capacity() to [`slow_vec_initialization`] detection

fix #8800

for example
```rust
let mut vec1 = Vec::with_capacity(len);
vec1.resize(vec1.capacity(), 0);

let mut vec2 = Vec::with_capacity(len);
vec2.extend(repeat(0).take(vec2.capacity()));
```
will trigger the lint

---

changelog: add `vec.capacity()` to [`slow_vec_initialization`] detection

2 years agoAdd external macro guard and test middle MSRV
Evan Typanski [Thu, 23 Jun 2022 20:34:52 +0000 (16:34 -0400)]
Add external macro guard and test middle MSRV

2 years agoFix ICE when deprecating lints in directories
Serial [Thu, 23 Jun 2022 14:37:00 +0000 (10:37 -0400)]
Fix ICE when deprecating lints in directories

2 years agoSplit constant check functions and simplify
Evan Typanski [Thu, 23 Jun 2022 14:35:14 +0000 (10:35 -0400)]
Split constant check functions and simplify

2 years agoCheck for `--force-warn` in Clippy's driver run condition
xFrednet [Thu, 23 Jun 2022 07:44:53 +0000 (09:44 +0200)]
Check for `--force-warn` in Clippy's driver run condition

2 years agoFix `extra_unused_lifetimes` false positive
Samuel E. Moelius III [Tue, 21 Jun 2022 09:18:27 +0000 (05:18 -0400)]
Fix `extra_unused_lifetimes` false positive

2 years agoAuto merge of #9034 - alex-semenyuk:example_vec_resize_to_zero, r=giraffate
bors [Wed, 22 Jun 2022 23:59:16 +0000 (23:59 +0000)]
Auto merge of #9034 - alex-semenyuk:example_vec_resize_to_zero, r=giraffate

Example for VEC_RESIZE_TO_ZERO

changelog: none

Example for VEC_RESIZE_TO_ZERO - what we should use instead

2 years agoAuto merge of #9028 - kyoto7250:issue_8798, r=xFrednet
bors [Wed, 22 Jun 2022 22:35:21 +0000 (22:35 +0000)]
Auto merge of #9028 - kyoto7250:issue_8798, r=xFrednet

confirm  using chain in collapsible_span_lint_calls

close #8798

This PR fixes false positive when using chain in `collapsible_span_lint_calls`.

changelog: None

2 years agoAuto merge of #9026 - hellow554:neg_multiply_precedence, r=xFrednet
bors [Wed, 22 Jun 2022 22:18:08 +0000 (22:18 +0000)]
Auto merge of #9026 - hellow554:neg_multiply_precedence, r=xFrednet

put parentheses around neg_multiply suggestion if needed

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`neg_multiply`]: put parentheses around suggestion if needed

2 years agoSimplify with let else
Evan Typanski [Wed, 22 Jun 2022 19:26:08 +0000 (15:26 -0400)]
Simplify with let else

2 years agoAdd MSRV check for const rem_euclid
Evan Typanski [Wed, 22 Jun 2022 18:17:52 +0000 (14:17 -0400)]
Add MSRV check for const rem_euclid

2 years agoFix case for function params
Evan Typanski [Wed, 22 Jun 2022 18:08:47 +0000 (14:08 -0400)]
Fix case for function params