Commit Graph

15249 Commits

Author SHA1 Message Date
Alex Macleod
fc77d91469 Add cargo lintcheck --recursive to check dependencies of crates 2022-09-24 12:01:08 +00:00
bors
8b1ad17e5c Auto merge of #9527 - nyurik:inl2, r=llogiq
fallout2: rework clippy_dev & _lints fmt inlining

Continuing #9525 -- a few more inlining, but this time with some code changes to simplify format strings:

* Inline format args where possible
* simplify a few complex macros into format str
* use formatdoc!() instead format!(indoc!(...))

changelog: none

cc: `@llogiq`
2022-09-24 06:41:17 +00:00
Yuri Astrakhan
cc6b375cd3 fallout2: rework clippy_dev & _lints fmt inlining
* Inline format args where possible
* simplify a few complex macros into format str
* use formatdoc!() instead format!(indoc!(...))
2022-09-23 23:08:12 -04:00
bors
de8a1dd7e1 Auto merge of #102068 - cjgillot:erased-lifetime-print, r=eholk
Always print '_, even for erased lifetimes.

Explicit lifetime arguments are now the recommended syntax in rust 2018 and rust 2021.  This PR applies this discipline to rustc itself.
2022-09-24 01:23:17 +00:00
bors
c2d426650b Auto merge of #9525 - nyurik:apply-lints, r=llogiq
pre-fallout: Apply uninlined_format-args lint

This change is needed for the uninlined_format-args lint to be merged. See https://github.com/rust-lang/rust-clippy/pull/9233

changelog: none
2022-09-23 21:02:02 +00:00
Nilstrieb
e30b37b84b Fix clippy's const fn stability check for CURRENT_RUSTC_VERSION
Since clippy can use a projects MSRV for its lints, it might not want
to consider functions as const stable if they have been added lately.

Functions that have been stabilized this version use
CURRENT_RUSTC_VERSION as their version, which gets then turned into the
current version, which might be something like `1.66.0-dev`. The version
parser cannot deal with this version, so it has to be stripped off.
2022-09-23 21:04:54 +02:00
Nilstrieb
334f4535bd Stabilize const BTree{Map,Set}::new
Since `len` and `is_empty` are not const stable yet, this also
creates a new feature for them since they previously used the same
`const_btree_new` feature.
2022-09-23 20:55:37 +02:00
Yuri Astrakhan
59d0e8caba and a few more from other dirs 2022-09-23 14:25:03 -04:00
Yuri Astrakhan
cb6d1267c4 a few more core lint fixes 2022-09-23 13:55:30 -04:00
Yuri Astrakhan
e67b2bf732 Apply uninlined_format-args to clippy_lints
This change is needed for the uninlined_format-args lint to be merged.
See https://github.com/rust-lang/rust-clippy/pull/9233
2022-09-23 13:42:59 -04:00
Camille GILLOT
781e45c224 Bless clippy. 2022-09-23 18:42:14 +02:00
bors
ff65eec801 Auto merge of #9496 - yotamofek:never_loop_let_else, r=Jarcho
[`never_loop`]: Fix FP with let..else statements.

Fixes #9356

This has been bugging me for a while, so I thought I'd take a stab at it! I'm completely uncertain about the quality of my code, but I think it's an alright start, so opening this PR to get some feedback from more experienced clippy people :)

changelog: [`never_loop`]: Fix FP with let..else statements
2022-09-23 16:06:49 +00:00
bors
c8f2f383b5 Auto merge of #9523 - smoelius:compiletest-rs, r=Alexendoo
Upgrade `compiletest-rs` dependency

From `0.8` to `0.9`.

