Commit graph

20841 commits

Author SHA1 Message Date
kyoto7250
b179c3e7f7 check std::panic::panic_any in panic lint 2024-08-25 00:56:02 +09: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
Ralf Jung
89ad7334e0 stabilize const_fn_floating_point_arithmetic 2024-08-22 08:25:54 +02: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
WeiTheShinobi
b615c82180
Add new lint: used_underscore_items 2024-08-21 19:57:41 +08: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
Ralf Jung
43e1145c80 rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
Alexey Semenyuk
9732128e83 Diverging subexpression lint should not fire on todo!() 2024-08-18 22:05:57 +05: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
Matthias Krüger
dde0dca695 Rollup merge of #129065 - nnethercote:PartialEq-TokenKind, r=spastorino
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`
2024-08-15 19:32:35 +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
Nicholas Nethercote
f72b3dbba2 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.
2024-08-14 16:37:09 +10:00
bors
6d08b08927 Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errors
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`
2024-08-14 00:56:53 +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
y21
a5e3a3f9b6 move manual_c_str_literals to complexity 2024-08-12 22:54:20 +02: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