Commit Graph

19032 Commits

Author SHA1 Message Date
Oli Scherer
c975c5f69e Bump ui_test version 2024-02-16 21:40:43 +01:00
bors
3b36b37258 Auto merge of #12294 - sanxiyn:min_ident_chars-trait-item, r=Jarcho
Check trait items in `min_ident_chars`

Fix #12237.

changelog: [`min_ident_chars`]: check trait items
2024-02-16 16:50:08 +00:00
bors
4fb9e12155 Auto merge of #11641 - Alexendoo:negative-redundant-guards, r=Jarcho
Allow negative literals in `redundant_guards`

changelog: none
2024-02-16 16:41:51 +00:00
bors
32c006ca94 Auto merge of #12292 - GuillaumeGomez:DEPRECATED_CLIPPY_CFG_ATTR, r=flip1995
Add new lint `DEPRECATED_CLIPPY_CFG_ATTR`

As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Is.20.60--cfg.20feature.3Dcargo-clippy.60.20deprecated.20or.20can.20it.20be.3F).

This lint suggests to replace `feature = "cargo-clippy"` with `clippy`.

r? `@flip1995`

changelog:  Add new lint `DEPRECATED_CLIPPY_CFG_ATTR`
2024-02-16 10:24:15 +00:00
bors
61daf674ea Auto merge of #10903 - Centri3:new_without_default, r=llogiq
[`new_without_default`]: Now emits on const fns

While `Default::default` is not const, it can still call `const new`; there's no reason this shouldn't be linted as well.

fixes #10877

changelog: [`new_without_default`]: Now emits on const fns
2024-02-16 07:55:05 +00:00
Centri3
f0adfe74b6 lint new_without_default on const fns too 2024-02-16 01:28:44 -06:00
bors
237fbdd4da Auto merge of #12296 - kaffarell:master, r=xFrednet
fix: documentation of `blocks_in_conditions` lint

Updated documentation + example of `blocks_in_conditions` lint, which has been updated recently to include `match` statements as well.

changelog: none
2024-02-15 12:20:38 +00:00
Guillaume Gomez
f4a3db8e4e Update clippy book to mention cfg(clippy) instead of feature cargo-clippy 2024-02-15 11:52:53 +01:00
Guillaume Gomez
cd6f03a3e8 Add ui tests for DEPRECATED_CLIPPY_CFG_ATTR 2024-02-15 11:52:53 +01:00
Guillaume Gomez
e0f82af3dd Pass --cfg clippy to clippy-driver 2024-02-15 11:52:53 +01:00
Gabriel Goller
183fade0ef fix: example in blocks_in_conditions lint
Example in blocks_in_conditions lint didn't compile.
2024-02-15 11:44:22 +01:00
Gabriel Goller
f4eb6bd709 fix: documentation of blocks_in_conditions lint
Updated documentation + example of `blocks_in_conditions` lint, which
has been updated recently to include `match` statements as well.
2024-02-15 11:05:25 +01:00
Guillaume Gomez
f35eec867a Add new lint DEPRECATED_CLIPPY_CFG_ATTR 2024-02-15 00:40:43 +01:00
Seo Sanghyeon
2526765fc8 Check trait items 2024-02-15 06:22:15 +09:00
bors
eb300fdad4 Auto merge of #12293 - Ethiraric:fix-12252, r=y21
[`case_sensitive_file_extension_comparisons`]: Don't trigger on digits-only extensions

If we find a file extension check with only digits (`.123`), do not trigger `case_sensitive_file_extension_comparisons`.

Fixes #12252

---

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

changelog: [`case_sensitive_file_extension_comparisons`]: Don't trigger on digits-only extensions
2024-02-14 18:20:49 +00:00
Ethiraric
9492de509f [case_sensitive_file_extension_comparisons]: Don't trigger on digits-only extensions 2024-02-14 18:26:56 +01:00
Alex Macleod
b32d7c0631 Allow negative literals in redundant_guards 2024-02-14 13:31:02 +00:00
bors
2c3213f5c5 Auto merge of #12285 - Ethiraric:fix-8573, r=dswij
Ignore imported items in `min_ident_chars`

Suppress the `min_ident_chars` warning for items whose name we cannot control. Do not warn for `use a::b`, but warn for `use a::b as c`, since `c` is a local identifier.

Fixes #12232

---

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

changelog: [`min_ident_chars`]: Do not warn on non-local identifiers
2024-02-14 04:02:38 +00:00
bors
03113a9f05 Auto merge of #12275 - y21:incompatible_msrv_desugaring, r=Manishearth
[`incompatible_msrv`]: allow expressions that come from desugaring

Fixes #12273

