Commit Graph

7606 Commits

Author SHA1 Message Date
Alex Macleod
722f7d28c3 needless_late_init: fix ICE when all branches return the never type 2022-05-29 18:39:27 +00:00
Serial
cfd0f5592b Make docs more consistent 2022-05-28 09:48:26 -04:00
llogiq
c9be57dbf3
Merge branch 'master' into doc_link_with_quotes 2022-05-28 10:55:25 +02:00
Andre Bogus
19f94d52b3 remove large_enum_variant suggestion for Copy types 2022-05-28 01:36:05 +02:00
Caio
4fc0ee6260 [1/N] Implement Arithmetic lint 2022-05-27 18:53:02 -03:00
bors
1dd55471b4 Auto merge of #8892 - smoelius:fix-empty-line-false-positive, r=Manishearth
Fix `empty_line_after_outer_attribute` false positive

This PR fixes a false positive in `empty_line_after_outer_attribute`.

Here is a minimal example that trigger the FP:
```rust
#[derive(clap::Parser)]
#[clap(after_help = "This ia a help message.

You're welcome.
")]
pub struct Args;
```

changelog: PF: [`empty_line_after_outer_attribute`]: No longer lints empty lines in inner string values.
2022-05-27 20:34:06 +00:00
bors
461a6613cf Auto merge of #8897 - tamaroning:improve_dbg, r=Alexendoo
Introduce `allow-dbg-in-tests` config value

related to: Issue #8758,  PR https://github.com/rust-lang/rust-clippy/pull/8838

changelog: Introduced `allow-dbg-in-tests` config value. [dbg_macro] does not allow `dbg!` in test code by default.
2022-05-27 19:41:39 +00:00
Preston From
e33d87d4a0 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.
2022-05-27 00:08:49 -06:00
bors
a5ece8132f 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`]
2022-05-27 04:02:53 +00:00
Serial
fc28f6acc8 Support Weak in [rc_clone_in_vec_init] 2022-05-26 21:52:25 -04:00
tamaron
ea06a414f1 fix 2022-05-27 01:30:44 +09:00
bors
bc4d39e5fe 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
2022-05-26 05:16:37 +00:00
Samuel E. Moelius III
9ee211af9f Fix empty_line_after_outer_attribute false positive 2022-05-25 19:35:26 -04:00
bors
45785fe1ee Auto merge of #8889 - Serial-ATA:remove-newlines, r=xFrednet
Remove newlines in [`match_str_case_mismatch`] example

changelog: none
2022-05-25 21:59:28 +00:00
Serial
1c573c7f18 Remove newlines in [match_str_case_mismatch] example 2022-05-25 17:37:57 -04:00
Serial
45be175eeb Collect renamed lints 2022-05-25 17:31:21 -04:00
Ding Xiang Fei
2f250783b1 try to cache region_scope_tree as a query 2022-05-25 13:52:32 +08:00
Micha White
f489954e3e
Changed the lint description 2022-05-24 22:53:35 -04:00
Micha White
4de301e394
Fixed the test to not use an epsilon 2022-05-24 22:53:35 -04:00
Micha White
d8a281ef73
Added an unused_rounding lint 2022-05-24 22:53:29 -04:00
kyoto7250
d0f93c12a2 refactor: get the required variables with MethodCall 2022-05-25 09:11:29 +09:00
kyoto7250
b531eb1a7a suggest first() instead of get(0) 2022-05-25 09:08:25 +09:00
kyoto7250
1dd026698d feat(lint): impl lint about use first() instead of get(0) 2022-05-25 09:08:23 +09:00
bors
b97784fd07 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/`
2022-05-24 21:40:15 +00:00
bors
c41c410a90 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
2022-05-24 20:47:34 +00:00
Evan Typanski
257f09776a Fix issue with mismatched parens in suggestion 2022-05-24 14:57:49 -04:00
bors
fbb9e565e3 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.
2022-05-24 16:55:06 +00:00
Evan Typanski
78f7e3745f Fix manual_range_contains with equal precedence 2022-05-24 11:50:12 -04:00
Federico Guerinoni
ea62347a5a New lint no_effect_replace
Closes #1595

