Commit graph

20787 commits

Author SHA1 Message Date
bors
2c5e600386 Auto merge of #13392 - alex-semenyuk:doc_type_complexity, r=dswij
Clarify example for `type_complexity`

As mentioned #13387 it's not clear how to fix issue with complexity so add example for this

changelog: none
2024-09-22 11:51:07 +00:00
bors
0e1ded0f8d Auto merge of #13384 - Alexendoo:remove-old-collect-metadata, r=llogiq
Remove unused `collect_metadata` function

Leftover from #13221

changelog: none
2024-09-21 07:22:44 +00:00
Ben Kimock
249210e8d8 Fix clippy 2024-09-21 01:07:00 -04:00
Ruairidh Williamson
739ef7bf0d
Add unused_trait_names tests 2024-09-21 00:57:47 +01:00
Ruairidh Williamson
05ebce8e1a
Add lint unused_trait_names 2024-09-21 00:56:38 +01:00
bors
bb04c68b2e Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
Disallow hidden references to mutable static

Closes #123060

Tracking:
- https://github.com/rust-lang/rust/issues/123758
2024-09-20 17:25:34 +00:00
GnomedDev
4f319002cd [Clippy] Remove final std paths for diagnostic item 2024-09-20 10:39:31 +01:00
bors
9be28b1439 Auto merge of #13421 - lukaslueg:issue11212, r=Manishearth
Initial impl of `unnecessary_first_then_check`

Fixes #11212

Checks for `{slice/vec/Box<[]>}.first().is_some()` and suggests replacing the unnecessary `Option`-construct with a direct `{slice/...}.is_empty()`. Other lints guide constructs like `if let Some(_) = v.get(0)` into this, which end up as `!v.is_empty()`.

changelog: [`unnecessary_first_then_check`]: Initial implementation
2024-09-19 22:24:46 +00:00
bors
2e5b6801ff Auto merge of #13414 - Alexendoo:generate-versions-html, r=
Generate versions HTML directly

Generates the page at https://rust-lang.github.io/rust-clippy/ directly rather than creating a JSON file to load

Also fixes https://github.com/rust-lang/rust-clippy/issues/13413

r? `@flip1995`

changelog: none
2024-09-19 19:46:09 +00:00
Lukas Lueg
290a01e448 Initial impl of unnecessary_first_then_check
Fixes #11212
2024-09-19 21:27:39 +02:00
GnomedDev
07b6e0713e Categorise paths in clippy_utils::paths 2024-09-19 13:13:43 +01:00
GnomedDev
c7453b4280 [Clippy] Swap open_options to use diagnostic items instead of paths 2024-09-19 13:13:43 +01:00
GnomedDev
917775fff1 [Clippy] Swap iter_over_hash_type to use diagnostic items instead of paths 2024-09-19 13:13:43 +01:00
GnomedDev
37e38320b4 [Clippy] Swap non_octal_unix_permissions to use diagnostic item instead of path 2024-09-19 13:13:43 +01:00
GnomedDev
f1fc9c07c4 [Clippy] Swap unnecessary_owned_empty_strings to use diagnostic item instead of path 2024-09-19 13:13:43 +01:00
GnomedDev
1b76ae683c [Clippy] Swap manual_strip to use diagnostic items instead of paths 2024-09-19 13:13:43 +01:00
GnomedDev
acb6748f80 [Clippy] Swap unnecessary_to_owned to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
98dc68e85e [Clippy] Swap instant_subtraction to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
d63e35ba22 [Clippy] Swap waker_clone_wake to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
45c1700e13 [Clippy] Swap filter_map_bool_then to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
b0152909d6 [Clippy] Swap manual_while_let_some to use diagnostic items instead of paths 2024-09-19 13:13:42 +01:00
GnomedDev
984bd6fed6 [Clippy] Swap repeat_vec_with_capacity to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
545967955a [Clippy] Swap VecArgs::hir to use diagnostic items instead of paths 2024-09-19 13:13:40 +01:00
GnomedDev
f66915e8f8 [Clippy] Swap single_char_add_str/format_push_string to use diagnostic items instead of paths 2024-09-19 13:13:20 +01:00
GnomedDev
959f7a2bbb [Clippy] Swap manual_main_separator_str to use diagnostic item instead of path 2024-09-19 13:13:20 +01:00
GnomedDev
1922a99bc6 [Clippy] Swap redundant_clone to use diagnostic items instead of paths 2024-09-19 13:13:20 +01:00
GnomedDev
8fc9e67cf5 [Clippy] Swap float_equality_without_abs to use diagnostic items instead of paths 2024-09-19 13:13:20 +01:00
GnomedDev
7ffd485be0 [Clippy] Swap option_as_ref_deref to use diagnostic items instead of paths 2024-09-19 13:13:19 +01:00
GnomedDev
71dbfd55a1 [Clippy] Swap lines_filter_map_ok to use a diagnostic item instead of path 2024-09-19 08:26:41 +01:00
GnomedDev
5a13a93d41 [Clippy] Swap map_entry to use diagnostic items instead of paths 2024-09-19 08:26:37 +01:00
Alex Macleod
d2305ff634 Generate versions HTML directly 2024-09-18 18:51:54 +00:00
bors
fdc16781eb Auto merge of #13415 - rust-lang:flip1995-vacation-done, r=flip1995
End my vacation