changelog: [`incompatible_msrv`]: don't lint on the `IntoFuture::into_future` call desugared by `.await`
2024-02-13 22:03:15 +00:00
Ethiraric
c1c2c3e60c Ignore imported items in min_ident_chars
Suppress the `min_ident_chars` warning for items whose name we cannot
control. Do not warn for `use a::b`, but warn for `use a::b as c`, since
`c` is a local identifier.

Fixes #12232
2024-02-13 19:14:12 +01:00
bors
3e264ba13a Auto merge of #11881 - y21:issue11880, r=Alexendoo
[`implied_bounds_in_impls`]: avoid linting on overlapping associated tys

Fixes #11880

Before this change, we were simply ignoring associated types (except for suggestion purposes), because of an incorrect assumption (see the comment that I also removed).

For something like
```rs
trait X { type T; }
trait Y: X { type T; }

// Can't constrain `X::T` through `Y`
fn f() -> impl X<T = i32> + Y<T = u32> { ... }
```
We now avoid linting if the implied bound (`X<T = i32>`) "names" associated types that also exists in the implying trait (`trait Y`). Here that would be the case.
But if we only wrote `impl X + Y<T = u32>` then that's ok because `X::T` was never constrained in the first place.

I haven't really thought about how this interacts with GATs, but I think it's fine. Fine as in, it might create false negatives, but hopefully no false positives.

(The diff is slightly annoying because of formatting things. Really the only thing that changed in the if chain is extracting the `implied_by_def_id` which is needed for getting associated types from the trait, and of course actually checking for overlap)

cc `@Jarcho` ? idk if you want to review this or not. I assume you looked into this code a bit to find this bug.

changelog: [`implied_bounds_in_impls`]: avoid linting when associated type from supertrait can't be constrained through the implying trait bound
2024-02-13 17:05:03 +00:00
bors
3e3a09e2bb Auto merge of #12278 - GabrielBFern:master, r=Jarcho
[`mem_replace_with_default`] No longer triggers on unused expression

changelog:[`mem_replace_with_default`]: No longer triggers on unused expression

Change [`mem_replace_with_default`] to not trigger on unused expression because the lint from `#[must_use]` handle this case better.

fixes: #5586
2024-02-13 04:03:43 +00:00
bors
4350678ec7 Auto merge of #12283 - nyurik:ref-format-args, r=xFrednet
Minor refactor format-args

* Move all linting logic into a single format implementations struct

This should help with the future format-args improvements.

**NOTE TO REVIEWERS**:  use "hide whitespace" in the github diff -- most of the code has shifted, but relatively low number of lines actually modified.

Followig up from #12274

r? `@xFrednet`

---

changelog: none
2024-02-12 22:31:50 +00:00
bors
7dfa6ced9b Auto merge of #12266 - granddaifuku:fix/ice-12253-index-exceeds-usize, r=Manishearth
fix: ICE when array index exceeds usize

fixes #12253

This PR fixes ICE in `indexing_slicing` as it panics when the index of the array exceeds `usize`.

changelog: none
2024-02-12 19:08:14 +00:00
Yuri Astrakhan
2c3ae882e8 Make macro_call a ref 2024-02-12 13:32:32 -05:00
Yuri Astrakhan
7c8690ca97 Minor refactor format-args
* Move all linting logic into a single format implementations struct

This should help with the future format-args improvements.
2024-02-12 13:20:52 -05:00
bors
b0e7640fd7 Auto merge of #12267 - Jarcho:issue_12254, r=Alexendoo
Don't allow derive macros to silence `disallowed_macros`

fixes #12254

The implementation is a bit of a hack, but "works". A derive expanding to another derive won't work properly, but we shouldn't be linting those anyways.

changelog: `disallowed_macros`: Don't allow derive macros to silence their own expansion
2024-02-12 13:19:52 +00:00
Gabriel Fernandes
83555914ed [mem_replace_with_default] No longer triggers on unused expression 2024-02-11 21:11:13 -03:00
bors
75f57cf4c2 Auto merge of #12248 - GuillaumeGomez:extend-NONMINIMAL_BOOL, r=blyxyas
Extend `NONMINIMAL_BOOL` lint

Fixes #5794.

r? `@blyxyas`

changelog: Extend `NONMINIMAL_BOOL` lint
2024-02-11 23:25:40 +00:00
Guillaume Gomez
5e7c437d41 Extend NONMINIMAL_BOOL to check inverted boolean values 2024-02-11 21:22:33 +01:00
Guillaume Gomez
a18e0a11f7 Extend NONMINIMAL_BOOL lint 2024-02-11 21:22:33 +01:00
y21
92616c0aaa [implied_bounds_in_impls]: avoid linting on overlapping associated types 2024-02-11 20:22:45 +01:00
bors
fff46c1667 Auto merge of #12231 - Alexendoo:y21, r=y21
Add y21 to the review rotation

https://github.com/rust-lang/team/pull/1342

r? `@ghost,` when you're ready to be added to the rotation ``@bors` r+` this `@y21`

