r? @ghost

changelog: none
This commit is contained in:
Philipp Krones 2025-12-11 18:00:44 +00:00 committed by GitHub
commit 9e3e9649cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 85 additions and 44 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.93"
version = "0.1.94"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"

View file

@ -1,6 +1,6 @@
[package]
name = "clippy_config"
version = "0.1.93"
version = "0.1.94"
edition = "2024"
publish = false

View file

@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.93"
version = "0.1.94"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"

View file

@ -1,4 +1,4 @@
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(box_patterns)]
#![feature(macro_metavar_expr_concat)]
#![feature(f128)]

View file

@ -92,8 +92,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive {
(matches!(v.data, VariantData::Unit(_, _)) && is_doc_hidden(cx.tcx.hir_attrs(v.hir_id)))
.then_some((v.def_id, v.span))
});
// FIXME: rewrite in terms of `#![feature(exact_length_collection)]`. See: #149266
if let Ok((id, span)) = Itertools::exactly_one(iter)
if let Ok((id, span)) = iter.exactly_one()
&& !find_attr!(cx.tcx.hir_attrs(item.hir_id()), AttributeKind::NonExhaustive(..))
{
self.potential_enums.push((item.owner_id.def_id, id, item.span, span));
@ -105,8 +104,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive {
.iter()
.filter(|field| !cx.effective_visibilities.is_exported(field.def_id));
if fields.len() > 1
// FIXME: rewrite in terms of `#![feature(exact_length_collection)]`. See: #149266
&& let Ok(field) = Itertools::exactly_one(private_fields)
&& let Ok(field) = private_fields.exactly_one()
&& let TyKind::Tup([]) = field.ty.kind
{
span_lint_and_then(

View file

@ -545,7 +545,7 @@ fn ident_difference_expr_with_base_location(
| (Field(_, _), Field(_, _))
| (AssignOp(_, _, _), AssignOp(_, _, _))
| (Assign(_, _, _), Assign(_, _, _))
| (TryBlock(_), TryBlock(_))
| (TryBlock(_, _), TryBlock(_, _))
| (Await(_, _), Await(_, _))
| (Gen(_, _, _, _), Gen(_, _, _, _))
| (Block(_, _), Block(_, _))

View file

@ -1,6 +1,6 @@
[package]
name = "clippy_utils"
version = "0.1.93"
version = "0.1.94"
edition = "2024"
description = "Helpful tools for writing lints, provided as they are used in Clippy"
repository = "https://github.com/rust-lang/rust-clippy"
@ -16,6 +16,10 @@ itertools = "0.12"
rustc_apfloat = "0.2.0"
serde = { version = "1.0", features = ["derive"] }
[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = ['cfg(bootstrap)']
[package.metadata.rust-analyzer]
# This crate uses #[feature(rustc_private)]
rustc_private = true

View file

@ -8,7 +8,7 @@ This crate is only guaranteed to build with this `nightly` toolchain:
<!-- begin autogenerated nightly -->
```
nightly-2025-11-28
nightly-2025-12-11
```
<!-- end autogenerated nightly -->

View file

@ -199,7 +199,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
) => eq_label(ll.as_ref(), rl.as_ref()) && eq_pat(lp, rp) && eq_expr(li, ri) && eq_block(lt, rt) && lk == rk,
(Loop(lt, ll, _), Loop(rt, rl, _)) => eq_label(ll.as_ref(), rl.as_ref()) && eq_block(lt, rt),
(Block(lb, ll), Block(rb, rl)) => eq_label(ll.as_ref(), rl.as_ref()) && eq_block(lb, rb),
(TryBlock(l), TryBlock(r)) => eq_block(l, r),
(TryBlock(lb, lt), TryBlock(rb, rt)) => eq_block(lb, rb) && both(lt.as_deref(), rt.as_deref(), eq_ty),
(Yield(l), Yield(r)) => eq_expr_opt(l.expr().map(Box::as_ref), r.expr().map(Box::as_ref)) && l.same_kind(r),
(Ret(l), Ret(r)) => eq_expr_opt(l.as_deref(), r.as_deref()),
(Break(ll, le), Break(rl, re)) => {

View file

@ -5,7 +5,7 @@
#![feature(rustc_private)]
#![feature(assert_matches)]
#![feature(unwrap_infallible)]
#![feature(array_windows)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![recursion_limit = "512"]
#![allow(
clippy::missing_errors_doc,

View file

@ -150,7 +150,7 @@ fn check_rvalue<'tcx>(
CastKind::PointerCoercion(
PointerCoercion::UnsafeFnPointer
| PointerCoercion::ClosureFnPointer(_)
| PointerCoercion::ReifyFnPointer,
| PointerCoercion::ReifyFnPointer(_),
_,
),
_,

View file

@ -1,6 +1,6 @@
[package]
name = "declare_clippy_lint"
version = "0.1.93"
version = "0.1.94"
edition = "2024"
repository = "https://github.com/rust-lang/rust-clippy"
license = "MIT OR Apache-2.0"

View file

@ -1,6 +1,6 @@
[toolchain]
# begin autogenerated nightly
channel = "nightly-2025-11-28"
channel = "nightly-2025-12-11"
# end autogenerated nightly
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
profile = "minimal"

View file

@ -71,10 +71,10 @@ LL | impl<T: core::cmp::Eq> core::fmt::Display for X<T>
| ^^^^^^^^^^^^^^^^^^
error: consider bringing this path into scope with the `use` keyword
--> tests/ui-toml/absolute_paths/absolute_paths.rs:113:14
--> tests/ui-toml/absolute_paths/absolute_paths.rs:113:10
|
LL | pub const _: crate::S = {
| ^^^^^^^^
LL | const _: crate::S = {
| ^^^^^^^^
error: consider bringing this path into scope with the `use` keyword
--> tests/ui-toml/absolute_paths/absolute_paths.rs:114:9

View file

@ -110,7 +110,7 @@ mod m1 {
}
//~[no_short]v absolute_paths
pub const _: crate::S = {
const _: crate::S = {
let crate::S = m1::S; //~[no_short] absolute_paths
crate::m1::S

View file

@ -1,4 +1,4 @@
error[E0412]: cannot find type `PhantomData` in this scope
error[E0425]: cannot find type `PhantomData` in this scope
--> tests/ui/crashes/ice-6252.rs:9:9
|
LL | _n: PhantomData,
@ -9,7 +9,7 @@ help: consider importing this struct
LL + use std::marker::PhantomData;
|
error[E0412]: cannot find type `VAL` in this scope
error[E0425]: cannot find type `VAL` in this scope
--> tests/ui/crashes/ice-6252.rs:12:63
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
@ -31,5 +31,5 @@ LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0046, E0412.
Some errors have detailed explanations: E0046, E0425.
For more information about an error, try `rustc --explain E0046`.

View file

@ -1,8 +1,8 @@
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:8:1
--> tests/ui/future_not_send.rs:8:62
|
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future` is not `Send`
| ^^^^ future returned by `private_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> tests/ui/future_not_send.rs:11:20
@ -23,10 +23,10 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
= help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:14:1
--> tests/ui/future_not_send.rs:14:41
|
LL | pub async fn public_future(rc: Rc<[u8]>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send`
| ^ future returned by `public_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> tests/ui/future_not_send.rs:17:20
@ -39,10 +39,10 @@ LL | async { true }.await;
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:24:1
--> tests/ui/future_not_send.rs:24:63
|
LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future2` is not `Send`
| ^^^^ future returned by `private_future2` is not `Send`
|
note: captured value is not `Send`
--> tests/ui/future_not_send.rs:24:26
@ -58,10 +58,10 @@ LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:30:1
--> tests/ui/future_not_send.rs:30:42
|
LL | pub async fn public_future2(rc: Rc<[u8]>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future2` is not `Send`
| ^ future returned by `public_future2` is not `Send`
|
note: captured value is not `Send`
--> tests/ui/future_not_send.rs:30:29
@ -71,10 +71,10 @@ LL | pub async fn public_future2(rc: Rc<[u8]>) {}
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:42:5
--> tests/ui/future_not_send.rs:42:39
|
LL | async fn private_future(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future` is not `Send`
| ^^^^^ future returned by `private_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> tests/ui/future_not_send.rs:45:24
@ -87,10 +87,10 @@ LL | async { true }.await;
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:49:5
--> tests/ui/future_not_send.rs:49:38
|
LL | pub async fn public_future(&self) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send`
| ^ future returned by `public_future` is not `Send`
|
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> tests/ui/future_not_send.rs:49:32
@ -100,13 +100,10 @@ LL | pub async fn public_future(&self) {
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:61:1
--> tests/ui/future_not_send.rs:61:37
|
LL | / async fn generic_future<T>(t: T) -> T
LL | |
LL | | where
LL | | T: Send,
| |____________^ future returned by `generic_future` is not `Send`
LL | async fn generic_future<T>(t: T) -> T
| ^ future returned by `generic_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> tests/ui/future_not_send.rs:67:20
@ -118,10 +115,10 @@ LL | async { true }.await;
= note: `T` doesn't implement `std::marker::Sync`
error: future cannot be sent between threads safely
--> tests/ui/future_not_send.rs:83:1
--> tests/ui/future_not_send.rs:83:51
|
LL | async fn generic_future_always_unsend<T>(_: Rc<T>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `generic_future_always_unsend` is not `Send`
| ^ future returned by `generic_future_always_unsend` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> tests/ui/future_not_send.rs:86:20

View file

@ -9,6 +9,9 @@ LL | fn fut() -> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - fn fut() -> impl Future<Output = i32> {
LL -
LL - async { 42 }
LL - }
LL + async fn fut() -> i32 { 42 }
|
@ -21,6 +24,9 @@ LL | fn fut2() ->impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - fn fut2() ->impl Future<Output = i32> {
LL -
LL - async { 42 }
LL - }
LL + async fn fut2() -> i32 { 42 }
|
@ -33,6 +39,9 @@ LL | fn fut3()-> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - fn fut3()-> impl Future<Output = i32> {
LL -
LL - async { 42 }
LL - }
LL + async fn fut3() -> i32 { 42 }
|
@ -45,6 +54,9 @@ LL | fn empty_fut() -> impl Future<Output = ()> {
help: make the function `async` and return the output of the future directly
|
LL - fn empty_fut() -> impl Future<Output = ()> {
LL -
LL - async {}
LL - }
LL + async fn empty_fut() {}
|
@ -57,6 +69,9 @@ LL | fn empty_fut2() ->impl Future<Output = ()> {
help: make the function `async` and return the output of the future directly
|
LL - fn empty_fut2() ->impl Future<Output = ()> {
LL -
LL - async {}
LL - }
LL + async fn empty_fut2() {}
|
@ -69,6 +84,9 @@ LL | fn empty_fut3()-> impl Future<Output = ()> {
help: make the function `async` and return the output of the future directly
|
LL - fn empty_fut3()-> impl Future<Output = ()> {
LL -
LL - async {}
LL - }
LL + async fn empty_fut3() {}
|
@ -81,6 +99,9 @@ LL | fn core_fut() -> impl core::future::Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - fn core_fut() -> impl core::future::Future<Output = i32> {
LL -
LL - async move { 42 }
LL - }
LL + async fn core_fut() -> i32 { 42 }
|
@ -116,6 +137,9 @@ LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ {
help: make the function `async` and return the output of the future directly
|
LL - fn elided(_: &i32) -> impl Future<Output = i32> + '_ {
LL -
LL - async { 42 }
LL - }
LL + async fn elided(_: &i32) -> i32 { 42 }
|
@ -128,6 +152,9 @@ LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> +
help: make the function `async` and return the output of the future directly
|
LL - fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b {
LL -
LL - async { 42 }
LL - }
LL + async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 { 42 }
|
@ -140,6 +167,9 @@ LL | pub fn issue_10450() -> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - pub fn issue_10450() -> impl Future<Output = i32> {
LL -
LL - async { 42 }
LL - }
LL + pub async fn issue_10450() -> i32 { 42 }
|
@ -152,6 +182,9 @@ LL | pub(crate) fn issue_10450_2() -> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - pub(crate) fn issue_10450_2() -> impl Future<Output = i32> {
LL -
LL - async { 42 }
LL - }
LL + pub(crate) async fn issue_10450_2() -> i32 { 42 }
|
@ -164,6 +197,9 @@ LL | pub(self) fn issue_10450_3() -> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL - pub(self) fn issue_10450_3() -> impl Future<Output = i32> {
LL -
LL - async { 42 }
LL - }
LL + pub(self) async fn issue_10450_3() -> i32 { 42 }
|

View file

@ -12,6 +12,9 @@ LL | | .unwrap_or(0);
help: use `map_or(<a>, <f>)` instead
|
LL - let _ = opt.map(|x| x + 1)
LL -
LL - // Should lint even though this call is on a separate line.
LL - .unwrap_or(0);
LL + let _ = opt.map_or(0, |x| x + 1);
|
@ -98,6 +101,7 @@ LL | | .unwrap_or(None);
help: use `and_then(<f>)` instead
|
LL - .map(|x| Some(x + 1))
LL - .unwrap_or(None);
LL + .and_then(|x| Some(x + 1));
|

View file

@ -30,7 +30,6 @@ help: otherwise remove the non-wildcard arms
|
LL - 2 => 'b',
LL - 3 => 'b',
LL + _ => 'b',
|
error: these match arms have identical bodies

View file

@ -28,6 +28,8 @@ LL | | }
help: change this to
|
LL - fn partial_cmp(&self, _: &Self) -> Option<Ordering> {
LL - todo!();
LL - }
LL + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
|

View file

@ -310,6 +310,7 @@ LL | "name", 5, "x", 0.01
help: try
|
LL - "Hello {}: {2} is {3:.*} (which {3} with {1} places)",
LL - "name", 5, "x", 0.01
LL + "Hello name: x is {1:.*} (which {1} with {0} places)", 5, 0.01
|