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
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
Add a test for ice-3717.rs
this PR is a part of https://github.com/rust-lang/rust-clippy/issues/13099.
Based on the changes introduced in #13098 for introduce ui_test, we will update the uitest output.
This is a fix for `ice-3717.rs`.
Although fixes have already been made in #13216, it seems that he is a first-time contributor.
I thought it might be better for him to refer to my PR, so I created it accordingly.
Since this is my first contribution in a while, please let me know if there are any issues or required changes.
changelog: none
r! `@flip1995`
fix code blocks in doc comments inconsistently using 3 or 4 spaces of indentation
The metadata collector script was treating the space lines all start with as indentation. This caused code block's triple backticks to get a space in front of it, like this:
```
```rust
^ this space
```
Code after that that is indented with 4 spaces will only have 3 of those rendered.
Example (taken from [here](https://rust-lang.github.io/rust-clippy/master/index.html#/missing_panics_doc)):
```rust
...
pub fn divide_by(x: i32, y: i32) -> i32 {
if y == 0 { // 3 spaces
panic!("Cannot divide by 0") // 7 spaces
...
```
Also added 'compile_fail' alongside the other rustdoc directives (second code block [here](https://rust-lang.github.io/rust-clippy/master/index.html#/macro_metavars_in_unsafe) had no highlighting), fixed a doc comment using 'rs' instead of 'rust' and removed some spaces causing an extra missing space of indentation (see second code block [here](https://rust-lang.github.io/rust-clippy/master/index.html#/map_err_ignore)).
changelog: none
Replace `rustc_semver` with `rustc_session::RustcVersion`
Allows dropping a dependency but there is a behaviour change here, the following versions are no longer accepted:
* `1` (would need to be `1.0` or `1.0.0`)
* `1.0.0-alpha`
* `1.0.0-alpha.2`
* `1.0.0-beta`
But this seems unlikely to effect anybody, I did some GitHub searching and found no occurrences outside our UI tests
r? `@flip1995`
changelog: none
Add settings menu on clippy lints page
It looks like this (when the menu is expanded):
![Screenshot from 2024-08-06 21-36-41](https://github.com/user-attachments/assets/c464aef3-b21e-48cc-8e3a-c32a134f995e)
Follow-up of https://github.com/rust-lang/rust-clippy/pull/13178.
Someone pointed out that they should be able to disable the shortcuts on this page like it's the case for rustdoc and docs.rs. So here we go.
The first commit moves the style into its own file: it's much better for a web browser because it can then cache it.
The second one actually adds the new settings menu you can see above.
r? `@Alexendoo`
changelog: Add settings menu on clippy lints page