Commit graph

20787 commits

Author SHA1 Message Date
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
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
Ralf Jung
ba2577f23c stabilize const_float_bits_conv 2024-09-01 12:38:59 +02: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
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
Guillaume Gomez
74a2344dc1 Extend implicit_saturation_sub lint 2024-08-29 20:20:13 +02:00
bors
b86a202c92 Auto merge of #13246 - xFrednet:12292-remove-cargo-clippy-feature, r=flip1995
Remove `feature=cargo-clippy` argument

Roses are red,
Violets are blue,
Fixme was written,
And now it's due

---

changelog: **Important Change** Removed the implicit `cargo-clippy` feature set by Clippy as announced here: <https://blog.rust-lang.org/2024/02/28/Clippy-deprecating-feature-cargo-clippy.html>
[#13246](https://github.com/rust-lang/rust-clippy/pull/13246)

Follow-up of: rust-lang/rust-clippy#12292

r? `@flip1995`

cc: `@GuillaumeGomez`
2024-08-29 11:57:23 +00:00
Michael Goulet
5bbb0d41f1 Stop using ty::GenericPredicates for non-predicates_of queries 2024-08-29 00:17:40 -04: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
bors
9e260fffe1 Auto merge of #11476 - y21:zombie_processes, r=xFrednet
new lint: `zombie_processes`

Closes #10754

Lint description should explain this PR, so I think there's nothing else to say here ^^

changelog: new lint: [`zombie_processes`]
2024-08-28 07:18:49 +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
bors
0f8eabd623 Auto merge of #13302 - Jarcho:rustup, r=Jarcho
Rustup

r? ghost

changelog: none
2024-08-24 20:47:33 +00:00
Jason Newcomb
0196e2d1dc Bump nightly version -> 2024-08-23 2024-08-24 16:31:55 -04:00
Jason Newcomb
e348fe2233 Merge branch 'master' into rustup 2024-08-24 16:31:01 -04:00
Matthias Krüger
8b8a3c91af Rollup merge of #129510 - GrigorenkoPV:fix-elided-named-lifetimes, r=cjgillot
Fix `elided_named_lifetimes` in code

https://github.com/rust-lang/rust/pull/129207#issuecomment-2308428671

r? cjgillot
2024-08-24 22:14:15 +02:00
Alex Macleod
3474df6a8e Rewrite empty_line_after_doc_comments and empty_line_after_outer_attr 2024-08-24 18:07:31 +00:00
Pavel Grigorenko
3c4367a80f Fix elided_named_lifetimes in code 2024-08-24 19:21:32 +03: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
bors
497177fa50 Auto merge of #13296 - Jarcho:get_src_display3, r=Alexendoo
Replace more uses of `snippet_opt`.

Almost all calls are removed after this.

changelog: none
2024-08-24 12:42:32 +00:00
bors
301f2c46cd Auto merge of #13299 - alex-semenyuk:unwrap_or_else_suggestion, r=Alexendoo
Fix suggestion unnecessary_lazy_eval

As mentioned at #13293 improve suggestion via span_suggestion_verbose

changelog: none
2024-08-24 12:29:08 +00:00