Commit Graph

8963 Commits

Author SHA1 Message Date
cuishuang
b0db9c285d Remove unnecessary symbols and add missing symbols
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-09 21:48:12 +08:00
bors
bcf528bdef Auto merge of #13324 - WeiTheShinobi:single_match, r=dswij
[`single_match`, `single_match_else`] fix suggestion when match irrefutable

fixes #13012

changelog:[`single_match`, `single_match_else`]: fix suggestion when `match` irrefutable
2024-09-08 15:02:35 +00:00
bors
41dc86d4d3 Auto merge of #13214 - apoisternex:issue12907, r=Centri3
Fix [`needless_return`] false negative

Fixes #12907

changelog: Fix [`needless_return`] false negative when returned expression borrows a value.
2024-09-07 21:47:32 +00:00
Samarth1696
af3346a85f Check for get method and new test case in unfixable 2024-09-07 13:21:14 +05:30
Samarth1696
d43acb803f Added checks for binary expr and added different test cases for unfixable cases 2024-09-07 13:21:14 +05:30
Samarth1696
c6c74083a8 error notations added 2024-09-07 13:21:14 +05:30
Samarth1696
0f99aa992e all tests passed 2024-09-07 13:21:14 +05:30
Samarth1696
73039f654e test cases added including some edge cases 2024-09-07 13:21:14 +05:30
Samarth1696
46f8d360de Lint ready 2024-09-07 13:21:09 +05:30
WeiTheShinobi
e3ca249e96
fix single_match suggestion 2024-09-06 23:10:42 +08:00
Sour1emon
f994797e46 Add support for different orders of expression 2024-09-05 18:38:12 -07:00
Sour1emon
d7996da9da Add manual_is_power_of_two 2024-09-05 18:38:06 -07:00
Artem Belyakov
9415e6e6eb Add manual_div_ceil 2024-09-06 00:55:42 +02:00
bors
c41be9e125 Auto merge of #13345 - Alexendoo:manual-non-exhaustive-visibility, r=y21
Only lint `manual_non_exhaustive` for exported types

For types that are not exported the attribute doesn't make a difference, but the manual pattern can still be used to achieve module level non exhaustiveness

Fixes https://github.com/rust-lang/rust-clippy/issues/10301
Fixes https://github.com/rust-lang/rust-clippy/issues/12106

changelog: none
2024-09-05 21:52:42 +00:00
Philipp Krones
87ce1d8069
Merge remote-tracking branch 'upstream/master' into rustup 2024-09-05 17:00:37 +02:00
Alex Macleod
f7f550561e Only lint manual_non_exhaustive for exported types 2024-09-04 21:22:28 +00:00
Soveu
273b561609 add pointers_in_nomem_asm_block lint 2024-09-03 18:58:05 +02:00
bors
ac914d3457 Auto merge of #12476 - GuillaumeGomez:add-manual_arithmetic_check, r=y21
Extend `implicit_saturating_sub` lint

Fixes #10070.

It can serve as base if we want to add equivalent checks for other arithmetic operations.

Also one important note: when writing this lint, I realized that I could check for wrong conditions performed beforehand on subtraction and added another part in the lint. Considering they both rely on the same checks, I kept both in the same place. Not sure if it makes sense though...

changelog: Extend `implicit_saturating_sub` lint
2024-08-31 16:03:42 +00:00
Pavel Grigorenko
9957101f3a elided_named_lifetimes: bless & add tests 2024-08-31 15:35:42 +03:00
WeiTheShinobi
04d70d04fc
[single_match, single_match_else] fix suggestion when match irrefutable 2024-08-31 05:25:59 +08:00
Guillaume Gomez
d20fc38f0a Create new inverted_saturating_sub lint 2024-08-29 20:20:13 +02:00
Guillaume Gomez
27c6343365 Add ui test to ensure that if 0 is returned from both if and else, it will not break clippy 2024-08-29 20:20:13 +02:00
Guillaume Gomez
2622a87587 Add ui regression tests for implicit_saturation_sub lint extension 2024-08-29 20:20:13 +02:00
bors
04bded5d6e Auto merge of #13235 - kyoto7250:fix_issue_13191, r=llogiq
Use `is_diagnostic_item` for checking a def_id in `unnecessary_min_or_max`.

close #13191
This PR fixes the false positives in `unnecessary_min_or_max `.
We should use `is_diagnostic_item` for checking def_ids in this lint.

----

changelog: fix false positive in `unnecessary_min_or_max `.
2024-08-28 14:50:20 +00:00
y21
e8ac4ea418 new lint: zombie_processes 2024-08-27 21:51:02 +02:00
bors
603d5a19c9 Auto merge of #13294 - WeiTheShinobi:new_lint_used_underscore_items, r=llogiq
Add new lint: `used_underscore_items`

Closes #13260

---

changelog: new [`used_underscore_items`] lint against using items with a single leading underscore
2024-08-27 10:59:31 +00:00
bors
f194e684b1 Auto merge of #13311 - alex-semenyuk:fix_manual_range_patterns, r=Manishearth
Fix manual_range_patterns case with one element at OR

Close #11825
As mentioned #11825 `OR` can be used for stylistic purposes with one element, we can filter this case from triggering lint

changelog: [`manual_range_patterns`]: not trigger when `OR` has only one element
2024-08-26 21:10:54 +00:00
Alexey Semenyuk
494112e51f Fix manual_range_patterns case with one element at OR 2024-08-27 01:32:07 +05:00
bors
b3fc578ca6 Auto merge of #13300 - kyoto7250:issue_13292, r=llogiq
check std::panic::panic_any in panic lint

close #13292
This PR detects `std::panic::panic_any` in panic lint.

changelog: check std::panic::panic_any in panic lint
2024-08-26 19:32:11 +00:00
bors
ebcd6bc785 Auto merge of #13091 - Alexendoo:empty-line-after-rewrite, r=dswij
Rewrite `empty_line_after_doc_comments` and `empty_line_after_outer_attr`, move them from `nursery` to `suspicious`

changelog: [`empty_line_after_doc_comments`], [`empty_line_after_outer_attr`]: rewrite and move them from `nursery` to `suspicious`

They now lint when there's a comment between the last attr/doc comment and the empty line, to cover the case:

```rust
/// Docs for `old_code
// fn old_code() {}

fn new_code() {}
```

When these lints or `suspicious_doc_comments` trigger we no longer trigger any other doc lint as a broad fix for #12917, reverts some of #13002 as the empty line lints cover it

I ended up not doing https://github.com/rust-lang/rust-clippy/issues/12917#issuecomment-2161828859 as I don't think it's needed
2024-08-25 17:47:09 +00:00
bors
083e20a6dc Auto merge of #13113 - nyurik:ignore-pass-by-val-for-pfx, r=blyxyas
Ignore underscore-prefixed args for needless_pass_by_value lint

When a user explicitly tags a param as unused (yet?), there is no need to raise another lint on it.

fixes #7295

Note that I had to rename all `_*` params in the tests, but kept the variable name length to avoid extra changes in the expected output.

changelog: [`needless_pass_by_value`]: do not warn if the argument name starts with an `_`
2024-08-25 17:28:51 +00:00
WeiTheShinobi
d40e04a1cb
used_underscore_items will not lint exteranl item 2024-08-26 00:52:52 +08:00
bors
508a7b4b38 Auto merge of #129531 - Jarcho:clippyup, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-08-25 11:56:57 +00:00
bors
40bca0d944 Auto merge of #13285 - alex-semenyuk:ignore_todo_for_diverging_sub_expression, r=xFrednet
Diverging subexpression lint should not fire on todo!()

As per #10243  it is not that helpful to point out that a subexpression diverges, so do not fire on todo

changelog: [`diverging_sub_expression`]: do not trigger on todo
2024-08-25 09:51:40 +00:00
Jason Newcomb
173d5a6af0 Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyup 2024-08-24 18:33:44 -04:00
Jason Newcomb
e348fe2233 Merge branch 'master' into rustup 2024-08-24 16:31:01 -04:00
Alex Macleod
3474df6a8e Rewrite empty_line_after_doc_comments and empty_line_after_outer_attr 2024-08-24 18:07:31 +00:00
kyoto7250
b179c3e7f7 check std::panic::panic_any in panic lint 2024-08-25 00:56:02 +09:00
bors
30e0b69908 Auto merge of #12993 - GuillaumeGomez:too_long_first_doc_paragraph, r=Centri3
Add new `too_long_first_doc_paragraph` first paragraph lint

Fixes https://github.com/rust-lang/rust-clippy/issues/12989.

changelog: Add new `too_long_first_doc_paragraph` first paragraph lint
2024-08-24 15:23:34 +00:00
Alexey Semenyuk
f4fc3858bc Fix suggestion unwrap_or_else 2024-08-24 15:43:00 +05:00
Ralf Jung
89ad7334e0 stabilize const_fn_floating_point_arithmetic 2024-08-22 08:25:54 +02:00
WeiTheShinobi
b615c82180
Add new lint: used_underscore_items 2024-08-21 19:57:41 +08:00
bors
e5a1ef0795 Auto merge of #13290 - Jarcho:interior_mut_quick, r=Alexendoo
`declare_interior_mutable_const`: Ignore pointer types.

fixes #12951
fixes #13233

changelog: `declare_interior_mutable_const`: Ignore pointer types.
2024-08-20 18:04:47 +00:00
Jason Newcomb
687d4e3d16 declare_interior_mutable_const: Ignore pointer types. 2024-08-20 12:01:24 -04:00
bors
70650de720 Auto merge of #13241 - alex-semenyuk:fix_double_must_use, r=xFrednet
Fix confusing message in double_must_use lint

Close #13003
As mentioned at #13003 it isn't quite clear what it means "an empty `#[must_use]` attribute" so clarify it

changelog: [none]
2024-08-20 15:58:30 +00:00
bors
d0e637da19 Auto merge of #13281 - alex-semenyuk:string_slice_fix, r=y21
Trigger [`string_slice`] if expression is reference to `&str`

Close #12708
changelog: [`string_slice`]: trigger lint if expression is reference to `&str`
2024-08-19 20:12:36 +00:00
bors
e7d9fcf8b2 Auto merge of #13288 - kyoto7250:fix-13184, r=y21
fix false positive in explicit_iter_loop with msrv

close #13184

This PR fix false positive in explicit_iter_loop when msrv < 1.80

changelog: fix false positive in explicit_iter_loop when msrv < 1.80
2024-08-19 20:03:46 +00:00
Alexey Semenyuk
7b7cf440cb string_slice should detect on Cow 2024-08-19 23:25:45 +05:00
kyoto7250
1958e1acd4 fix false position in explicit_iter_loop with msrv 2024-08-20 01:51:32 +09:00
Alexey Semenyuk
9732128e83 Diverging subexpression lint should not fire on todo!() 2024-08-18 22:05:57 +05:00