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)
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
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
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 `.
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`]
Add new lint: `used_underscore_items`
Closes#13260
---
changelog: new [`used_underscore_items`] lint against using items with a single leading underscore
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
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
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
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 `_`
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