Commit graph

16268 commits

Author SHA1 Message Date
bors
83dba6e8bb Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwco
Add checks for the signature of the `start` lang item

Closes #105963
2023-01-13 07:45:34 +00:00
bors
97fb130fb2 Auto merge of #10194 - Alexendoo:unchecked-duration-subtraction-pedantic, r=Jarcho
Move `unchecked_duration_subtraction` to pedantic

changelog: [`unchecked_duration_subtraction`]: Move to pedantic

Based on https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202023-01-10/near/320488860
2023-01-13 05:58:46 +00:00
Alex Macleod
295225e9cd Move unchecked_duration_subtraction to pedantic 2023-01-13 00:04:28 +00:00
Michael Goulet
2253646395 Don't suggest dyn as parameter to add 2023-01-12 22:04:30 +00:00
Jason Newcomb
b38848d8f7 Fix suggestion in transmutes_expressible_as_ptr_casts when the source type is a borrow. 2023-01-12 16:01:24 -05:00
Philipp Krones
d21616737b Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup 2023-01-12 19:48:13 +01:00
bors
7f27e2e74e Auto merge of #10192 - Jarcho:revert_9701, r=flip1995
Partially revert #9701

This partially reverts #9701 due to #10134

r? `@flip1995`

changelog: None
2023-01-12 18:47:17 +00:00
Jason Newcomb
757e944ba6 Adjust old code for newer rustc version. 2023-01-12 13:29:23 -05:00
Jason Newcomb
5eed9c69ca Revert 4dbd8ad34e, c7dc961558, ed519ad746 and c6477eb711 2023-01-12 13:28:22 -05:00
bors
0b8ee70084 Auto merge of #10191 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-01-12 18:13:13 +00:00
Philipp Krones
cd76d574e4
Also add rustc_driver to clippy_utils
I'm not sure why this is necessary. It worked without this for me
locally, but this fails in CI. The same was done in clippy_dev
2023-01-12 19:12:06 +01:00
Philipp Krones
616b6d2be1
Bump nightly version -> 2023-01-12 2023-01-12 19:00:16 +01:00
Philipp Krones
631481ffb3
Merge remote-tracking branch 'upstream/master' into rustup 2023-01-12 18:59:59 +01:00
bors
f9ca9d4112 Auto merge of #10149 - jyn514:duplicate-sysroot, r=flip1995
Don't pass `--sysroot` twice if SYSROOT is set

This is useful for rust-lang/rust to allow setting a sysroot that's *only* for build scripts, different from the regular sysroot passed in RUSTFLAGS (since cargo doesn't apply RUSTFLAGS to build scripts or proc-macros).

That said, the exact motivation is not particularly important: this fixes a regression from
5907e9155e (r1060215684).

Note that only RUSTFLAGS is tested in the new integration test; passing --sysroot through `clippy-driver` never worked as far as I can tell, and no one is using it, so I didn't fix it here.

Helps with https://github.com/rust-lang/rust/pull/106394.

---

