Skip to content

Commit 5eebeb0

Browse files
committed
Auto merge of #148340 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update r? `@Manishearth` Cargo.lock update due to Clippy version bump
2 parents 82ae0ee + be5093e commit 5eebeb0

File tree

235 files changed

+4509
-2774
lines changed

Some content is hidden

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

235 files changed

+4509
-2774
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
580580

581581
[[package]]
582582
name = "clippy"
583-
version = "0.1.92"
583+
version = "0.1.93"
584584
dependencies = [
585585
"anstream",
586586
"askama",
@@ -607,7 +607,7 @@ dependencies = [
607607

608608
[[package]]
609609
name = "clippy_config"
610-
version = "0.1.92"
610+
version = "0.1.93"
611611
dependencies = [
612612
"clippy_utils",
613613
"itertools",
@@ -630,7 +630,7 @@ dependencies = [
630630

631631
[[package]]
632632
name = "clippy_lints"
633-
version = "0.1.92"
633+
version = "0.1.93"
634634
dependencies = [
635635
"arrayvec",
636636
"cargo_metadata 0.18.1",
@@ -662,7 +662,7 @@ dependencies = [
662662

663663
[[package]]
664664
name = "clippy_utils"
665-
version = "0.1.92"
665+
version = "0.1.93"
666666
dependencies = [
667667
"arrayvec",
668668
"itertools",
@@ -1066,7 +1066,7 @@ dependencies = [
10661066

10671067
[[package]]
10681068
name = "declare_clippy_lint"
1069-
version = "0.1.92"
1069+
version = "0.1.93"
10701070

10711071
[[package]]
10721072
name = "derive-where"

src/tools/clippy/CHANGELOG.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,89 @@ document.
88

99
[e9b7045...master](https://github.com/rust-lang/rust-clippy/compare/e9b7045...master)
1010

11+
## Rust 1.91
12+
13+
Current stable, released 2025-10-30
14+
15+
[View all 146 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2025-07-25T21%3A05%3A11Z..2025-09-04T22%3A34%3A27Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`possible_missing_else`] to `suspicious`
20+
[#15317](https://github.com/rust-lang/rust-clippy/pull/15317)
21+
22+
### Moves and Deprecations
23+
24+
* Moved [`cognitive_complexity`] from `nursery` to `restriction`
25+
[#15415](https://github.com/rust-lang/rust-clippy/pull/15415)
26+
* Moved [`declare_interior_mutable_const`] from `style` to `suspicious`
27+
[#15454](https://github.com/rust-lang/rust-clippy/pull/15454)
28+
* Moved [`crosspointer_transmute`] from `complexity` to `suspicious`
29+
[#15403](https://github.com/rust-lang/rust-clippy/pull/15403)
30+
31+
### Enhancements
32+
33+
* [`excessive_precision`] added `const_literal_digits_threshold` option to suppress overly precise constants.
34+
[#15193](https://github.com/rust-lang/rust-clippy/pull/15193)
35+
* [`unwrap_in_result`] rewritten for better accuracy; now lints on `.unwrap()` and `.expect()`
36+
directly and no longer mixes `Result` and `Option`.
37+
[#15445](https://github.com/rust-lang/rust-clippy/pull/15445)
38+
* [`panic`] now works in `const` contexts.
39+
[#15565](https://github.com/rust-lang/rust-clippy/pull/15565)
40+
* [`implicit_clone`] now also lints `to_string` calls (merging [`string_to_string`] behavior).
41+
[#14177](https://github.com/rust-lang/rust-clippy/pull/14177)
42+
* [`collapsible_match`] improved suggestions to handle necessary ref/dereferencing.
43+
[#14221](https://github.com/rust-lang/rust-clippy/pull/14221)
44+
* [`map_identity`] now suggests making variables mutable when required; recognizes tuple struct restructuring.
45+
[#15261](https://github.com/rust-lang/rust-clippy/pull/15261)
46+
* [`option_map_unit_fn`] preserves `unsafe` blocks in suggestions.
47+
[#15570](https://github.com/rust-lang/rust-clippy/pull/15570)
48+
* [`unnecessary_mut_passed`] provides structured, clearer fix suggestions.
49+
[#15438](https://github.com/rust-lang/rust-clippy/pull/15438)
50+
* [`float_equality_without_abs`] now checks `f16` and `f128` types.
51+
[#15054](https://github.com/rust-lang/rust-clippy/pull/15054)
52+
* [`doc_markdown`] expanded whitelist (`InfiniBand`, `RoCE`, `PowerPC`) and improved handling of
53+
identifiers like NixOS.
54+
[#15558](https://github.com/rust-lang/rust-clippy/pull/15558)
55+
* [`clone_on_ref_ptr`] now suggests fully qualified paths to avoid resolution errors.
56+
[#15561](https://github.com/rust-lang/rust-clippy/pull/15561)
57+
* [`manual_assert`] simplifies boolean expressions in suggested fixes.
58+
[#15368](https://github.com/rust-lang/rust-clippy/pull/15368)
59+
* [`four_forward_slashes`] warns about bare CR in comments and avoids invalid autofixes.
60+
[#15175](https://github.com/rust-lang/rust-clippy/pull/15175)
61+
62+
### False Positive Fixes
63+
64+
* [`alloc_instead_of_core`] fixed FP when `alloc` is an alias
65+
[#15581](https://github.com/rust-lang/rust-clippy/pull/15581)
66+
* [`needless_range_loop`] fixed FP and FN when meeting multidimensional array
67+
[#15486](https://github.com/rust-lang/rust-clippy/pull/15486)
68+
* [`semicolon_inside_block`] fixed FP when attribute over expr is not enabled
69+
[#15476](https://github.com/rust-lang/rust-clippy/pull/15476)
70+
* [`unnested_or_patterns`] fixed FP on structs with only shorthand field patterns
71+
[#15343](https://github.com/rust-lang/rust-clippy/pull/15343)
72+
* [`match_ref_pats`] fixed FP on match scrutinee of never type
73+
[#15474](https://github.com/rust-lang/rust-clippy/pull/15474)
74+
* [`infinite_loop`] fixed FP in async blocks that are not awaited
75+
[#15157](https://github.com/rust-lang/rust-clippy/pull/15157)
76+
* [`iter_on_single_items`] fixed FP on function pointers and let statements
77+
[#15013](https://github.com/rust-lang/rust-clippy/pull/15013)
78+
79+
### ICE Fixes
80+
81+
* [`len_zero`] fix ICE when fn len has a return type without generic type params
82+
[#15660](https://github.com/rust-lang/rust-clippy/pull/15660)
83+
84+
### Documentation Improvements
85+
86+
* [`cognitive_complexity`] corrected documentation to state lint is in `restriction`, not `nursery`
87+
[#15563](https://github.com/rust-lang/rust-clippy/pull/15563)
88+
89+
### Performance Improvements
90+
91+
* [`doc_broken_link`] optimized by 99.77% (12M → 27k instructions)
92+
[#15385](https://github.com/rust-lang/rust-clippy/pull/15385)
93+
1194
## Rust 1.90
1295

1396
Current stable, released 2025-09-18
@@ -6253,6 +6336,7 @@ Released 2018-09-13
62536336
[`empty_drop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_drop
62546337
[`empty_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum
62556338
[`empty_enum_variants_with_brackets`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum_variants_with_brackets
6339+
[`empty_enums`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enums
62566340
[`empty_line_after_doc_comments`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
62576341
[`empty_line_after_outer_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
62586342
[`empty_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_loop
@@ -6583,6 +6667,7 @@ Released 2018-09-13
65836667
[`needless_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_else
65846668
[`needless_for_each`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
65856669
[`needless_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_if
6670+
[`needless_ifs`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_ifs
65866671
[`needless_late_init`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
65876672
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
65886673
[`needless_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_match
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# The Rust Code of Conduct
22

3-
The Code of Conduct for this repository [can be found online](https://www.rust-lang.org/conduct.html).
3+
The Code of Conduct for this repository [can be found online](https://rust-lang.org/policies/code-of-conduct/).

src/tools/clippy/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.92"
3+
version = "0.1.93"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

src/tools/clippy/book/book.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[book]
22
authors = ["The Rust Clippy Developers"]
33
language = "en"
4-
multilingual = false
5-
src = "src"
64
title = "Clippy Documentation"
75

86
[rust]

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ use clippy_utils::sym;
2121
impl<'tcx> LateLintPass<'tcx> for OurFancyMethodLint {
2222
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
2323
// Check our expr is calling a method with pattern matching
24-
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..], _) = &expr.kind
24+
if let hir::ExprKind::MethodCall(path, _, _, _) = &expr.kind
2525
// Check if the name of this method is `our_fancy_method`
2626
&& path.ident.name == sym::our_fancy_method
27-
// We can check the type of the self argument whenever necessary.
28-
// (It's necessary if we want to check that method is specifically belonging to a specific trait,
29-
// for example, a `map` method could belong to user-defined trait instead of to `Iterator`)
27+
// Check if the method belongs to the `sym::OurFancyTrait` trait.
28+
// (for example, a `map` method could belong to user-defined trait instead of to `Iterator`)
3029
// See the next section for more information.
31-
&& cx.ty_based_def(self_arg).opt_parent(cx).is_diag_item(cx, sym::OurFancyTrait)
30+
&& cx.ty_based_def(expr).opt_parent(cx).is_diag_item(cx, sym::OurFancyTrait)
3231
{
3332
println!("`expr` is a method call for `our_fancy_method`");
3433
}
@@ -45,6 +44,12 @@ New symbols such as `our_fancy_method` need to be added to the `clippy_utils::sy
4544
This module extends the list of symbols already provided by the compiler crates
4645
in `rustc_span::sym`.
4746

47+
If a trait defines only one method (such as the `std::ops::Deref` trait, which only has the `deref()` method),
48+
one might be tempted to omit the method name check. This would work, but is not always advisable because:
49+
- If a new method (possibly with a default implementation) were to be added to the trait, there would be a risk of
50+
matching the wrong method.
51+
- Comparing symbols is very cheap and might prevent a more expensive lookup.
52+
4853
## Checking if a `impl` block implements a method
4954

5055
While sometimes we want to check whether a method is being called or not, other

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
859859
* [`io_other_error`](https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error)
860860
* [`iter_kv_map`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map)
861861
* [`legacy_numeric_constants`](https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants)
862+
* [`len_zero`](https://rust-lang.github.io/rust-clippy/master/index.html#len_zero)
862863
* [`lines_filter_map_ok`](https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok)
863864
* [`manual_abs_diff`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_abs_diff)
864865
* [`manual_bits`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits)

src/tools/clippy/clippy_config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.92"
3+
version = "0.1.93"
44
edition = "2024"
55
publish = false
66

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ define_Conf! {
748748
io_other_error,
749749
iter_kv_map,
750750
legacy_numeric_constants,
751+
len_zero,
751752
lines_filter_map_ok,
752753
manual_abs_diff,
753754
manual_bits,

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use crate::update_lints::{DeprecatedLint, Lint, find_lint_decls, generate_lint_files, read_deprecated_lints};
1+
use crate::parse::{DeprecatedLint, Lint, ParseCx};
2+
use crate::update_lints::generate_lint_files;
23
use crate::utils::{UpdateMode, Version};
34
use std::ffi::OsStr;
45
use std::path::{Path, PathBuf};
@@ -13,21 +14,20 @@ use std::{fs, io};
1314
/// # Panics
1415
///
1516
/// If a file path could not read from or written to
16-
pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
17-
if let Some((prefix, _)) = name.split_once("::") {
18-
panic!("`{name}` should not contain the `{prefix}` prefix");
19-
}
20-
21-
let mut lints = find_lint_decls();
22-
let (mut deprecated_lints, renamed_lints) = read_deprecated_lints();
17+
pub fn deprecate<'cx>(cx: ParseCx<'cx>, clippy_version: Version, name: &'cx str, reason: &'cx str) {
18+
let mut lints = cx.find_lint_decls();
19+
let (mut deprecated_lints, renamed_lints) = cx.read_deprecated_lints();
2320

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

29-
let prefixed_name = String::from_iter(["clippy::", name]);
30-
match deprecated_lints.binary_search_by(|x| x.name.cmp(&prefixed_name)) {
26+
let prefixed_name = cx.str_buf.with(|buf| {
27+
buf.extend(["clippy::", name]);
28+
cx.arena.alloc_str(buf)
29+
});
30+
match deprecated_lints.binary_search_by(|x| x.name.cmp(prefixed_name)) {
3131
Ok(_) => {
3232
println!("`{name}` is already deprecated");
3333
return;
@@ -36,8 +36,8 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
3636
idx,
3737
DeprecatedLint {
3838
name: prefixed_name,
39-
reason: reason.into(),
40-
version: clippy_version.rust_display().to_string(),
39+
reason,
40+
version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
4141
},
4242
),
4343
}
@@ -61,8 +61,8 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
6161
}
6262
}
6363

64-
fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint>) -> io::Result<bool> {
65-
fn remove_lint(name: &str, lints: &mut Vec<Lint>) {
64+
fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint<'_>>) -> io::Result<bool> {
65+
fn remove_lint(name: &str, lints: &mut Vec<Lint<'_>>) {
6666
lints.iter().position(|l| l.name == name).map(|pos| lints.remove(pos));
6767
}
6868

@@ -135,14 +135,14 @@ fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint>) -> io
135135
);
136136

137137
assert!(
138-
content[lint.declaration_range.clone()].contains(&name.to_uppercase()),
138+
content[lint.declaration_range].contains(&name.to_uppercase()),
139139
"error: `{}` does not contain lint `{}`'s declaration",
140140
path.display(),
141141
lint.name
142142
);
143143

144144
// Remove lint declaration (declare_clippy_lint!)
145-
content.replace_range(lint.declaration_range.clone(), "");
145+
content.replace_range(lint.declaration_range, "");
146146

147147
// Remove the module declaration (mod xyz;)
148148
let mod_decl = format!("\nmod {name};");

0 commit comments

Comments
 (0)