The new version includes a [fix](https://github.com/Manishearth/compiletest-rs/pull/259) for what I suspect was one cause of the recent rustup failure: https://github.com/rust-lang/rust-clippy/actions/runs/3106438892/jobs/5033324694#step:11:911

changelog: none
2022-09-23 15:52:27 +00:00
bors
dc14531fe9 Auto merge of #9519 - alessandrod:uninit-set-len-0, r=llogiq
uninit_vec: fix false positive with set_len(0)

`set_len(0)` does not create uninitialized elements. Fixes a false positive with the following pattern:

```rust
fn copy_slice_into_vec(dst: &mut Vec<u8>, src: &[u8]) {
    dst.reserve(src.len().saturating_sub(dst.len()));
    unsafe {
        dst.set_len(0);
        std::ptr::copy_nonoverlapping(src.as_ptr(), dst.as_mut_ptr(), src.len());
        dst.set_len(src.len());
    }
}
```

zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/uninit_vec.20and.20set_len.280.29

changelog: FP: [`uninit_vec`]: No longer lints `Vec::set_len(0)`
2022-09-23 15:37:13 +00:00
bors
d9277c6aa8 Auto merge of #102056 - b-naber:unevaluated, r=lcnr
Introduce mir::Unevaluated

Previously the distinction between unevaluated constants in the type-system and in mir was not explicit and a little confusing. Probably better to introduce its own type for that.

r? `@lcnr`
2022-09-23 13:39:11 +00:00
b-naber
26861fbd7f rename Unevaluated to UnevaluatedConst 2022-09-23 14:27:34 +02:00
Samuel Moelius
628a854ae2 Upgrade copiletest-rs dependency 2022-09-23 05:53:42 -04:00
Alessandro Decina
49319b4206 uninit_vec: special case set_len(0)
set_len(0) does not create uninitialized elements. Fixes a false positive with
the following pattern:

    fn copy_slice_into_vec(dst: &mut Vec<u8>, src: &[u8]) {
        dst.reserve(src.len().saturating_sub(dst.len()));
        unsafe {
            dst.set_len(0);
            std::ptr::copy_nonoverlapping(src.as_ptr(), dst.as_mut_ptr(), src.len());
            dst.set_len(src.len());
        }
    }
2022-09-23 09:35:47 +01:00
Matthias Krüger
2063b8f137 Rollup merge of #102123 - schteve:clippy-note, r=Manishearth
Add note to clippy::non_expressive_names doc

Addresses confusion in rust-lang/rust-clippy#9514 by updating the lint docs.
2022-09-22 21:34:51 +02:00
kraktus
b333645971 Add test with unsafe block to check #9503 is fixed too
s
2022-09-22 16:52:25 +02:00
kraktus
cda7547394 Make semicolon_span code more refactor-tolerant 2022-09-22 16:33:14 +02:00
bors
61fd2a8c6f Auto merge of #9499 - kraktus:nonstandard_macro_braces, r=xFrednet
[`nonstandard_macro_braces`] Do not modify macro arguments

fix #9498

based on top of https://github.com/rust-lang/rust-clippy/pull/9471

Also simplify the lint by not caring about code format which should be `rustfmt` job, and turn the lint into machine Applicable

changelog: Suggestion: [`nonstandard_macro_braces`]: The suggestion is now machine applicable and will no longer replace brackets inside the macro argument.
  [#9499](https://github.com/rust-lang/rust-clippy/pull/9499)
2022-09-22 14:25:27 +00:00
kraktus
a390115c6f [nonstandard_macro_braces] Do not modify macro arguments
Also simplify the lint by not caring about code format which should be `rustfmt` job, and turn the lint into machine Applicable
2022-09-22 16:24:23 +02:00
bors
c2c170adbe Auto merge of #9501 - xFrednet:changelog-1.64, r=llogiq
Changelog for Rust 1.64 🍎

The normal release preparation dance. I've written the changelog like the version has already been released. The PR can be approved and then merged by anyone after the release of Rust 1.64 🙃

---

changelog: none
2022-09-22 12:10:53 +00:00
b-naber
adc7e3e679 introduce mir::Unevaluated 2022-09-22 12:35:28 +02:00
Steve Heindel
09b1e8ff34 Add note to clippy::non_expressive_names doc 2022-09-21 19:45:57 -04:00
Michael Schubart
033dae9ecc Actually use the sorted vector 2022-09-21 19:04:31 +01:00
Caio
4c5f23082a [arithmetic-side-effects] Consider references 2022-09-21 15:02:37 -03:00
David Koloski
4d015293d1 Merge commit '7248d06384c6a90de58c04c1f46be88821278d8b' into sync-from-clippy 2022-09-21 13:13:27 -04:00
bors
7248d06384 Auto merge of #9471 - jplatte:patch-1, r=xFrednet
Add matches! checking to nonstandard_macro_braces

changelog: Enhancement: [`nonstandard_macro_braces`]: Now includes `matches!()` in the default lint config
  [#9471](https://github.com/rust-lang/rust-clippy/pull/9471)
2022-09-21 12:56:19 +00:00
bors
3956c9d3fe Auto merge of #9505 - mikerite:fix-9504-2, r=dswij
Fix ICE in `unnecessary_to_owned`

Fixes #9504

Compiler generated call `into_future` nodes return empty substs which we need when checking it's predicates. Handle this by simply exitting when we encounter one. This change introduces false negatives in place of the ICEs.

changelog: [`unnecessary_to_owned`]: fix ICE
2022-09-21 05:53:36 +00:00
Michael Wright
a783d54207 Fix ICE in unnecessary_to_owned
Fixes #9504

Compiler generated call `into_iter` nodes return empty substs
which we need when checking it's predicates. Handle this by
simply exitting when we encounter one. This change introduces
false negatives in place of the ICEs.
2022-09-21 07:14:04 +02:00
bors
1f66a3e8d0 Auto merge of #9502 - c410-f3r:arith, r=Alexendoo
[arithmetic-side-effects] Add more tests

Taken from the `integer-arithmetic` lint.

changelog: [arithmetic-side-effects] Add more tests
2022-09-20 16:14:54 +00:00
Caio
736d88b549 [arithmetic_side_effects] Add more tests 2022-09-20 12:06:49 -03:00
xFrednet
e279f22a91
Changelog for Rust 1.64 🍎 2022-09-20 15:23:48 +02:00
bors
0dc24ca376 Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
Allow patterns to constrain the hidden type of opaque types

fixes #96572

reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864)

TODO:

* check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-20 12:09:52 +00:00
bors
5c3c6a2de6 Auto merge of #9483 - c410-f3r:arith, r=Jarcho
[arithmetic-side-effects] Finish non-overflowing ops

Extends https://github.com/rust-lang/rust-clippy/pull/9474 to also take into consideration "raw" binary operations. For example, `let a = b / 2` and `let a = 1 * b` won't trigger the lint.

changelog: [arithmetic-side-effects] Finish non-overflowing ops
2022-09-19 14:35:14 +00:00
Jonas Platte
25584c0c67
Add matches! checking to nonstandard_macro_braces 2022-09-19 14:16:59 +02:00
Yotam Ofek
d63aeceaa1 [never_loop]: Fix FP with let..else statements. 2022-09-19 10:57:29 +00:00
kraktus
5c0cb0deaa [needless_return] Recursively remove unneeded semicolons 2022-09-19 12:33:42 +02:00
lcnr
70f4c712c5 remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00
kraktus
23d1d07861 small refactor 2022-09-19 07:43:16 +02:00
kraktus
15ec5d2608 further refactor 2022-09-18 21:26:23 +02:00
kraktus
bf8870eead further refactor of needless_return 2022-09-18 21:06:06 +02:00
kraktus
d1dbdcf332 refactor needless_return 2022-09-18 20:41:41 +02:00
kraktus
88a57963da [drop_copy]: Do not lint idiomatic in match arm 2022-09-17 15:37:38 +02:00
bors
e120fb10c6 Auto merge of #9488 - Alexendoo:unused, r=llogiq
Add `#[allow(unused)]` to test in `cargo dev new_lint`

`rustfix` tests don't automatically apply `-Aunused` which leads to some tests having `_workarounds`, add it to new test files automatically so people don't have to worry about it

changelog: none
2022-09-17 09:29:17 +00:00
Alex Macleod
6d8959ea83 Add #[allow(unused)] to test in cargo dev new_lint 2022-09-16 21:04:38 +00:00
kraktus
3ca6b9d031 Silence [question_mark] in const context 2022-09-16 22:02:09 +02:00
Caio
b7bef4c8a4 Change method's name 2022-09-16 17:01:29 -03:00