Commit Graph

20558 Commits

Author SHA1 Message Date
Jason Newcomb
8a4c34a5b7 Start removing snippet_opt 2024-08-21 12:25:10 -04:00
bors
a83146aea9 Auto merge of #13295 - waywardmonkeys:fix-2-typos, r=xFrednet
Fix a couple of typos.

changelog: none
2024-08-21 14:54:43 +00:00
Bruce Mitchener
3f97261fba Fix a couple of typos. 2024-08-21 21:42:57 +07:00
bors
e5a1ef0795 Auto merge of #13290 - Jarcho:interior_mut_quick, r=Alexendoo
`declare_interior_mutable_const`: Ignore pointer types.

fixes #12951
fixes #13233

changelog: `declare_interior_mutable_const`: Ignore pointer types.
2024-08-20 18:04:47 +00:00
Jason Newcomb
687d4e3d16 declare_interior_mutable_const: Ignore pointer types. 2024-08-20 12:01:24 -04:00
bors
70650de720 Auto merge of #13241 - alex-semenyuk:fix_double_must_use, r=xFrednet
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]
2024-08-20 15:58:30 +00:00
bors
2c0f318991 Auto merge of #13289 - mrnossiom:master, r=y21
fix typo in cfg_not_test lint description

Found this typo while looking at Clippy lints

changelog: none
2024-08-20 10:20:00 +00:00
Milo Moisson
fc8a025f17
fix(cfg_not_test): lint description typo 2024-08-20 12:10:32 +02:00
bors
d0e637da19 Auto merge of #13281 - alex-semenyuk:string_slice_fix, r=y21
Trigger [`string_slice`] if expression is reference to `&str`

Close #12708
changelog: [`string_slice`]: trigger lint if expression is reference to `&str`
2024-08-19 20:12:36 +00:00
bors
e7d9fcf8b2 Auto merge of #13288 - kyoto7250:fix-13184, r=y21
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
2024-08-19 20:03:46 +00:00
Alexey Semenyuk
7b7cf440cb string_slice should detect on Cow 2024-08-19 23:25:45 +05:00
bors
ba6bc81277 Auto merge of #13278 - Alexendoo:misc-cleanup, r=y21
Misc cleanup

changelog: none
2024-08-19 17:42:25 +00:00
kyoto7250
1958e1acd4 fix false position in explicit_iter_loop with msrv 2024-08-20 01:51:32 +09:00
bors
45720b7aa1 Auto merge of #13284 - sobolevn:issue-13283, r=y21
Improve `collapsible_match` error message syntax

fixes #13283

changelog: none
2024-08-18 20:07:17 +00:00
sobolevn
4e6fc6fa05
Improve collapsible_match error message syntax 2024-08-18 19:40:56 +03:00
bors
bfe7f070bd Auto merge of #13248 - Alexendoo:format-arg-ast-fallback, r=xFrednet
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
2024-08-18 09:11:03 +00:00
bors
233b5f2083 Auto merge of #13273 - alex-semenyuk:assigning_clones_disable_for_test, r=blyxyas
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
2024-08-18 02:15:36 +00:00
Alex Macleod
6993752607 Replace some iteration with get_[type_]diagnostic_name 2024-08-17 18:52:55 +00:00
Alex Macleod
9aa656df9f Remove redundant doc comments 2024-08-17 18:44:26 +00:00
Alex Macleod
ed46141081 Remove duplicate type_diagnostic_name function 2024-08-17 18:10:46 +00:00
Alex Macleod
4f661302c6 Replace span_suggestion_with_style with _verbose 2024-08-17 18:09:28 +00:00
bors
68b222ebd9 Auto merge of #13274 - Alexendoo:from-str-radix-10-docs, r=xFrednet
Fix code snippet in from_str_radix_10 docs

`<expression>` was being treated as an opening HTML tag

changelog: none
2024-08-16 20:27:10 +00:00
Alex Macleod
c0373616d0 Fix code snippet in from_str_radix_10 docs 2024-08-16 15:28:42 +00:00
Alexey Semenyuk
953c7ed41e Disable assigning_clones for tests 2024-08-16 16:21:03 +05:00
bors
5da97d006e Auto merge of #13272 - flip1995:vacation, r=flip1995
flip1995: 2 week vacation

r? `@ghost`
changelog: none
2024-08-15 19:11:20 +00:00
Philipp Krones
f3e00339a7
flip1995: 2 week vacation 2024-08-15 21:09:17 +02:00
bors
73819440ea Auto merge of #13193 - alex-semenyuk:fix_doc_unused_io_amount, r=xFrednet
Fix doc example for UNUSED_IO_AMOUNT

Cosmetic changes. Unify example for UNUSED_IO_AMOUNT

changelog: none
2024-08-14 08:17:18 +00:00
bors
70457f637d Auto merge of #13253 - alex-semenyuk:fix_message_unnecessary_unwrap, r=llogiq
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
2024-08-13 23:50:05 +00:00
bors
84e98eb9da Auto merge of #13265 - antonilol:lint-source-location, r=Alexendoo
Fix lint source location github link (missing a letter 'L')

