Commit Graph

20570 Commits

Author SHA1 Message Date
Alex Macleod
3474df6a8e Rewrite empty_line_after_doc_comments and empty_line_after_outer_attr 2024-08-24 18:07:31 +00: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
Alexey Semenyuk
f4fc3858bc Fix suggestion unwrap_or_else 2024-08-24 15:43:00 +05:00
Jason Newcomb
9450b4af48 Replace more uses of snippet_opt. 2024-08-21 14:41:18 -04:00
bors
ecfc7d906f Auto merge of #13244 - Jarcho:get_src_display, r=Alexendoo
Start removing `snippet_opt` in favor of `get_source_text`

Continuing the job of removing unnecessary allocations.

changelog: none
2024-08-21 17:08:49 +00:00
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
Guillaume Gomez
a2033428c4 Do not emit TOO_LONG_FIRST_DOC_PARAGRAPH lint if item is generated from proc-macro and simplify code to emit lint 2024-08-18 14:14:00 +02: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