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
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]
Trigger [`string_slice`] if expression is reference to `&str`
Close#12708
changelog: [`string_slice`]: trigger lint if expression is reference to `&str`
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
Remove `find_format_arg_expr` AST fallback
If the function fails where it shouldn't we can fix that directly, but the fallback path is untested as I'm not aware of a case where it would fail
changelog: none
Disable assigning_clones for tests
Close: #12752
As mentioned at #12752 when a test struct is initialized with some default string, this inverts the order of assignee/assignment and makes a bit harder to read/write code
changelog: [`assigning_clones.rs`]: disable assigning_clones for tests
Use `impl PartialEq<TokenKind> for Token` more.
This lets us compare a `Token` with a `TokenKind`. It's used a lot, but can be used even more, avoiding the need for some `.kind` uses.
r? `@spastorino`
Shrink `TyKind::FnPtr`.
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
r? `@compiler-errors`
Clarify suggestion message for unwrap lint
Close#10217
As mentioned at #10217 message for `unwrap` uses `..` like `Some(..)` which can confuse with slice and other places mostly use `<item>` like `for (i, <item>) in target_groups_json.iter().enumerate().skip(1) {` So replace `..` to `<item>`
changelog: [`unnecessary_unwrap`] clarify suggestion message
Replace the metadata collector with tests
The metadata collector handles 3 files: [`CHANGELOG.md`](c082bc2cb8/CHANGELOG.md (L6050)), [`lint_configuration.md`](c082bc2cb8/book/src/lint_configuration.md) and `util/gh-pages/lints.json`
- `CHANGELOG.md` and `lint_configuration.md` are now checked by `tests/config-metadata.rs`, when they are outdated `cargo test` will fail with a message to run `cargo bless --test config-metadata` in order to update them
A plain `cargo bless` will run all the tests, blessing both this and the UI tests
- `util/gh-pages/lints.json` is now generated when running `cargo uitest` with `COLLECT_METADATA=1` (still aliased to `cargo collect-metadata`)
It uses a `ui_test` [post test action](https://docs.rs/ui_test/latest/ui_test/custom_flags/trait.Flag.html#method.post_test_action) to retrieve the applicability from the actual diagnostics emitted during UI tests
Example change from the current to new JSON:
```diff
{
"id": "chars_next_cmp",
- "id_span": {
- "path": "src/methods/mod.rs",
- "line": 891
- },
+ "id_location": "clippy_lints/src/methods/mod.rs#891",
"group": "style",
"level": "warn",
- "docs": "\n### What it does ... ```",
+ "docs": "### What it does ... ```\n",
"version": "pre 1.29.0",
- "applicability": {
- "is_multi_part_suggestion": false,
- "applicability": "Unresolved"
- }
+ "applicability": "MachineApplicable"
},
```
`Hide whitespace` makes the `compile-test.rs` changes much easier to see
r? `@flip1995`
changelog: none