changelog: Add no_effect_replace lint.
2022-05-24 11:08:41 +02:00
bors
286b717808 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
2022-05-24 07:13:26 +00:00
Yuki Okushi
1f3116f806 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.
2022-05-24 12:18:31 +09:00
Jakob Degen
0684d62b56 Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
Michael Goulet
0ad3a0ac07 Lifetime variance fixes for clippy 2022-05-23 09:34:49 -07:00
Alex Macleod
a342f52f91 cast_abs_to_unsigned: do not remove cast if it's required 2022-05-23 12:23:48 +00:00
David Tolnay
8ec9e5e161 Fix clippy explicit_write lint for new writeln implementation 2022-05-22 17:39:56 -07:00
Jason Newcomb
5cf07c6d29 Set correct ParamEnv for derive_partial_eq_without_eq 2022-05-22 12:19:10 -04:00
Ding Xiang Fei
e885157f03 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>
2022-05-22 16:46:50 +08:00
Alex Macleod
855849034c get_last_with_len: lint VecDeque and any deref to slice
previously only vecs were supported
2022-05-21 19:52:43 +00:00
xFrednet
fc965c7300 Fix lint registration 2022-05-21 13:50:11 +02:00
xFrednet
4587b6628d Merge 'rust-clippy/master' into clippyup 2022-05-21 13:24:00 +02:00
bors
8d04a32ab4 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`
2022-05-21 04:21:38 +00:00
bors
b312ad7d0c 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 🙃

It should be enough to look at the merge commit 🙃

changelog: none
changelog: move [`significant_drop_in_scrutinee`] to `suspicious`
2022-05-20 21:35:14 +00:00
xFrednet
7842dbc4f5
Remove duplicated code and ignore deadlock test 2022-05-20 23:32:58 +02:00
xFrednet
8283238973
Update clippy version 0.1.62 -> 0.1.63 2022-05-20 21:12:41 +02:00
xFrednet
5b72632c98
move to sus and fix dogfood 2022-05-20 21:03:24 +02:00
xFrednet
4e6cf0036e
Merge remote-tracking branch 'upstream/master' into rustup 2022-05-20 20:47:31 +02:00
Alex Macleod
5730fd49fa Lint indirect usages in disallowed_methods 2022-05-20 12:39:15 +00:00
bors
6f26383f8e 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 😄.
![old](https://user-images.githubusercontent.com/69764315/169314573-098ce938-8a4c-4451-afd7-7b082823a0de.png)

r? `@xFrednet`
2022-05-19 21:46:18 +00:00
bors
ea96091331 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
2022-05-19 15:46:35 +00:00
Serial
944e1bbca3 Remove code block from pub_enum_variant_names 2022-05-19 10:10:55 -04:00
bors
01421e0cbd 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`
2022-05-18 17:48:46 +00:00
bors
b6ad6fc5aa 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](481db40311/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.
2022-05-18 17:15:38 +00:00
Samuel E. Moelius III
564725775b Improve "unknown field" error messages 2022-05-18 05:21:10 -04:00
bors
bf2e63104d 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
2022-05-18 00:19:36 +00:00
tamaron
b4c3f0f79b fix 2022-05-18 00:37:12 +09:00
bors
d901079ca1 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`]
2022-05-17 05:46:00 +00:00
SparrowLii
d7a6654580 Change Successors to impl Iterator<Item = BasicBlock> 2022-05-17 08:41:01 +08:00
Jason Newcomb
c649d4e8a7 Fix ICE in let_unit_value when calling a static or const callable type 2022-05-16 10:00:32 -04:00
bors
a1632fffc1 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~~
2022-05-16 00:47:10 +00:00
bors
6ec735962f 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.
2022-05-15 21:51:24 +00:00
Jason Newcomb
f1574cc131 Update vec_init_then_push docs 2022-05-15 17:39:39 -04:00
Jason Newcomb
4fd2968242 Move mixed_read_write_in_expression into restriction 2022-05-15 17:08:48 -04:00
Jason Newcomb
50eada16f7 Rename eval_order_dependence to mixed_read_write_in_expression 2022-05-15 17:08:45 -04:00
bors
198c70daab Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk
Add EarlyBinder

Chalk has no concept of `Param` (e0ade19d13/chalk-ir/src/lib.rs (L579)) or `ReEarlyBound` (e0ade19d13/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`
2022-05-14 23:53:11 +00:00
Alex Macleod
1f79a442e5 Add duplicate_mod lint 2022-05-14 22:31:13 +01:00
Jack Huey
cc0607a5b1 Add bound_type_of 2022-05-13 18:27:18 -04:00
bors
2038084cf2 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
2022-05-13 15:02:58 +00:00
Evan Typanski
ad7338e565 Comment why hir_ty_to_ty is safe in check_ty 2022-05-13 05:55:50 -04:00
ydah
4e5f69cc86 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"
2022-05-13 14:20:25 +09:00
yonip23
ed3744b957 inline construct_lint_suggestions 2022-05-13 02:20:28 +03:00
Evan Typanski
0def44a1c1 Catch other thinning allocations using Ty 2022-05-12 19:15:08 -04:00
yonip23
dc23b5d661 fix indentation + test 2022-05-12 10:06:15 +03:00
tamaron
9e66f2d058 fix 2022-05-12 12:33:05 +09:00
yonip23
a791205e76 fix clippy warning 2022-05-11 23:16:49 +03:00
bors
a3d1f28849 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
2022-05-11 20:16:42 +00:00
yonip23
344888a582 fix review comments 2022-05-11 23:11:52 +03:00
Koichi ITO
ae0216d557 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
2022-05-12 00:38:11 +09:00
Jack Huey
cf8ea64d9d Introduce EarlyBinder 2022-05-10 22:47:18 -04:00
Serial
554dc41cea Fix match_single_binding for assign expressions 2022-05-10 18:38:51 -04:00
yonip23
f3e01c4f6a add suggestions to rc_clone_in_vec_init 2022-05-11 01:09:45 +03:00
Eric Holk
5ad1b35206 Update clippy to new rake_read signature 2022-05-10 14:20:34 -07:00
Evan Typanski
631b4ee7a2 Fix redundant_allocation warning for Rc<Box<str>> 2022-05-10 14:21:51 -04:00
tamaron
1926217b86 chore 2022-05-11 00:27:12 +09:00
tamaron
aaf87c3871 fix 2022-05-10 23:54:42 +09:00
bors
d422baa30c 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`]
2022-05-10 13:25:27 +00:00
bors
1a11a499d4 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
2022-05-10 12:21:12 +00:00
yonip23
feb6d8cf30 introduce rc_clone_in_vec_init lint 2022-05-10 15:10:13 +03:00
lcnr
107ee40674 update clippy 2022-05-10 12:07:35 +02:00
nsunderland1
fe84ff3360 New lint: [derive_partial_eq_without_eq] 2022-05-09 22:13:39 -07:00
bors
aa033440da 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 🎉.

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. 😅 🙃

---

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 🙃 )
2022-05-09 17:14:43 +00:00
Jason Newcomb
993b4016db Don't lint cmp_owned when From::from results in a copy type. 2022-05-09 12:29:31 -04:00
Jason Newcomb
0f1544f15e Reduce unnecessary work in cmp_owned 2022-05-09 11:46:42 -04:00
SparrowLii
47e9afa20b fix clippy 2022-05-09 21:48:57 +08:00
Alex Macleod
5e4f092291 use let chains in bit_mask.rs 2022-05-09 14:06:46 +01:00
bors
1d018ce47c Auto merge of #96770 - flip1995:fix-trait-type-in-bounds, r=cjgillot
Track if a where bound comes from a impl Trait desugar

With https://github.com/rust-lang/rust/pull/93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a `impl Trait` or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during AST->HIR lowering.

r? `@cjgillot`

cc `@estebank` (as the reviewer of #93803)
2022-05-08 14:10:12 +00:00
Samuel E. Moelius III
597f61bbe3 Optionally allow expect and unwrap in tests 2022-05-08 07:18:31 -04:00
Samuel E. Moelius III
bdfea1c095 Pass msrvs by copy 2022-05-08 07:13:14 -04:00
bors
6d0378953e Auto merge of #94206 - PrestonFrom:significant_drop, r=flip1995
Create clippy lint against unexpectedly late drop for temporaries in match scrutinee expressions

A new clippy lint for issue 93883 (https://github.com/rust-lang/rust/issues/93883). Relies on a new trait in `marker` (called `SignificantDrop` to enable linting), which is why this PR is for the rust-lang repo and not the clippy repo.

changelog: new lint [`significant_drop_in_scrutinee`]
2022-05-08 00:57:08 +00:00
xFrednet
03960ebab2
Replace #[allow] with #[expect] in Clippy 2022-05-07 17:39:21 +02:00
flip1995
bca3d8a6b5 Track if a where bound comes from a impl Trait desugar
With #93803 `impl Trait` function arguments get desugared to hidden
where bounds. However, Clippy needs to know if a bound was originally a
impl Trait or an actual bound. This adds a field to the
`WhereBoundPredicate` struct to keep track of this information during
HIR lowering.
2022-05-07 17:10:30 +02:00