Commit Graph

19054 Commits

Author SHA1 Message Date
teor
8b615af760 Fix clippy_dogfood 2024-02-20 07:51:21 +10:00
teor
e74fe4362a Check for both signed and unsigned constant expressions 2024-02-20 07:51:21 +10:00
teor
c5e8487d63 Fix pow() to return more known signs 2024-02-20 07:51:21 +10:00
teor
47339d01f8 Bless fixed cast_sign_loss false negatives 2024-02-20 07:50:56 +10:00
teor
28f247e16c Use the expanded method lists 2024-02-20 07:45:46 +10:00
teor
e51fcd03dc Make pow_call_result_sign compile 2024-02-20 07:45:46 +10:00
teor
02214f2ac0 Expand method lists 2024-02-20 07:45:46 +10:00
teor
ee8fd82f4c Fix uncertain sign and remainder op handling in cast_sign_loss.rs 2024-02-20 07:45:46 +10:00
bors
6aa5f1ac6f Auto merge of #12314 - Alexendoo:output-conflict-handling, r=flip1995
Default test output conflict handling to error

https://github.com/oli-obk/ui_test/pull/175 got rid of the `bool` that controlled the default handling so we need to specify it ourselves

r? `@flip1995`

changelog: none
2024-02-19 14:30:35 +00:00
Alex Macleod
f67c3f4bd8 Default test output conflict handling to error 2024-02-19 14:20:11 +00:00
bors
fa2a3c5208 Auto merge of #12059 - roife:fix/issue-11223, r=Alexendoo
Fix issue 11223: add check for identical guards in lint `match_same_arms`

fixes #11223

In the current `match_same_arms` implementation, if arms have guards, they are considered different. This commit adds equality checking for guards: arms are now considered equivalent only when they either both have no guards or their guards are identical.

The portion responsible for checking guard equality is refactored to reuse the existing code for checking body equality. This is abstracted into a function called `check_eq_with_pat`. To optimize performance, `check_same_guard` and `check_same_body` here use closures for lazy evaluation, ensuring that the calculation is only performed when `!(backwards_blocking_idxs...)` is true.

changelog: [`match_same_arms`]: Add check for identical guards
2024-02-19 14:03:56 +00:00
roife
087c7c828d Add check for same guards in match_same_arms 2024-02-19 13:49:32 +00:00
bors
74f611f7fc Auto merge of #12306 - Alexendoo:dir-replacement, r=flip1995
Remove `$DIR` replacement

This won't cause problems because the old `$DIR` replacement was based on the parent of the test path, which for us is relative: 5471e0645a/tests/compile-test.rs (L122)

The new pattern being `"tests/{test_dir}"` is more clearly relative

That's why we have custom filters applied to the toml/cargo tests where absolute paths do appear in the output 5471e0645a/tests/compile-test.rs (L198-L202)

Removing it allows clicking the paths in the terminal

changelog: none

r? `@flip1995`
2024-02-19 09:20:07 +00:00
bors
2a3c0334f7 Auto merge of #12313 - alex:patch-1, r=Alexendoo
Upgrade anstream to 0.6.0

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

changelog: none
2024-02-19 00:13:28 +00:00
Alex Gaynor
98e26b3483
Upgrade anstream to 0.6.0 2024-02-18 15:18:21 -05:00
bors
5a50481411 Auto merge of #12309 - Tyrubias:fix-allow-pub-under, r=y21
fix: make `#[allow]` work on field for `pub_underscore_fields`

Closes #12286

changelog: `#[allow(clippy::pub_underscore_fields)]` now works on linted field
2024-02-18 11:58:57 +00:00
Victor Song
d1e8a5956f fix: make #[allow] work on field for pub_underscore_fields
Add test for future regression
2024-02-18 05:33:50 -06:00
Alex Macleod
740d89ee69 Remove $DIR replacement in docs sampling stderr files 2024-02-17 12:34:54 +00:00
Alex Macleod
1d107ab2be Remove $DIR replacement in test output 2024-02-17 12:34:54 +00:00
bors
5471e0645a Auto merge of #12305 - beetrees:asm-syntax, r=Manishearth
Ensure ASM syntax detect `global_asm!` and `asm!` only on x86 architectures

The ASM syntax lint is only relevant on x86 architectures, so this PR ensures it doesn't trigger on other architectures. This PR also makes the lints check `global_asm!` items as well as `asm!` expressions.

changelog: Check `global_asm!` items in the ASM syntax lints, and fix false positives on non-x86 architectures.
2024-02-17 01:54:24 +00:00
beetrees
9b5e4c6d57
Ensure ASM syntax detect global_asm! and asm! only on x86 architectures 2024-02-17 01:45:39 +00:00
bors
ab8880bdf3 Auto merge of #12198 - oli-obk:bump_ui_test, r=Manishearth
Bump ui_test to 0.22

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

changelog: none
2024-02-17 00:43:12 +00:00
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