changelog: other: `SYSROOT` and `--sysroot` can now be set at the same time
[#10149](https://github.com/rust-lang/rust-clippy/pull/10149)
<!-- changelog_checked -->
2023-01-12 17:36:00 +00:00
Philipp Krones
fe007179ec
Add cargo-clippy sysroot test
Whne SYSROOT is defined, clippy-driver will insert a --sysroot argument
when calling rustc. However, when a sysroot argument is already defined,
e.g. through RUSTFLAGS=--sysroot=... the `cargo clippy` call would
error. This tests that the sysroot argument is only passed once and that
SYSROOT is ignored in this case.
2023-01-12 18:32:47 +01:00
Joshua Nelson
321c530fad
Don't pass --sysroot twice if SYSROOT is set
This is useful for rust-lang/rust to allow setting a sysroot that's
*only* for build scripts, different from the regular sysroot passed in
RUSTFLAGS (since cargo doesn't apply RUSTFLAGS to build scripts or
proc-macros).

That said, the exact motivation is not particularly important: this
fixes a regression from
5907e9155e (r1060215684).

Note that only RUSTFLAGS is tested in the new integration test; passing
--sysroot through `clippy-driver` never worked as far as I can tell, and
no one is using it, so I didn't fix it here.
2023-01-12 18:32:47 +01:00
Oli Scherer
0c48b5a223 Feed the features_query instead of grabbing it from the session lazily 2023-01-12 17:14:17 +00:00
bors
decaba97cc Auto merge of #10184 - robertbastian:master, r=xFrednet
Allow implementing `Hash` with derived `PartialEq` (`derive_hash_xor_eq`

This is a common pattern and is totally allowed by the `Hash` trait.

Fixes #2627

changelog: Move: Renamed `derive_hash_xor_eq` to [`derived_hash_with_manual_eq`]
[#10184](https://github.com/rust-lang/rust-clippy/pull/10184)
changelog: Enhancement: [`derived_hash_with_manual_eq`]: Now allows `#[derive(PartialEq)]` with custom `Hash` implementations
[#10184](https://github.com/rust-lang/rust-clippy/pull/10184)
<!-- changelog_checked -->
2023-01-12 14:59:41 +00:00
Tyler Weaver
cfe8849a62
Document extending list type configs
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-12 06:51:58 -07:00
Robert Bastian
920633258f fix 2023-01-12 14:22:18 +01:00
bors
7c01721434 Auto merge of #10179 - llogiq:trim-suspicious-to-owned-paths, r=xFrednet
trim paths in `suspicious_to_owned`

This continues my path trimming spree. I'm not going to add yet another changelog entry, we should have one "trim paths in some applicable lints" entry instead.

---

changelog: none
2023-01-12 12:10:56 +00:00
xFrednet
5cb6246c3e
Address PR reivew 2023-01-12 12:37:56 +01:00
xFrednet
e6948c4117
Last PR adjustments 2023-01-12 12:16:08 +01:00
navh
fcdd08badf
update cast_possible_truncation documentation 2023-01-12 12:16:07 +01:00
navh
51aaba6e8c
cast_possible_truncation Suggest TryFrom when truncation possible 2023-01-12 12:16:06 +01:00
bors
a95286b852 Auto merge of #10189 - Alexendoo:copy-packed-struct, r=giraffate
expl_impl_clone_on_copy: ignore packed structs with type/const params

changelog: [`expl_impl_clone_on_copy`]: Ignore `#[repr(packed)]` structs with type or const paramaters

Fixes #10188

A more involved solution that checks if any bound on the trait impl aren't present on the struct definition would be ideal, but I couldn't see a nice way to go about that
2023-01-12 00:29:30 +00:00
Mara Bos
2bcd697e2d Update clippy for new format_args!() lang items. 2023-01-12 00:25:46 +01:00
Mara Bos
dd168838b9 Make clippy compile. 2023-01-12 00:25:46 +01:00
asquared31415
c319440311 add checks for the signature of the lang item 2023-01-11 14:35:08 -08:00
Alex Macleod
34024adc88 expl_impl_clone_on_copy: ignore packed structs with type/const params 2023-01-11 17:37:19 +00:00
Andre Bogus
bd76d9133b trim paths in suspicious_to_owned 2023-01-11 16:39:34 +01:00
Albert Larsan
5f8686ec3b Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
bors
15226f91bb Auto merge of #10166 - sulami:master, r=giraffate
unused_self: Don't trigger if the method body contains todo!()

If the author is using todo!(), presumably they intend to use self at some point later, so we don't have a good basis to recommend factoring out to an associated function.

Fixes #10117.

---

changelog: Enhancement: [`unused_self`]: No longer lints, if the method body contains a `todo!()` call
[#10166](https://github.com/rust-lang/rust-clippy/pull/10166)
<!-- changelog_checked -->
2023-01-11 00:30:19 +00:00
dswij
d73adea465 needless_return: remove multiple semis on suggestion 2023-01-11 07:09:57 +08:00
dswij
96e306843e tests: add case for multiple semis 2023-01-11 07:09:57 +08:00
Robert Bastian
8ca900b01c rename 2023-01-10 11:12:54 +01:00
Robert Bastian
53c12e085a hash xor peq 2023-01-09 21:29:42 +01:00
bors
41b2a3d9fe Auto merge of #10170 - c410-f3r:arith, r=dswij
[arithmetic_side_effects] Add more tests related to custom types

Add tests to ensure that custom types are triggered with any type of arithmetic operation as well as combinations with or without references.

---

changelog: none
<!-- changelog_checked -->
2023-01-09 14:54:12 +00:00
bors
46981dca36 Auto merge of #10181 - llogiq:test-box-default-10089, r=flip1995
add a test against #10089

This was just an oversight while doing the box default path trimming PR, so I'm adding it rather late than never.

---

changelog: none
2023-01-09 09:49:57 +00:00
koka
1a7ef02dcb
Fix fp in unnecessary_safety_comment 2023-01-09 18:49:46 +09:00
Andre Bogus
d23dce54ec add a test against #100898 2023-01-08 20:25:42 +01:00
bors
d29c4c9f63 Auto merge of #10174 - chansuke:hotfix/remove-paths, r=dswij
hotfix: remove `ITER_COUNT` since it is not called

`&paths:ITER_COUNT` is not being called from anywhere, so removing it doesn't seem to be a problem.

---

changelog: none
2023-01-08 16:27:41 +00:00
chansuke
d8877bbd8a hotfix: remove ITER_COUNT since it is not called 2023-01-07 22:57:30 +09:00
bors
cf1d3d0370 Auto merge of #10162 - tamaroning:fix10018, r=xFrednet
Fix FP of single-element-loop

closes #10018

---

changelog: [`single_element_loop`]: No longer lints, if the loop contains a `break` or `continue`
[#10162](https://github.com/rust-lang/rust-clippy/pull/10162)
<!-- changelog_checked -->
2023-01-07 11:53:45 +00:00
Raiki Tamura
ce56cf71d9 chore 2023-01-07 20:44:02 +09:00
bors
ef5a545f98 Auto merge of #10164 - khuey:default_enum_unit_variant_msrv, r=llogiq
Restrict suggestion of deriving Default for enums to MSRV 1.62.

See https://blog.rust-lang.org/2022/06/30/Rust-1.62.0.html#default-enum-variants

---

changelog: none
2023-01-07 00:28:00 +00:00
bors
19b79c485e Auto merge of #10168 - blyxyas:fix_reversed_empty_ranges, r=dswij
[#10167] Clarify that the lint only works if x eq. y in a `for` loop.

Reading the documentation for the lint, one could expect that the lint works in all cases that `X == Y`. This is false.

While the lint was updated, the documentation wasn't.

More information about the `N..N` problem in #5689 and #5628

---

Fixes #10167
changelog: [`reversed_empty_ranges`]: Update and clarify documentation
2023-01-06 18:55:20 +00:00
Caio
fb34fbf7e0 [arithmetic_side_effects] Add more tests related to custom types 2023-01-06 14:50:25 -03:00
bors
3f0d0c1be7 Auto merge of #10112 - c410-f3r:arith, r=xFrednet
[arithmetic-side-effects] Consider negative numbers and add more tests

Same as #9867.

Opening again because it is not possible to randomly choose a reviewer in an ongoing PR like in the rust repo.

---

changelog: PF: [`arithmetic_side_effects`]: No longer lints on corner cases with negative number literals
[#9867](https://github.com/rust-lang/rust-clippy/pull/9867)
<!-- changelog_checked -->
2023-01-06 15:54:36 +00:00
Caio
4262aebeaa [arithmetic-side-effects] Consider negative numbers and add more tests 2023-01-06 12:25:51 -03:00