changelog: none
2024-02-11 18:20:52 +00:00
bors
d427b70fcf Auto merge of #12274 - nyurik:nit-format-impl, r=xFrednet
Minor refactor format-impls

Move all linting logic into a single format implementations struct

This should help with the future format-args improvements.

TODO: do the same with format_args.rs, perhaps in the same PR

**NOTE TO REVIEWERS**:  use "hide whitespace" in the github diff -- most of the code has shifted, but relatively low number of lines actually modified.

changelog: none
2024-02-11 17:53:31 +00:00
bors
9a253fa68e Auto merge of #12269 - y21:implied_bounds_in_impls_refactor, r=xFrednet
Refactor `implied_bounds_in_impls` lint

Some refactors in `implied_bounds_in_impls` that I wanted to make while working on something else in that file, but I found them "large" enough that I didn't want them in the same PR and instead wanted them reviewed separately (since itd just be distracting).

This just splits up the two phases of "collect all the supertraits from each of the `impl Trait` bounds" and "find those `impl Trait` bounds that are mentioned in one of the previously-collected supertraits" into separate functions. Before, this was all in a single function.

Reviewing it commit by commit might make it easier. I can squash it down later.

changelog: none
2024-02-11 17:41:39 +00:00
bors
9b2021235a Auto merge of #12040 - J-ZhengLi:issue12016, r=y21
stop linting [`blocks_in_conditions`] on `match` with weird attr macro case

should fixes: #12016

---

changelog: [`blocks_in_conditions`] - fix FP on `match` with weird attr macro

This might not be the best solution, as the root cause (i think?) is the `span` of block was incorrectly given by the compiler?

I'm open to better solutions
2024-02-11 13:26:18 +00:00
J-ZhengLi
4cc7b7e092 stop linting [blocks_in_conditions] on match on proc macros 2024-02-12 04:16:11 +08:00
bors
ae38a6753d Auto merge of #12272 - Luk-ESC:master, r=xFrednet
Fix broken URL in `Lint Configuration`

Pretty sure it's meant to be `struct_field_names` and not `struct_variant_names`.

This change is gargantuan!!! review carefully

changelog: none
2024-02-11 13:17:29 +00:00
Lukas Eschbacher
2b89cd4bf6
fix broken URL in Lint Configuration
Signed-off-by: Lukas Eschbacher <eschbacher.lukas@gmail.com>
2024-02-11 13:20:25 +01:00
y21
67bdb0e11c [incompatible_msrv]: allow expressions that come from desugaring 2024-02-11 13:10:57 +01:00
bors
d29f2eebdd Auto merge of #12261 - Jarcho:issue_12257, r=dswij
Don't lint `incompatible_msrv` in test code

fixes #12257

changelog: `incompatible_msrv`: Don't lint in test code
2024-02-11 11:55:28 +00:00
Yuri Astrakhan
a595a2c98b Minor refactor format-impls
* Move all linting logic into a single format implementations struct

This should help with the future format-args improvements.

TODO: do the same with format_args.rs, perhaps in the same PR
2024-02-11 04:22:32 -05:00
y21
a38f44ca93 extract finding implied bound to separate function 2024-02-11 00:33:28 +01:00
y21
d1acbf576e extract supertrait collection to separate function 2024-02-11 00:17:21 +01:00
Jason Newcomb
ac7c6e5417 Don't allow derive macros to silence disallowed_macros for their own call. 2024-02-10 16:10:05 -05:00
granddaifuku
c4d11083d9 fix: ICE when array index exceeds usize 2024-02-11 03:51:26 +09:00
bors
51c89a45d9 Auto merge of #12264 - y21:issue12263, r=Jarcho
[`to_string_trait_impl`]: avoid linting if the impl is a specialization

Fixes #12263

Oh well... https://github.com/rust-lang/rust-clippy/pull/12122#issuecomment-1887765238 🙃

changelog: [`to_string_trait_impl`]: avoid linting if the impl is a specialization
2024-02-10 18:48:02 +00:00
bors
e67b7e02da Auto merge of #12258 - tgross35:similiar-names-update, r=Alexendoo
[`similar_names`]: don't raise if the first character is different

A lot of cases of the "noise" cases of `similar_names` come from two idents with a different first letter, which is easy enough to differentiate visually but causes this lint to be raised.

Do not raise the lint in these cases, as long as the first character does not have a lookalike.

Helps with https://github.com/rust-lang/rust-clippy/issues/10926 (does not fix)

This is per-commit reviewable, the first commit is just refactoring.

changelog: [`similar_names`]: don't raise if the first character is different
2024-02-10 17:17:41 +00:00
y21
b3b9919d1b [to_string_trait_impl]: take specialization into account 2024-02-10 17:37:51 +01:00
Jason Newcomb
9012d55c02 Don't lint incompatible_msrv in test code 2024-02-10 09:35:29 -05:00