Commit graph

20666 commits

Author SHA1 Message Date
bors
1e797e9a38 Auto merge of #13374 - cuishuang:master, r=Centri3
Remove unnecessary symbols and add missing symbols

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

changelog: Remove unnecessary symbols and add missing symbols
2024-09-09 22:13:58 +00: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
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
bors
d9c4523e6c Auto merge of #13167 - Samarth1696:tests, r=llogiq
Added new `non_zero_suggestions` lint

Created lint based on the suggestions in #7291

- \[x] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

----

changelog: new [`non_zero_suggestions`] lint
2024-09-07 11:21:35 +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
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
bors
9e9042a110 Auto merge of #12987 - belyakov-am:lint/manual_div_ceil, r=blyxyas
[`manual_div_ceil`]: init

Suggest using `div_ceil()` instead of manual implementation for basic cases.

Partially fixes #12894

changelog: new lint: [`manual_div_ceil`]
2024-09-05 23:16:29 +00: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
bors
a95afe2d0a Auto merge of #13347 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-09-05 15:04:11 +00:00
Philipp Krones
3d027d75af
Bump nightly version -> 2024-09-05 2024-09-05 17:01:08 +02: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
bors
aec61c4a6e Auto merge of #13343 - flip1995:aftifacts-action-update, r=flip1995
Bump actions/download-artifact from 3 to 4

r? `@ghost`

changelog: none
2024-09-04 16:31:41 +00:00
Philipp Krones
cdb442362b
Bump actions/download-artifact from 3 to 4 2024-09-04 18:28:38 +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
bors
e8ba5d1f71 Auto merge of #13247 - Soveu:sus-asm-options, r=y21
Add new check for passing pointers to an `asm!` block with `nomem` option

changelog: Add new check for passing pointers to an `asm!` block with `nomem` option

Continuing work from https://github.com/rust-lang/rust/pull/127063
2024-09-03 17:31: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
Matthias Krüger
663f20086a Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillot
Lint that warns when an elided lifetime ends up being a named lifetime

As suggested in https://github.com/rust-lang/rust/issues/48686#issuecomment-1817334575

Fixes #48686
2024-09-01 03:58:03 +02: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
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
Fridtjof Stoldt
cbc6910c35
Changelog: Correct lint level
Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
2024-08-29 22:15:18 +02:00
xFrednet
9aa23b8317
Changelog for Clippy 1.81 🔰 2024-08-29 21:54:05 +02:00
xFrednet
9e7473f08d
Update version attribute for 1.81 lints 2024-08-29 21:36:43 +02:00