Skip to content

Commit bf64d66

Browse files
committed
Auto merge of #141343 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update Out of cycle sync to fix an ICE that was reported twice already: rust-lang/rust-clippy#14828 r? `@Manishearth`
2 parents 462cc09 + 0e203f3 commit bf64d66

File tree

279 files changed

+6166
-4620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+6166
-4620
lines changed

Cargo.lock

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -582,13 +582,11 @@ dependencies = [
582582
name = "clippy_dev"
583583
version = "0.0.1"
584584
dependencies = [
585-
"aho-corasick",
586585
"chrono",
587586
"clap",
588587
"indoc",
589588
"itertools",
590589
"opener",
591-
"shell-escape",
592590
"walkdir",
593591
]
594592

@@ -4888,12 +4886,6 @@ dependencies = [
48884886
"lazy_static",
48894887
]
48904888

4891-
[[package]]
4892-
name = "shell-escape"
4893-
version = "0.1.5"
4894-
source = "registry+https://github.com/rust-lang/crates.io-index"
4895-
checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
4896-
48974889
[[package]]
48984890
name = "shlex"
48994891
version = "1.3.0"

src/tools/clippy/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6440,6 +6440,7 @@ Released 2018-09-13
64406440
[`used_underscore_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_items
64416441
[`useless_asref`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
64426442
[`useless_attribute`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
6443+
[`useless_concat`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_concat
64436444
[`useless_conversion`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
64446445
[`useless_format`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
64456446
[`useless_let_if_seq`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_let_if_seq

src/tools/clippy/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Clippy team directly by mentioning them in the issue or over on [Zulip]. All
5151
currently active team members can be found
5252
[here](https://github.com/rust-lang/rust-clippy/blob/master/triagebot.toml#L18)
5353

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

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

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

82-
[`good-first-issue`]: https://github.com/rust-lang/rust-clippy/labels/good-first-issue
82+
[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
8383
[`S-inactive-closed`]: https://github.com/rust-lang/rust-clippy/pulls?q=is%3Aclosed+label%3AS-inactive-closed
8484
[`T-AST`]: https://github.com/rust-lang/rust-clippy/labels/T-AST
8585
[`T-middle`]: https://github.com/rust-lang/rust-clippy/labels/T-middle

src/tools/clippy/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[package]
22
name = "clippy"
3-
# begin autogenerated version
43
version = "0.1.89"
5-
# end autogenerated version
64
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
75
repository = "https://github.com/rust-lang/rust-clippy"
86
readme = "README.md"

src/tools/clippy/book/src/development/basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ toolchain called `clippy` by default, see `cargo dev setup toolchain --help`
151151
for other options.
152152

153153
```terminal
154-
cargo dev setup toolcahin
154+
cargo dev setup toolchain
155155
```
156156

157157
Now you may run `cargo +clippy clippy` in any project using the new toolchain.

src/tools/clippy/book/src/development/the_team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ this group to help with triaging, which can include:
3333

3434
1. **Labeling issues**
3535

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

src/tools/clippy/book/src/lint_configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
836836
* [`manual_repeat_n`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n)
837837
* [`manual_retain`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain)
838838
* [`manual_slice_fill`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_fill)
839+
* [`manual_slice_size_calculation`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation)
839840
* [`manual_split_once`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_split_once)
840841
* [`manual_str_repeat`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_str_repeat)
841842
* [`manual_strip`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip)

src/tools/clippy/clippy_config/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
# begin autogenerated version
43
version = "0.1.89"
5-
# end autogenerated version
64
edition = "2024"
75
publish = false
86

src/tools/clippy/clippy_config/src/conf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ define_Conf! {
739739
manual_repeat_n,
740740
manual_retain,
741741
manual_slice_fill,
742+
manual_slice_size_calculation,
742743
manual_split_once,
743744
manual_str_repeat,
744745
manual_strip,

src/tools/clippy/clippy_dev/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ version = "0.0.1"
55
edition = "2024"
66

77
[dependencies]
8-
aho-corasick = "1.0"
98
chrono = { version = "0.4.38", default-features = false, features = ["clock"] }
109
clap = { version = "4.4", features = ["derive"] }
1110
indoc = "1.0"
1211
itertools = "0.12"
1312
opener = "0.7"
14-
shell-escape = "0.1"
1513
walkdir = "2.3"
1614

1715
[package.metadata.rust-analyzer]

src/tools/clippy/clippy_dev/src/deprecate_lint.rs

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::update_lints::{
2-
DeprecatedLint, DeprecatedLints, Lint, find_lint_decls, generate_lint_files, read_deprecated_lints,
3-
};
1+
use crate::update_lints::{DeprecatedLint, Lint, find_lint_decls, generate_lint_files, read_deprecated_lints};
42
use crate::utils::{UpdateMode, Version};
53
use std::ffi::OsStr;
64
use std::path::{Path, PathBuf};
@@ -16,28 +14,34 @@ use std::{fs, io};
1614
///
1715
/// If a file path could not read from or written to
1816
pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
19-
let prefixed_name = if name.starts_with("clippy::") {
20-
name.to_owned()
21-
} else {
22-
format!("clippy::{name}")
23-
};
24-
let stripped_name = &prefixed_name[8..];
17+
if let Some((prefix, _)) = name.split_once("::") {
18+
panic!("`{name}` should not contain the `{prefix}` prefix");
19+
}
2520

2621
let mut lints = find_lint_decls();
27-
let DeprecatedLints {
28-
renamed: renamed_lints,
29-
deprecated: mut deprecated_lints,
30-
file: mut deprecated_file,
31-
contents: mut deprecated_contents,
32-
deprecated_end,
33-
..
34-
} = read_deprecated_lints();
35-
36-
let Some(lint) = lints.iter().find(|l| l.name == stripped_name) else {
22+
let (mut deprecated_lints, renamed_lints) = read_deprecated_lints();
23+
24+
let Some(lint) = lints.iter().find(|l| l.name == name) else {
3725
eprintln!("error: failed to find lint `{name}`");
3826
return;
3927
};
4028

29+
let prefixed_name = String::from_iter(["clippy::", name]);
30+
match deprecated_lints.binary_search_by(|x| x.name.cmp(&prefixed_name)) {
31+
Ok(_) => {
32+
println!("`{name}` is already deprecated");
33+
return;
34+
},
35+
Err(idx) => deprecated_lints.insert(
36+
idx,
37+
DeprecatedLint {
38+
name: prefixed_name,
39+
reason: reason.into(),
40+
version: clippy_version.rust_display().to_string(),
41+
},
42+
),
43+
}
44+
4145
let mod_path = {
4246
let mut mod_path = PathBuf::from(format!("clippy_lints/src/{}", lint.module));
4347
if mod_path.is_dir() {
@@ -48,24 +52,7 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
4852
mod_path
4953
};
5054

51-
if remove_lint_declaration(stripped_name, &mod_path, &mut lints).unwrap_or(false) {
52-
deprecated_contents.insert_str(
53-
deprecated_end as usize,
54-
&format!(
55-
" #[clippy::version = \"{}\"]\n (\"{}\", \"{}\"),\n",
56-
clippy_version.rust_display(),
57-
prefixed_name,
58-
reason,
59-
),
60-
);
61-
deprecated_file.replace_contents(deprecated_contents.as_bytes());
62-
drop(deprecated_file);
63-
64-
deprecated_lints.push(DeprecatedLint {
65-
name: prefixed_name,
66-
reason: reason.into(),
67-
});
68-
55+
if remove_lint_declaration(name, &mod_path, &mut lints).unwrap_or(false) {
6956
generate_lint_files(UpdateMode::Change, &lints, &deprecated_lints, &renamed_lints);
7057
println!("info: `{name}` has successfully been deprecated");
7158
println!("note: you must run `cargo uitest` to update the test results");

0 commit comments

Comments
 (0)