Links to github ('View Source') were broken by [pull request 13221](https://github.com/rust-lang/rust-clippy/pull/13221/files#diff-dcd0f8da3873f35e9777182474a9d0f287f478c0c02650a1d3fefffe1c8c1d30R159).

also fixed some indentation in docs

changelog: none
2024-08-13 12:01:12 +00:00
Antoni Spaanderman
819fa6f180
fix source location github link 2024-08-13 13:13:31 +02:00
Antoni Spaanderman
5fee840875
fix indentation in docs 2024-08-13 13:13:02 +02:00
bors
61a252f182 Auto merge of #13221 - Alexendoo:farewell-metadata-collector, r=xFrednet
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
2024-08-13 09:36:58 +00:00
Alex Macleod
a22ce2d005 Remove HashSets from Conf 2024-08-12 20:24:47 +00:00
Alex Macleod
182cd5f278 Replace the metadata collector with tests 2024-08-12 20:24:46 +00:00
bors
8827107526 Auto merge of #13230 - kyoto7250:fix_issue_13099, r=flip1995
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`
2024-08-12 19:49:45 +00:00
bors
e07078482b Auto merge of #13261 - antonilol:fix-doc-code-blocks, r=xFrednet
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
2024-08-12 19:14:50 +00:00
bors
1984752623 Auto merge of #13255 - Jarcho:get_src_display2, r=Manishearth
Remove more `snippet_opt` calls

First commit is the same as #13244

changelog: none
2024-08-12 18:50:19 +00:00
Antoni Spaanderman
d7f1252ddf
fix code blocks in doc comments inconsistently using 3 or 4 spaces of indentation 2024-08-12 18:42:13 +02:00
bors
52192aa321 Auto merge of #13243 - Alexendoo:rustcversion, r=flip1995
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
2024-08-12 08:24:00 +00:00
Jason Newcomb
ddf2ba5886 Remove more instances of snippet_opt. 2024-08-11 18:07:53 -04:00
bors
c7c8724897 Auto merge of #13187 - GuillaumeGomez:settings-menu, r=Alexendoo
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
2024-08-11 18:42:37 +00:00
Guillaume Gomez
2ae6a4954b Move themes directly into HTML 2024-08-11 19:44:18 +02:00
Guillaume Gomez
934e98d591 Unify theme and settings menus 2024-08-11 19:39:19 +02:00
Alexey Semenyuk
f93fb9a417 Clarify message for unwrap lint 2024-08-11 20:33:28 +05:00
bors
94099f48c9 Auto merge of #13250 - Alexendoo:lintcheck-diff-key, r=xFrednet
lintcheck: key lints on line start rather than byte start/end

Before: https://github.com/rust-lang/rust-clippy/actions/runs/10305798317
After: https://github.com/Alexendoo/rust-clippy/actions/runs/10333749860

If a single lint emits e.g. twice on the same line and the messages change for both there would still be two changed entries

Also slightly changes the output, the URL is no longer visible

r? `@xFrednet`

changelog: none
2024-08-11 09:00:46 +00:00
Alex Macleod
6de27a0272 lintcheck: key lints on line start rather than byte start/end 2024-08-10 19:08:30 +00:00
bors
c8b0923a73 Auto merge of #13163 - GuillaumeGomez:fix-13097, r=Alexendoo
Fix case where doc_markdown is triggered on words ending with "ified"

Fixes #13097.

r? `@Alexendoo`

changelog: Fix case where doc_markdown is triggered on words ending with "ified"
2024-08-10 17:51:56 +00:00
bors
37f98fffe7 Auto merge of #13220 - y21:issue13219, r=dswij
[`macro_metavars_in_unsafe`]: recognize metavariables in tail expressions

Fixes #13219

`macro_metavars_in_unsafe` keeps track of the current "expansion depth" (incremented/decremented when entering/leaving a macro span) to tell if an expression from the root context is contained within a macro (see the doc comment I added for a hopefully better explanation)

Before this PR, we didn't increment said `expn_depth` for `unsafe` blocks within macros, because we already do that in `visit_stmt` anyway, so it would work fine for statements, but that's not enough for tail expressions of an unsafe block.

So we now also increment it for macro unsafe blocks.
Also updated the comment for `expn_depth` while I'm at it because "This is not necessary for correctness" isn't correct now that I think about it

------

changelog: none
2024-08-10 12:43:43 +00:00
Alex Macleod
4231e93bf7 Remove find_format_arg_expr AST fallback 2024-08-10 10:50:47 +00:00
bors
780c61f1ee Auto merge of #13041 - Jarcho:path, r=y21
Refactor `absolute_paths`

Checks are rearranged to do the more expensive checks later. Since the most likely path length will be one (locals and imported/local items) this will exclude such paths on the first check.

Tests were rewritten as they were hard to follow (annotations would have helped), spammy (lots of tests for the same thing) and insufficient.

One thing thing that came up and should be decided on now is what to do about the difference between `path::to::Trait::item` (4 segments) and `path::to::Type::item` (3 segments). The current behaviour treats these as different lengths which is terrible. I personally think these should both be three segments since the item can't actually be imported. Only the type or the trait could be. This makes `crate_name::Trait::item` the shortest absolute path which is shorter than the lint allows by default.

changelog: None
2024-08-10 02:10:12 +00:00