Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b9efcd

Browse files
committed
Auto merge of #141044 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update r? `@Manishearth` Cargo.lock update due to Clippy version bump.
2 parents c79bbfa + 60750ca commit 1b9efcd

File tree

263 files changed

+5280
-4460
lines changed

Some content is hidden

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

263 files changed

+5280
-4460
lines changed

‎Cargo.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
537537

538538
[[package]]
539539
name = "clippy"
540-
version = "0.1.88"
540+
version = "0.1.89"
541541
dependencies = [
542542
"anstream",
543543
"askama",
@@ -569,7 +569,7 @@ dependencies = [
569569

570570
[[package]]
571571
name = "clippy_config"
572-
version = "0.1.88"
572+
version = "0.1.89"
573573
dependencies = [
574574
"clippy_utils",
575575
"itertools",
@@ -594,7 +594,7 @@ dependencies = [
594594

595595
[[package]]
596596
name = "clippy_lints"
597-
version = "0.1.88"
597+
version = "0.1.89"
598598
dependencies = [
599599
"arrayvec",
600600
"cargo_metadata 0.18.1",
@@ -624,7 +624,7 @@ dependencies = [
624624

625625
[[package]]
626626
name = "clippy_utils"
627-
version = "0.1.88"
627+
version = "0.1.89"
628628
dependencies = [
629629
"arrayvec",
630630
"itertools",
@@ -5084,9 +5084,9 @@ dependencies = [
50845084

50855085
[[package]]
50865086
name = "tempfile"
5087-
version = "3.19.1"
5087+
version = "3.20.0"
50885088
source = "registry+https://github.com/rust-lang/crates.io-index"
5089-
checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf"
5089+
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
50905090
dependencies = [
50915091
"fastrand",
50925092
"getrandom 0.3.2",

‎compiler/rustc_data_structures/src/temp_dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Drop for MaybeTempDir {
1717
// occur.
1818
let dir = unsafe { ManuallyDrop::take(&mut self.dir) };
1919
if self.keep {
20-
let _ = dir.into_path();
20+
let _ = dir.keep();
2121
}
2222
}
2323
}

‎src/tools/clippy/.github/workflows/clippy_changelog.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,18 @@ jobs:
1515
changelog:
1616
runs-on: ubuntu-latest
1717

18-
defaults:
19-
run:
20-
shell: bash
21-
2218
steps:
2319
# Run
2420
- name: Check Changelog
2521
if: ${{ github.event_name == 'pull_request' }}
2622
run: |
27-
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | \
28-
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
29-
output=$(awk '/^changelog:\s*\S/ && !/changelog: \[.*\]: your change/' <<< "$body" | sed "s/changelog:\s*//g")
30-
if [ -z "$output" ]; then
31-
echo "ERROR: pull request message must contain 'changelog: ...' with your changelog. Please add it."
23+
if [[ -z $(grep -oP 'changelog: *\K\S+' <<< "$PR_BODY") ]]; then
24+
echo "::error::Pull request message must contain 'changelog: ...' with your changelog. Please add it."
3225
exit 1
33-
else
34-
echo "changelog: $output"
3526
fi
3627
env:
37-
PYTHONIOENCODING: 'utf-8'
38-
PR_NUMBER: '${{ github.event.number }}'
28+
PR_BODY: ${{ github.event.pull_request.body }})
29+
3930

4031
# We need to have the "conclusion" job also on PR CI, to make it possible
4132
# to add PRs to a merge queue.

‎src/tools/clippy/CHANGELOG.md

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,105 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[3e3715c3...master](https://github.com/rust-lang/rust-clippy/compare/3e3715c3...master)
9+
[1e5237f4...master](https://github.com/rust-lang/rust-clippy/compare/1e5237f4...master)
10+
11+
## Rust 1.87
12+
13+
Current stable, released 2025年05月15日
14+
15+
[View all 127 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2025-02-06T14%3A54%3A28Z..2025年03月20日T20%3A07%3A53Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`doc_comment_double_space_linebreaks`] to `pedantic` [#12876](https://github.com/rust-lang/rust-clippy/pull/12876)
20+
* Added [`manual_midpoint`] to `pedantic` [#13851](https://github.com/rust-lang/rust-clippy/pull/13851)
21+
* Added [`io_other_error`] to `style` [#14022](https://github.com/rust-lang/rust-clippy/pull/14022)
22+
* Added [`owned_cow`] to `pedantic` [#13948](https://github.com/rust-lang/rust-clippy/pull/13948)
23+
* Added [`manual_contains`] to `perf` [#13817](https://github.com/rust-lang/rust-clippy/pull/13817)
24+
* Added [`unnecessary_debug_formatting`] to `pedantic` [#13893](https://github.com/rust-lang/rust-clippy/pull/13893)
25+
* Added [`elidable_lifetime_names`] to `pedantic` [#13960](https://github.com/rust-lang/rust-clippy/pull/13960)
26+
* Added [`mem_replace_option_with_some`] to `style` [#14197](https://github.com/rust-lang/rust-clippy/pull/14197)
27+
* Added [`unbuffered_bytes`] to `perf` [#14089](https://github.com/rust-lang/rust-clippy/pull/14089)
28+
* Added [`single_option_map`] to `nursery` [#14033](https://github.com/rust-lang/rust-clippy/pull/14033)
29+
30+
### Moves and Deprecations
31+
32+
* Moved [`comparison_chain`] to `pedantic` (from `style`)
33+
[#14219](https://github.com/rust-lang/rust-clippy/pull/14219)
34+
* Moved [`manual_ok_or`] to `style` (from `pedantic`)
35+
[#14027](https://github.com/rust-lang/rust-clippy/pull/14027)
36+
* Deprecated [`option_map_or_err_ok`] in favor of [`manual_ok_or`]
37+
[#14027](https://github.com/rust-lang/rust-clippy/pull/14027)
38+
39+
### Enhancements
40+
41+
* Add `allow_expect_in_consts` and `allow_unwrap_in_consts` configuration options to [`unwrap_used`], [`expect_used`]
42+
[#14200](https://github.com/rust-lang/rust-clippy/pull/14200)
43+
* Add `check-incompatible-msrv-in-tests` configuration option to [`incompatible_msrv`]
44+
[#14279](https://github.com/rust-lang/rust-clippy/pull/14279)
45+
* [`len_zero`] now also triggers if deref target implements `is_empty()`
46+
[#13871](https://github.com/rust-lang/rust-clippy/pull/13871)
47+
* [`ptr_eq`] now handles more cases, including `!=` in addition to `==`
48+
[#14339](https://github.com/rust-lang/rust-clippy/pull/14339)
49+
* [`struct_field_names`] now also checks private fields of public structs
50+
[#14076](https://github.com/rust-lang/rust-clippy/pull/14076)
51+
* [`needless_pass_by_value`] suggests using a reference on the innermost `Option` content
52+
[#14392](https://github.com/rust-lang/rust-clippy/pull/14392)
53+
* [`obfuscated_if_else`] now supports `then().unwrap_or_else()` and `then_some().unwrap_or_else()`
54+
[#14165](https://github.com/rust-lang/rust-clippy/pull/14165)
55+
* Format macros: all format-handling lints now validate `todo!` and `unimplemented!` macros
56+
[#14266](https://github.com/rust-lang/rust-clippy/pull/14266)
57+
* [`disallowed_methods`] now supports replacements
58+
[#13669](https://github.com/rust-lang/rust-clippy/pull/13669)
59+
* Added MSRV checks for several lints:
60+
* [`question_mark`] [#14436](https://github.com/rust-lang/rust-clippy/pull/14436)
61+
* [`repeat_vec_with_capacity`] [#14126](https://github.com/rust-lang/rust-clippy/pull/14126)
62+
* [`manual_flatten`] [#14086](https://github.com/rust-lang/rust-clippy/pull/14086)
63+
* [`lines_filter_map_ok`] [#14130](https://github.com/rust-lang/rust-clippy/pull/14130)
64+
65+
### False Positive Fixes
66+
67+
* [`missing_const_for_fn`] no longer triggers on unstable const traits [#14294](https://github.com/rust-lang/rust-clippy/pull/14294)
68+
* [`unnecessary_to_owned`] now avoids suggesting to call `iter()` on a temporary object [#14243](https://github.com/rust-lang/rust-clippy/pull/14243)
69+
* [`unnecessary_debug_formatting`] no longer triggers in tests [#14347](https://github.com/rust-lang/rust-clippy/pull/14347)
70+
* [`option_if_let_else`] now handles cases when value is partially moved [#14209](https://github.com/rust-lang/rust-clippy/pull/14209)
71+
* [`blocks_in_conditions`] no longer triggers when the condition contains a `return` [#14338](https://github.com/rust-lang/rust-clippy/pull/14338)
72+
* [`undocumented_unsafe_blocks`] no longer triggers on trait/impl items [#13888](https://github.com/rust-lang/rust-clippy/pull/13888)
73+
* [`manual_slice_fill`] no longer triggers due to missing index checks [#14193](https://github.com/rust-lang/rust-clippy/pull/14193)
74+
* [`useless_asref`] no longer suggests using `.clone()` if the target type doesn't implement `Clone` [#14174](https://github.com/rust-lang/rust-clippy/pull/14174)
75+
* [`unnecessary_safety_comment`] no longer triggers on desugared assign [#14371](https://github.com/rust-lang/rust-clippy/pull/14371)
76+
* [`unnecessary_map_or`] no longer consumes the comparison value if it does not implement `Copy` [#14207](https://github.com/rust-lang/rust-clippy/pull/14207)
77+
* [`let_and_return`] no longer triggers involving short-lived block temporary variables [#14180](https://github.com/rust-lang/rust-clippy/pull/14180)
78+
* [`manual_async_fn`] no longer emits suggestions inside macros [#14142](https://github.com/rust-lang/rust-clippy/pull/14142)
79+
* [`use_self`] skips analysis inside macro expansions of a `impl Self` block [#13128](https://github.com/rust-lang/rust-clippy/pull/13128)
80+
* [`double_ended_iterator_last`] no longer triggers on non-reference immutable receiver [#14140](https://github.com/rust-lang/rust-clippy/pull/14140)
81+
82+
### ICE Fixes
83+
84+
* [`macro_use_imports`] Fix ICE when checking attributes
85+
[#14317](https://github.com/rust-lang/rust-clippy/pull/14317)
86+
* [`doc_nested_refdefs`] Fix ICE by avoiding invalid ranges
87+
[#14308](https://github.com/rust-lang/rust-clippy/pull/14308)
88+
* [`just_underscores_and_digits`] Fix ICE in error recovery scenario
89+
[#14168](https://github.com/rust-lang/rust-clippy/pull/14168)
90+
* [`declare_interior_mutable_const`], [`borrow_interior_mutable_const`] Fix ICE by properly resolving `<T as Trait>::AssocT` projections
91+
[#14125](https://github.com/rust-lang/rust-clippy/pull/14125)
92+
93+
### Documentation Improvements
94+
95+
* [`struct_excessive_bools`] Documentation improved with rationale
96+
[#14351](https://github.com/rust-lang/rust-clippy/pull/14351)
97+
98+
### Others
99+
100+
* Use edition=2021 in `rustc_tools_util`
101+
[#14211](https://github.com/rust-lang/rust-clippy/pull/14211)
102+
* Fix rustc_tools_util's `version.host_compiler` release channel, expose the rustc version, and add tests
103+
[#14123](https://github.com/rust-lang/rust-clippy/pull/14123)
104+
* Make UI test annotations mandatory
105+
[#11421](https://github.com/rust-lang/rust-clippy/pull/11421)
106+
[#14388](https://github.com/rust-lang/rust-clippy/pull/14388)
107+
[#14393](https://github.com/rust-lang/rust-clippy/pull/14393)
10108

11109
## Rust 1.86
12110

@@ -5583,6 +5681,7 @@ Released 2018年09月13日
55835681
[`clone_on_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
55845682
[`clone_on_ref_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_ref_ptr
55855683
[`cloned_instead_of_copied`]: https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
5684+
[`cloned_ref_to_slice_refs`]: https://rust-lang.github.io/rust-clippy/master/index.html#cloned_ref_to_slice_refs
55865685
[`cmp_nan`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_nan
55875686
[`cmp_null`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_null
55885687
[`cmp_owned`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
@@ -5594,6 +5693,7 @@ Released 2018年09月13日
55945693
[`collection_is_never_read`]: https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
55955694
[`comparison_chain`]: https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain
55965695
[`comparison_to_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
5696+
[`confusing_method_to_numeric_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#confusing_method_to_numeric_cast
55975697
[`const_is_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#const_is_empty
55985698
[`const_static_lifetime`]: https://rust-lang.github.io/rust-clippy/master/index.html#const_static_lifetime
55995699
[`copy_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#copy_iterator
@@ -6383,6 +6483,7 @@ Released 2018年09月13日
63836483
[`accept-comment-above-statement`]: https://doc.rust-lang.org/clippy/lint_configuration.html#accept-comment-above-statement
63846484
[`allow-comparison-to-zero`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-comparison-to-zero
63856485
[`allow-dbg-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-dbg-in-tests
6486+
[`allow-exact-repetitions`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-exact-repetitions
63866487
[`allow-expect-in-consts`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-expect-in-consts
63876488
[`allow-expect-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-expect-in-tests
63886489
[`allow-indexing-slicing-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-indexing-slicing-in-tests
@@ -6435,6 +6536,7 @@ Released 2018年09月13日
64356536
[`max-suggested-slice-pattern-length`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-suggested-slice-pattern-length
64366537
[`max-trait-bounds`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-trait-bounds
64376538
[`min-ident-chars-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#min-ident-chars-threshold
6539+
[`missing-docs-allow-unused`]: https://doc.rust-lang.org/clippy/lint_configuration.html#missing-docs-allow-unused
64386540
[`missing-docs-in-crate-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#missing-docs-in-crate-items
64396541
[`module-item-order-groupings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#module-item-order-groupings
64406542
[`module-items-ordered-within-groupings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#module-items-ordered-within-groupings

‎src/tools/clippy/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ debugging to find the actual problem behind the issue.
7777

7878
[`T-middle`] issues can be more involved and require verifying types. The [`ty`] module contains a
7979
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
80-
an AST expression).`match_def_path()` in Clippy's `utils` module can also be useful.
80+
an AST expression).
8181

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

‎src/tools/clippy/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy"
33
# begin autogenerated version
4-
version = "0.1.88"
4+
version = "0.1.89"
55
# end autogenerated version
66
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
77
repository = "https://github.com/rust-lang/rust-clippy"
@@ -28,7 +28,7 @@ clippy_lints = { path = "clippy_lints" }
2828
clippy_utils = { path = "clippy_utils" }
2929
rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
3030
clippy_lints_internal = { path = "clippy_lints_internal", optional = true }
31-
tempfile = { version = "3.3", optional = true }
31+
tempfile = { version = "3.20", optional = true }
3232
termize = "0.1"
3333
color-print = "0.3.4"
3434
anstream = "0.6.18"
@@ -47,7 +47,6 @@ pulldown-cmark = { version = "0.11", default-features = false, features = ["html
4747
askama = { version = "0.13", default-features = false, features = ["alloc", "config", "derive"] }
4848

4949
# UI test dependencies
50-
clippy_utils = { path = "clippy_utils" }
5150
if_chain = "1.0"
5251
quote = "1.0.25"
5352
syn = { version = "2.0", features = ["full"] }

‎src/tools/clippy/book/src/development/adding_lints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ In our example, `is_foo_fn` looks like:
416416

417417
fn is_foo_fn(fn_kind: FnKind<'_>) -> bool {
418418
match fn_kind {
419-
FnKind::Fn(_, ident, ..) => {
419+
FnKind::Fn(_, _, Fn { ident, .. }) => {
420420
// check if `fn` name is `foo`
421421
ident.name.as_str() == "foo"
422422
}

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

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -145,42 +145,32 @@ unclear to you.
145145
If you are hacking on Clippy and want to install it from source, do the
146146
following:
147147

148-
First, take note of the toolchain
149-
[override](https://rust-lang.github.io/rustup/overrides.html) in
150-
`/rust-toolchain.toml`. We will use this override to install Clippy into the right
151-
toolchain.
152-
153-
> Tip: You can view the active toolchain for the current directory with `rustup
154-
> show active-toolchain`.
155-
156148
From the Clippy project root, run the following command to build the Clippy
157-
binaries and copy them into the toolchain directory. This will override the
158-
currently installed Clippy component.
149+
binaries and copy them into the toolchain directory. This will create a new
150+
toolchain called `clippy` by default, see `cargo dev setup toolchain --help`
151+
for other options.
159152

160153
```terminal
161-
cargo build --release --bin cargo-clippy --bin clippy-driver -Zunstable-options --out-dir "$(rustc --print=sysroot)/bin"
154+
cargo dev setup toolcahin
162155
```
163156

164-
Now you may run `cargo clippy` in any project, using the toolchain where you
165-
just installed Clippy.
157+
Now you may run `cargo +clippy clippy` in any project using the new toolchain.
166158

167159
```terminal
168160
cd my-project
169-
cargo +nightly-2021年07月01日 clippy
161+
cargo +clippy clippy
170162
```
171163

172164
...or `clippy-driver`
173165

174166
```terminal
175-
clippy-driver +nightly-2021年07月01日 <filename>
167+
clippy-driver +clippy <filename>
176168
```
177169

178-
If you need to restore the default Clippy installation, run the following (from
179-
the Clippy project root).
170+
If you no longer need the toolchain it can be uninstalled using `rustup`:
180171

181172
```terminal
182-
rustup component remove clippy
183-
rustup component add clippy
173+
rustup toolchain uninstall clippy
184174
```
185175

186176
> **DO NOT** install using `cargo install --path . --force` since this will

‎src/tools/clippy/book/src/development/common_tools_writing_lints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ arguments have to be checked separately.
8686

8787
```rust
8888
use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item};
89-
use clippy_utils::{paths, match_def_path};
89+
use clippy_utils::paths;
9090
use rustc_span::symbol::sym;
9191
use rustc_hir::LangItem;
9292

@@ -108,7 +108,7 @@ impl LateLintPass<'_> for MyStructLint {
108108

109109
// 3. Using the type path
110110
// This method should be avoided if possible
111-
if match_def_path(cx, def_id, &paths::RESULT) {
111+
if paths::RESULT.matches_ty(cx, ty) {
112112
// The type is a `core::result::Result`
113113
}
114114
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /