Commit graph

11912 commits

Author SHA1 Message Date
bors
903293b199 Auto merge of #13382 - c410-f3r:blah, r=y21
[`missing_panics_doc`] Fix #13381

Fix #13381

Makes `missing_panics_doc` act like other "panicking" lints (`unwrap_used`, `panic`, etc) in constant environments.

changelog: Ignore `missing_panics_doc` in constant environments
2024-09-17 12:34:00 +00:00
y21
15495ebf42 Look at adjusted types instead of fn signature types in ptr_arg 2024-09-13 18:26:29 +02:00
bors
2b7d80b80a Auto merge of #13377 - vHugoObject:master, r=dswij
fix: Fixed incorrect comment form suggestion for too_long_first_doc_paragraph lint

fixes #13309
changelog: none

Comment form is now a variable and a new test for too_long_first_doc_paragraph was added.
2024-09-13 11:55:46 +00:00
VictorHugoPilled
d66e9addd6 fix: Fixed incorrect comment form suggestion
chore: Ran cargo dev fmt

chore: Fixed spacing

fix: Fixed spacing for comment suggestion

fix: Added new module level test to too_long_first_doc_paragraph

chore: Ran cargo uibless
2024-09-12 23:33:22 +00:00
Samuel Tardieu
6371b308d8 Make it clearer that the suggestion is an alternative one
`needless_pass_by_value` sometimes suggest marking the concerned type as
`Copy`. Adding a `or` before this suggestion makes it clearer that this
is not the second part of the original suggestion, but an alternative one.
2024-09-12 16:32:56 +02:00
bors
e039e72d85 Auto merge of #13386 - alex-semenyuk:no_lint_on_duplicate_reason, r=xFrednet
Not trigger `duplicated_attributes` on duplicate reasons

As at #13355 we shoudn't  trigger `duplicated_attributes` on duplicate reasons attr
changelog: [`duplicated_attributes`]: not trigger `duplicated_attributes` on duplicate reasons
2024-09-12 10:26:14 +00:00
Alexey Semenyuk
7097830a9b Not trigger duplicated_attributes on duplicate reasons 2024-09-12 11:49:16 +05:00
Caio
0905a7786e Fix #13381 2024-09-11 13:58:05 -03:00
bors
131681b4b9 Auto merge of #13369 - samueltardieu:issue-13361, r=y21
Special-case suggestions for null pointers constness cast

This implements the suggestions from #13361. It fits into the existing `ptr_cast_constness` lint, as this is a specialized version. However,

1. I have not modified the lint MSRV, so the documentation for this lint will still show that it applies only from Rust 1.72.0. This is true in the general case, but the lint for null pointers will trigger even before this version as `null()` and `null_mut()` were already present in Rust 1.0 and there is no reason not to apply this lint. I guess this is only a minor documentation issue that can be ignored.
2. I have not covered the `core::ptr::null::<T>().cast_mut()` (could be made into `core::ptr::null_mut::<T>()`) and `cotr::ptr::null_mut::<T>().cast_const()` (could be made into `core::ptr::null::<T>()`) cases. Should they be covered? If they should, here or in a separate PR?

changelog: [`ptr_cast_constness`]: special-case suggestions for null pointers constness cast

Fix #13361
2024-09-11 15:43:48 +00:00
bors
8be0b36687 Auto merge of #13344 - lukaslueg:issue13339, r=Alexendoo
Expand missing_transmute_annotations docs

Fixes #13339

changelog: [`missing_transmute_annotations `]: Expand docs, raison d'être
2024-09-11 12:07:13 +00:00
Alexey Semenyuk
49a501856d Fix WHILE_LET_LOOP doc 2024-09-11 12:40:20 +05:00
cuishuang
b0db9c285d Remove unnecessary symbols and add missing symbols
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-09 21:48:12 +08:00
Samuel Tardieu
30608732c2 Handle null pointer constness cast through methods
This covers two cases:

- `core::ptr::null::<T>().cast_mut()` -> `core::ptr::null_mut::<T>()`
- `core::ptr::null_mut::<T>().cast_const()` -> `core::ptr::null::<T>()`
2024-09-09 10:18:31 +02:00
Samuel Tardieu
9e9526c6ab Special-case suggestions for null pointers constness cast 2024-09-09 10:18:31 +02:00
bors
0ee2650e07 Auto merge of #13370 - jtherrmann:master, r=dswij
Fix possible typo in `ptr_arg` lint