r? `@ghost`
changelog: none
2024-09-18 17:30:40 +00:00
Philipp Krones
106a9af4ce
End my vacation 2024-09-18 19:29:05 +02:00
GnomedDev
978582be74 [Clippy] Swap manual_retain to use diagnostic items instead of paths 2024-09-18 17:20:44 +01:00
y21
431f7d6709 build quine-mc_cluskey with O3 in dev builds 2024-09-18 15:19:28 +02:00
VictorHugoPilled
ae5f857096 fix: Specifying reason in expect(clippy::needless_return) no longer triggers false positive
chore: Moved new tests into needless_return.rs

chore: Ran cargo uibless

Initial commit
2024-09-18 06:10:51 +00:00
Lukas Lueg
c3d58cd5fa Fix if_then_some_else_none sugg missing closure intro
Fixes #13407
2024-09-17 23:19:29 +02:00
bors
903293b199 Auto merge of #13382 - c410-f3r:blah, r=y21
[`missing_panics_doc`] Fix #13381

Fix #13381

Makes `missing_panics_doc` act like other "panicking" lints (`unwrap_used`, `panic`, etc) in constant environments.

changelog: Ignore `missing_panics_doc` in constant environments
2024-09-17 12:34:00 +00:00
Matthias Krüger
e3bb779e1e Rollup merge of #130293 - gurry:130142-lint-level-issue, r=cjgillot
Fix lint levels not getting overridden by attrs on `Stmt` nodes

Fixes #130142. See comments on the issue for context.

r? `@cjgillot`
2024-09-15 16:01:37 +02:00
Ralf Jung
976131f896 stabilize const_mut_refs 2024-09-15 09:51:32 +02:00
Folkert de Vries
b5ea5c23b3 stabilize const_extern_fn 2024-09-14 18:07:06 +02:00
Gurinder Singh
9e697964dc Fix lint levels not getting overridden by attrs on Stmt nodes 2024-09-14 16:12:00 +05:30
bors
2536745917 Auto merge of #13313 - y21:issue13308, r=Centri3
Look at adjusted types instead of fn signature types in `ptr_arg`

This simplifies the implementation of the `ptr_arg` lint a bit and:
Fixes #13308
Fixes #10612

Currently, the lint checks if e.g. a `&String` parameter is only used in contexts where a `&str` could work. Part of it worked by looking for path exprs to that parameter in function call position specifically, looking at the callee signature and checking if that parameter type without refs is `String` (or one of a bunch of other special cases).

This simplified version removes the special casing of function calls and looking at the parameter type and instead just looks at the **adjusted type**, regardless of the expression it's in. This naturally also covers what the previous version was doing (if the expression is in a function call argument position expecting a `&str`, then it will have that adjustment. If it requires a `&String` then it won't have that adjustment and we won't lint).

The linked issue was a FP that happened because the previous implementation simply didn't consider projection types in the signature type, but with this simplification we don't really need to consider that (because we aren't looking at function signatures at all anymore -- the `&mut Self::Owned` parameter type of `clone_into` is the already-instantiated and normalized type `&mut String`).

changelog: none
2024-09-13 16:49:16 +00:00
y21
15495ebf42 Look at adjusted types instead of fn signature types in ptr_arg 2024-09-13 18:26:29 +02:00
Trevor Spiteri
7cccef84cf handle transmutes in const context if msrvs::CONST_FLOAT_BITS_CONV 2024-09-13 13:57:41 +02:00
Trevor Spiteri
7fcdebf658 Revert "stabilize const_float_bits_conv" for src/tools/clippy/clippy_lints
This reverts the part of commit 19908ff7a37a9a431399bb6f2868efc22820f2b6 in
subdirectory src/tools/clippy/clippy_lints.
2024-09-13 13:56:41 +02:00
bors
2b7d80b80a Auto merge of #13377 - vHugoObject:master, r=dswij
fix: Fixed incorrect comment form suggestion for too_long_first_doc_paragraph lint

fixes #13309
changelog: none

Comment form is now a variable and a new test for too_long_first_doc_paragraph was added.
2024-09-13 11:55:46 +00:00
Obei Sideg
cd99729478 Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
Alexey Semenyuk
bc7d323bdf Clarify type_complexity 2024-09-13 16:02:51 +05:00
VictorHugoPilled
d66e9addd6 fix: Fixed incorrect comment form suggestion
chore: Ran cargo dev fmt

chore: Fixed spacing

fix: Fixed spacing for comment suggestion

fix: Added new module level test to too_long_first_doc_paragraph

chore: Ran cargo uibless
2024-09-12 23:33:22 +00:00