Skip to content

Clippy subtree update #141343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 77 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6fb7d53
Check if dropping an expression may have indirect side-effects
samueltardieu Apr 11, 2025
d39600e
Skip inner ordering checking in presence of `#[repr(…)]`
samueltardieu Apr 14, 2025
4de5b27
`empty_struct_with_brackets`: do not lint macro code
samueltardieu Apr 15, 2025
a25c195
Remove redundant work in `trait_ref_of_method`.
Jarcho Apr 28, 2025
77157f5
Actually check for a problematic line comment in `with_leading_whites…
Jarcho Apr 28, 2025
82f8b1c
Do not pretend that `return` is not significant
samueltardieu May 8, 2025
a867981
Add new `useless_concat` lint
GuillaumeGomez Dec 14, 2024
126fb00
Add ui test for `useless_concat` lint
GuillaumeGomez Dec 14, 2024
7b06d2b
Move `concat` macro path into `clippy_utils::paths`
GuillaumeGomez Dec 29, 2024
73a19a0
Make lint span smaller for needless return
barun511 May 12, 2025
0d25090
Improve code and apply suggestions
GuillaumeGomez May 2, 2025
4ec2193
Fix size computation when element is a slice
samueltardieu May 14, 2025
fe4b4e8
`mem::size_of_val` is const-stable since Rust 1.85
samueltardieu May 14, 2025
f6e95a5
Fix false positive of `useless_conversion` when using `into_iter()`
relaxcn May 14, 2025
34c6ba7
comparison_chain: do not lint on 2 blocks expression
manoj23 May 15, 2025
93bd4d8
Merge commit '0450db33a5d8587f7c1d4b6d233dac963605766b' into clippy-s…
flip1995 May 15, 2025
a1931dd
`unnecessary_wraps`: do not include the whole body in the lint span
samueltardieu May 10, 2025
e0fd814
Fix tests
barun511 May 15, 2025
ff5e626
Fix false positive of `useless_conversion` when using `.into_iter().a…
llogiq May 16, 2025
95d7eda
comparison_chain: do not lint on 2 blocks expression (#14811)
llogiq May 16, 2025
57782e0
Rewrite `non_copy_const`
Jarcho Aug 3, 2024
7c41ec7
Reword `declare_interior_mutable_const` and
Jarcho Aug 7, 2024
318ba60
Rewrite tests for `declare_interior_mutable_const` and
Jarcho Aug 3, 2024
44681fd
Improve `cargo dev rename_lint`
Jarcho Apr 16, 2025
b3f4902
clippy_dev: order `deprecated_lints.rs` in `update_lints`
Jarcho Apr 16, 2025
13b070e
clippy_dev: Fix previous renames in `rename_lint`
Jarcho Apr 16, 2025
27acbf2
Reenable linting on UFCS `deref` calls.
Jarcho May 15, 2025
39ab00a
`match_same_arms`, `ifs_same_cond`: lint once per same arm/condition
Alexendoo Apr 16, 2025
feb70b5
`match_same_arms`, `ifs_same_cond`: lint once per same arm/condition …
samueltardieu May 16, 2025
5239b7f
`unnecessary_wraps`: do not include the whole body in the lint span (…
blyxyas May 16, 2025
5cb7e40
Reenable linting on UFCS `deref` calls (#14808)
llogiq May 16, 2025
94cfebb
Rewrite `non_copy_const` (#13207)
llogiq May 16, 2025
604b7b0
Extend `cargo dev rename_lint` (#14633)
samueltardieu May 16, 2025
dcd8bb6
Skip inner ordering checking in presence of `#[repr(…)]` (#14610)
samueltardieu May 16, 2025
e666b83
excessive_precision: Fix false positive when exponent has leading zero
HackAttack May 17, 2025
c97b476
excessive_precision: Fix false positive when exponent has leading zer…
samueltardieu May 17, 2025
9d47e0c
clippy_dev: remove the need for markers when bumping the version
Jarcho Apr 17, 2025
232be55
clippy_dev: refactor rustfmt calls
Jarcho Apr 17, 2025
9ebfb84
Refactor and speed up `cargo dev fmt` (#14638)
samueltardieu May 17, 2025
daeb6a1
Misc changes (#14702)
y21 May 17, 2025
da7b678
`empty_struct_with_brackets`: do not lint code coming from macro expa…
y21 May 17, 2025
b7caa1b
Do not call `TyCtxt::type_of()` on a trait
samueltardieu May 17, 2025
1e3fc3c
fix minor typo: toolcahin => toolchain
PLeVasseur May 18, 2025
15d47d7
Fixing minor typo in book (#14835)
samueltardieu May 18, 2025
618ccd7
Do not call `TyCtxt::type_of()` on a trait (#14830)
Alexendoo May 18, 2025
035146e
Remove rustc_attr_data_structures re-export from rustc_attr_parsing
mejrs May 18, 2025
19e967c
Add a reason to/remove some `//@no-rustfix` annotations
Alexendoo May 18, 2025
492c4e1
fix: `unnecessary_to_owned` FP when map key is a reference
profetia May 18, 2025
b03370b
Add a reason to/remove some `//@no-rustfix` annotations (#14839)
llogiq May 18, 2025
375c650
fix: `unnecessary_to_owned` FP when map key is a reference (#14834)
samueltardieu May 18, 2025
a22efe7
Rollup merge of #140874 - mejrs:rads, r=WaffleLapkin
Zalathar May 19, 2025
7123f2a
Docs: Use spaces in `good first issue` label
flip1995 May 19, 2025
d44e35d
Docs: Use spaces in `good first issue` label (#14844)
samueltardieu May 19, 2025
df33aaf
Check if dropping an expression may have indirect side-effects (#14594)
blyxyas May 19, 2025
ebc2a68
Add new `useless_concat` lint (#13829)
samueltardieu May 19, 2025
db42c7d
Remove obsolete restriction in code
samueltardieu May 19, 2025
e2b1de1
Access items through `rustc_session` instead of `rustc_lint_defs`
samueltardieu May 19, 2025
608f682
`cargo dev fmt`: format `clippy_lints_internal` as well
samueltardieu May 19, 2025
ac7c87e
Remove obsolete restriction in code (#14851)
samueltardieu May 19, 2025
e34e8ac
`cargo dev fmt`: format `clippy_lints_internal` as well (#14853)
Jarcho May 19, 2025
d4e7e5b
Access items through `rustc_session` instead of `rustc_lint_defs` (#1…
blyxyas May 19, 2025
bb724f3
Sort the existing list of symbols
samueltardieu May 18, 2025
82bf659
Ensure that symbols list stays sorted
samueltardieu May 18, 2025
e16801e
Use symbols instead of `&str` when possible
samueltardieu May 18, 2025
b87e90b
Use interned symbols instead of strings in more places (#14840)
Jarcho May 19, 2025
66697e8
`needless_match`: do not pretend that `return` is not significant in …
blyxyas May 19, 2025
8224956
Various macro fixes for loop lints
samueltardieu Apr 16, 2025
72a4e33
Fix ICE while computing type layout
samueltardieu May 18, 2025
6753e16
Fix ICE while computing type layout (#14837)
Jarcho May 19, 2025
f00c58b
Make lint span smaller for needless return (#14790)
Jarcho May 20, 2025
5687ed5
Various macro fixes for loop lints (#14631)
y21 May 20, 2025
03ba508
Fixes `manual_slice_size_computation` ICE and triggers in `const` con…
y21 May 20, 2025
910e640
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 May 21, 2025
8a28b79
Bump nightly version -> 2025-05-21
flip1995 May 21, 2025
cadf98b
Rustup (#14860)
flip1995 May 21, 2025
a0c1ed3
Merge commit 'cadf98bb7d783e2ea3572446c3f80d3592ec5f86' into clippy-s…
flip1995 May 21, 2025
0e203f3
Update Cargo.lock
flip1995 May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,11 @@ dependencies = [
name = "clippy_dev"
version = "0.0.1"
dependencies = [
"aho-corasick",
"chrono",
"clap",
"indoc",
"itertools",
"opener",
"shell-escape",
"walkdir",
]

Expand Down Expand Up @@ -4888,12 +4886,6 @@ dependencies = [
"lazy_static",
]

[[package]]
name = "shell-escape"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"

[[package]]
name = "shlex"
version = "1.3.0"
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6440,6 +6440,7 @@ Released 2018-09-13
[`used_underscore_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_items
[`useless_asref`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
[`useless_attribute`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
[`useless_concat`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_concat
[`useless_conversion`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
[`useless_format`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
[`useless_let_if_seq`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_let_if_seq
Expand Down
6 changes: 3 additions & 3 deletions src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Clippy team directly by mentioning them in the issue or over on [Zulip]. All
currently active team members can be found
[here](https://github.com/rust-lang/rust-clippy/blob/master/triagebot.toml#L18)

Some issues are easier than others. The [`good-first-issue`] label can be used to find the easy
Some issues are easier than others. The [`good first issue`] label can be used to find the easy
issues. You can use `@rustbot claim` to assign the issue to yourself.

There are also some abandoned PRs, marked with [`S-inactive-closed`].
Expand All @@ -70,7 +70,7 @@ To figure out how this syntax structure is encoded in the AST, it is recommended
Usually the lint will end up to be a nested series of matches and ifs, [like so][deep-nesting].
But we can make it nest-less by using [let chains], [like this][nest-less].

[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good-first-issue`]
[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
first. Sometimes they are only somewhat involved code wise, but not difficult per-se.
Note that [`E-medium`] issues may require some knowledge of Clippy internals or some
debugging to find the actual problem behind the issue.
Expand All @@ -79,7 +79,7 @@ debugging to find the actual problem behind the issue.
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
an AST expression).

[`good-first-issue`]: https://github.com/rust-lang/rust-clippy/labels/good-first-issue
[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
[`S-inactive-closed`]: https://github.com/rust-lang/rust-clippy/pulls?q=is%3Aclosed+label%3AS-inactive-closed
[`T-AST`]: https://github.com/rust-lang/rust-clippy/labels/T-AST
[`T-middle`]: https://github.com/rust-lang/rust-clippy/labels/T-middle
Expand Down
2 changes: 0 additions & 2 deletions src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[package]
name = "clippy"
# begin autogenerated version
version = "0.1.89"
# end autogenerated version
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ toolchain called `clippy` by default, see `cargo dev setup toolchain --help`
for other options.

```terminal
cargo dev setup toolcahin
cargo dev setup toolchain
```

Now you may run `cargo +clippy clippy` in any project using the new toolchain.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/the_team.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ this group to help with triaging, which can include:

1. **Labeling issues**

For the `good-first-issue` label, it can still be good to use `@rustbot` to
For the `good first issue` label, it can still be good to use `@rustbot` to
subscribe to the issue and help interested parties, if they post questions
in the comments.

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
* [`manual_repeat_n`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n)
* [`manual_retain`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain)
* [`manual_slice_fill`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_fill)
* [`manual_slice_size_calculation`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation)
* [`manual_split_once`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_split_once)
* [`manual_str_repeat`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_str_repeat)
* [`manual_strip`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip)
Expand Down
2 changes: 0 additions & 2 deletions src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[package]
name = "clippy_config"
# begin autogenerated version
version = "0.1.89"
# end autogenerated version
edition = "2024"
publish = false

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ define_Conf! {
manual_repeat_n,
manual_retain,
manual_slice_fill,
manual_slice_size_calculation,
manual_split_once,
manual_str_repeat,
manual_strip,
Expand Down
2 changes: 0 additions & 2 deletions src/tools/clippy/clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ version = "0.0.1"
edition = "2024"

[dependencies]
aho-corasick = "1.0"
chrono = { version = "0.4.38", default-features = false, features = ["clock"] }
clap = { version = "4.4", features = ["derive"] }
indoc = "1.0"
itertools = "0.12"
opener = "0.7"
shell-escape = "0.1"
walkdir = "2.3"

[package.metadata.rust-analyzer]
Expand Down
61 changes: 24 additions & 37 deletions src/tools/clippy/clippy_dev/src/deprecate_lint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::update_lints::{
DeprecatedLint, DeprecatedLints, Lint, find_lint_decls, generate_lint_files, read_deprecated_lints,
};
use crate::update_lints::{DeprecatedLint, Lint, find_lint_decls, generate_lint_files, read_deprecated_lints};
use crate::utils::{UpdateMode, Version};
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
Expand All @@ -16,28 +14,34 @@ use std::{fs, io};
///
/// If a file path could not read from or written to
pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
let prefixed_name = if name.starts_with("clippy::") {
name.to_owned()
} else {
format!("clippy::{name}")
};
let stripped_name = &prefixed_name[8..];
if let Some((prefix, _)) = name.split_once("::") {
panic!("`{name}` should not contain the `{prefix}` prefix");
}

let mut lints = find_lint_decls();
let DeprecatedLints {
renamed: renamed_lints,
deprecated: mut deprecated_lints,
file: mut deprecated_file,
contents: mut deprecated_contents,
deprecated_end,
..
} = read_deprecated_lints();

let Some(lint) = lints.iter().find(|l| l.name == stripped_name) else {
let (mut deprecated_lints, renamed_lints) = read_deprecated_lints();

let Some(lint) = lints.iter().find(|l| l.name == name) else {
eprintln!("error: failed to find lint `{name}`");
return;
};

let prefixed_name = String::from_iter(["clippy::", name]);
match deprecated_lints.binary_search_by(|x| x.name.cmp(&prefixed_name)) {
Ok(_) => {
println!("`{name}` is already deprecated");
return;
},
Err(idx) => deprecated_lints.insert(
idx,
DeprecatedLint {
name: prefixed_name,
reason: reason.into(),
version: clippy_version.rust_display().to_string(),
},
),
}

let mod_path = {
let mut mod_path = PathBuf::from(format!("clippy_lints/src/{}", lint.module));
if mod_path.is_dir() {
Expand All @@ -48,24 +52,7 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
mod_path
};

if remove_lint_declaration(stripped_name, &mod_path, &mut lints).unwrap_or(false) {
deprecated_contents.insert_str(
deprecated_end as usize,
&format!(
" #[clippy::version = \"{}\"]\n (\"{}\", \"{}\"),\n",
clippy_version.rust_display(),
prefixed_name,
reason,
),
);
deprecated_file.replace_contents(deprecated_contents.as_bytes());
drop(deprecated_file);

deprecated_lints.push(DeprecatedLint {
name: prefixed_name,
reason: reason.into(),
});

if remove_lint_declaration(name, &mod_path, &mut lints).unwrap_or(false) {
generate_lint_files(UpdateMode::Change, &lints, &deprecated_lints, &renamed_lints);
println!("info: `{name}` has successfully been deprecated");
println!("note: you must run `cargo uitest` to update the test results");
Expand Down
Loading
Loading