This fixes a possible typo in the [`ptr_arg`](https://rust-lang.github.io/rust-clippy/master/index.html#/ptr_arg) lint. I'm new to Rust, so apologies if I misunderstood the meaning of this lint.

changelog: [`ptr_arg`]: Fix typo ("size" -> "type")
2024-09-08 15:11:09 +00: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
Jake Herrmann
25efc04ea5
Fix typo 2024-09-07 12:00:34 -08: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
bed44418ec refactored the code 2024-09-07 13:21:14 +05:30
Samarth1696
0f99aa992e all tests passed 2024-09-07 13:21:14 +05:30
Samarth1696
6f01273d5d dogfood test 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
bors
fb9913ef3b Auto merge of #13327 - Sour1emon:master, r=llogiq
Add new lint `manual_is_power_of_two`

Suggest using `is_power_of_two()` instead of the manual implementations for some basic cases

Part of https://github.com/rust-lang/rust-clippy/issues/12894

----

changelog: new [`manual_is_power_of_two`] lint
2024-09-06 10:36:57 +00:00
bors
7d7b298a4e Auto merge of #13352 - kpreid:patch-1, r=xFrednet
Correct version of `too_long_first_doc_paragraph`

`too_long_first_doc_paragraph` is, empirically, not in the Rust 1.81.0 release.

changelog: [`too_long_first_doc_paragraph`]: correct Rust version number in documentation.
2024-09-06 07:16:18 +00:00
Sour1emon
f994797e46 Add support for different orders of expression 2024-09-05 18:38:12 -07:00
Isaac Bess
6ecb48f6d0 Fixed extra backtick
Co-authored-by: Ruby Lazuli <general@patchmixolydic.com>
2024-09-05 18:38:12 -07:00
Isaac Bess
5515566829 Improve "Why this is bad" section
Co-authored-by: Ruby Lazuli <general@patchmixolydic.com>
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
Kevin Reid
79081f1271
Correct version of too_long_first_doc_paragraph
`too_long_first_doc_paragraph` is, empirically, not in the Rust 1.81.0 release.
2024-09-05 14:30:27 -07:00
Philipp Krones
40fca8f7a8
Bump Clippy version -> 0.1.83 2024-09-05 17:00:55 +02:00
Philipp Krones
87ce1d8069
Merge remote-tracking branch 'upstream/master' into rustup 2024-09-05 17:00:37 +02:00
bors
c95c767663 Auto merge of #13323 - xFrednet:chnagelog-1-81, r=flip1995
Changelog for Clippy 1.81 🔰

Roses are red,
Violets are blue,
Expectations are stable,
And reasons are set

---

### The cat of this release is *Keepy* submitted by `@blyxyas:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/73757586/902dd802-5ac8-471e-bb93-e195526ba580" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-09-05 09:17:12 +00:00
Alex Macleod
f7f550561e Only lint manual_non_exhaustive for exported types 2024-09-04 21:22:28 +00:00
Lukas Lueg
7d2e6ebcbe Expand missing_transmute_annotations docs
Fixes #13339
2024-09-04 19:37:59 +02:00
bors
58cbf09e86 Auto merge of #13332 - nyurik:nits, r=xFrednet
Minor code simplification

changelog: none
2024-09-03 20:47:48 +00:00
bors
f2ef26d239 Auto merge of #13263 - y21:warn_manual_c_str_literals, r=Centri3
move `manual_c_str_literals` to complexity

IMO the suggestion to use `c""` literals over a hardcoded `\0` byte string literal has some fairly strong upsides (no need to manually null-terminate it and the compiler checks for intermediary null bytes) that this should just be enabled by default.

It's also written slightly conservatively to only emit a warning when we can be reasonably confident that the lint is *actually* applicable (that is, lint on e.g. `b"foo\0".as_ptr()` but not `b"foo\0"`. The latter looks like a c-string but its type is `&[u8; _]`, and if it's used in a context where a byte slice is needed then you have no nice way to convert to it from a `c"foo"` literal of type `&CStr`).

changelog: move [`manual_c_str_literals`] to complexity (now warn-by-default)
2024-09-03 18:29:20 +00:00
Soveu
273b561609 add pointers_in_nomem_asm_block lint 2024-09-03 18:58:05 +02:00
Yuri Astrakhan
cd28176025 Minor code simplification 2024-09-01 20:58:14 -04:00
bors
a81f1c8277 Auto merge of #13325 - alex-semenyuk:wrong_self_convention_doc_fix, r=y21
Provide more clear example for `WRONG_SELF_CONVENTION`

Provide more clear example for `WRONG_SELF_CONVENTION`

changelog: none
2024-09-01 08:28:00 +00:00
alexey semenyuk
989ebae2ba Provide more clear example for WRONG_SELF_CONVENTION 2024-08-31 23:06:03 +05: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
Guillaume Gomez
2832faf895 Move MSRV check later in implicit_saturating_sub 2024-08-31 16:24:17 +02:00
Guillaume Gomez
e845366c82 Add MSRV check for saturating_sub lints in const contexts 2024-08-31 16:24:17 +02:00
WeiTheShinobi
04d70d04fc
[single_match, single_match_else] fix suggestion when match irrefutable 2024-08-31 05:25:59 +08:00