From 9bd159a9f7060142c0223cdebda4f4d8589dd286 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 01/11] Attributes cleanup in tests [13/20] --- tests/ui/needless_borrow.fixed | 12 +- tests/ui/needless_borrow.rs | 12 +- tests/ui/needless_borrow.stderr | 56 ++++---- tests/ui/needless_borrow_pat.fixed | 5 +- tests/ui/needless_borrow_pat.rs | 5 +- tests/ui/needless_borrowed_ref.fixed | 4 +- tests/ui/needless_borrowed_ref.rs | 4 +- tests/ui/needless_borrowed_ref.stderr | 34 ++--- .../needless_borrows_for_generic_args.fixed | 7 +- tests/ui/needless_borrows_for_generic_args.rs | 7 +- .../needless_borrows_for_generic_args.stderr | 10 +- tests/ui/needless_character_iteration.fixed | 3 +- tests/ui/needless_character_iteration.rs | 3 +- tests/ui/needless_character_iteration.stderr | 18 +-- tests/ui/needless_collect.fixed | 14 +- tests/ui/needless_collect.rs | 14 +- tests/ui/needless_collect.stderr | 52 ++++---- tests/ui/needless_collect_indirect.fixed | 9 +- tests/ui/needless_collect_indirect.rs | 9 +- tests/ui/needless_collect_indirect.stderr | 32 ++--- tests/ui/needless_continue.rs | 2 +- tests/ui/needless_else.fixed | 2 - tests/ui/needless_else.rs | 2 - tests/ui/needless_else.stderr | 2 +- tests/ui/needless_for_each_fixable.fixed | 3 +- tests/ui/needless_for_each_fixable.rs | 3 +- tests/ui/needless_for_each_fixable.stderr | 24 ++-- tests/ui/needless_for_each_unfixable.rs | 2 +- tests/ui/needless_ifs.fixed | 18 ++- tests/ui/needless_ifs.rs | 16 +-- tests/ui/needless_ifs.stderr | 22 +-- tests/ui/needless_late_init.fixed | 12 +- tests/ui/needless_late_init.rs | 12 +- tests/ui/needless_late_init.stderr | 34 ++--- tests/ui/needless_lifetimes.fixed | 17 +-- tests/ui/needless_lifetimes.rs | 17 +-- tests/ui/needless_lifetimes.stderr | 84 ++++++------ tests/ui/needless_match.fixed | 4 +- tests/ui/needless_match.rs | 4 +- tests/ui/needless_match.stderr | 30 ++--- tests/ui/needless_maybe_sized.fixed | 2 +- tests/ui/needless_maybe_sized.rs | 2 +- tests/ui/needless_option_as_deref.fixed | 3 +- tests/ui/needless_option_as_deref.rs | 3 +- tests/ui/needless_option_as_deref.stderr | 6 +- .../needless_parens_on_range_literals.fixed | 2 +- tests/ui/needless_parens_on_range_literals.rs | 2 +- tests/ui/needless_pass_by_ref_mut.rs | 8 +- tests/ui/needless_pass_by_ref_mut.stderr | 68 +++++----- tests/ui/needless_pass_by_ref_mut2.fixed | 1 - tests/ui/needless_pass_by_ref_mut2.rs | 1 - tests/ui/needless_pass_by_ref_mut2.stderr | 6 +- tests/ui/needless_pass_by_value.rs | 10 +- tests/ui/needless_pass_by_value.stderr | 62 ++++----- tests/ui/needless_pub_self.fixed | 1 - tests/ui/needless_pub_self.rs | 1 - tests/ui/needless_pub_self.stderr | 6 +- tests/ui/needless_question_mark.fixed | 8 +- tests/ui/needless_question_mark.rs | 8 +- tests/ui/needless_question_mark.stderr | 30 ++--- tests/ui/needless_range_loop.rs | 7 +- tests/ui/needless_range_loop.stderr | 32 ++--- tests/ui/needless_range_loop2.rs | 2 +- tests/ui/needless_raw_string.fixed | 2 +- tests/ui/needless_raw_string.rs | 2 +- tests/ui/needless_raw_string_hashes.fixed | 2 +- tests/ui/needless_raw_string_hashes.rs | 2 +- tests/ui/needless_return.fixed | 11 +- tests/ui/needless_return.rs | 11 +- tests/ui/needless_return.stderr | 126 +++++++++--------- .../needless_return_with_question_mark.fixed | 9 +- .../ui/needless_return_with_question_mark.rs | 9 +- .../needless_return_with_question_mark.stderr | 10 +- tests/ui/needless_splitn.fixed | 3 +- tests/ui/needless_splitn.rs | 3 +- tests/ui/needless_splitn.stderr | 26 ++-- tests/ui/needless_type_cast.fixed | 2 +- tests/ui/needless_type_cast.rs | 2 +- tests/ui/needless_update.rs | 2 +- tests/ui/neg_multiply.fixed | 4 +- tests/ui/neg_multiply.rs | 4 +- tests/ui/new_ret_no_self.rs | 1 - tests/ui/new_ret_no_self.stderr | 24 ++-- tests/ui/new_without_default.fixed | 7 +- tests/ui/new_without_default.rs | 7 +- tests/ui/new_without_default.stderr | 30 ++--- tests/ui/no_effect.rs | 2 +- tests/ui/no_effect_return.rs | 2 +- tests/ui/no_mangle_with_rust_abi.rs | 1 - tests/ui/no_mangle_with_rust_abi.stderr | 12 +- tests/ui/no_mangle_with_rust_abi_2021.rs | 1 - tests/ui/no_mangle_with_rust_abi_2021.stderr | 10 +- tests/ui/non_canonical_clone_impl.fixed | 2 +- tests/ui/non_canonical_clone_impl.rs | 2 +- tests/ui/non_expressive_names.rs | 3 +- tests/ui/non_expressive_names.stderr | 12 +- tests/ui/non_minimal_cfg.fixed | 3 +- tests/ui/non_minimal_cfg.rs | 3 +- tests/ui/non_minimal_cfg.stderr | 8 +- 99 files changed, 553 insertions(+), 698 deletions(-) diff --git a/tests/ui/needless_borrow.fixed b/tests/ui/needless_borrow.fixed index 54cad2e393fd..fd17fbb7c093 100644 --- a/tests/ui/needless_borrow.fixed +++ b/tests/ui/needless_borrow.fixed @@ -1,13 +1,9 @@ -#![allow( - unused, - non_local_definitions, - clippy::uninlined_format_args, - clippy::unnecessary_mut_passed, - clippy::unnecessary_to_owned, +#![warn(clippy::needless_borrow)] +#![expect( + clippy::needless_lifetimes, clippy::unnecessary_literal_unwrap, - clippy::needless_lifetimes + clippy::unnecessary_mut_passed )] -#![warn(clippy::needless_borrow)] fn main() { let a = 5; diff --git a/tests/ui/needless_borrow.rs b/tests/ui/needless_borrow.rs index b698c6bfc969..a96252bcb3be 100644 --- a/tests/ui/needless_borrow.rs +++ b/tests/ui/needless_borrow.rs @@ -1,13 +1,9 @@ -#![allow( - unused, - non_local_definitions, - clippy::uninlined_format_args, - clippy::unnecessary_mut_passed, - clippy::unnecessary_to_owned, +#![warn(clippy::needless_borrow)] +#![expect( + clippy::needless_lifetimes, clippy::unnecessary_literal_unwrap, - clippy::needless_lifetimes + clippy::unnecessary_mut_passed )] -#![warn(clippy::needless_borrow)] fn main() { let a = 5; diff --git a/tests/ui/needless_borrow.stderr b/tests/ui/needless_borrow.stderr index 172d36bd73a0..e7a488b9ed92 100644 --- a/tests/ui/needless_borrow.stderr +++ b/tests/ui/needless_borrow.stderr @@ -1,5 +1,5 @@ error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:16:15 + --> tests/ui/needless_borrow.rs:12:15 | LL | let _ = x(&&a); // warn | ^^^ help: change this to: `&a` @@ -8,163 +8,163 @@ LL | let _ = x(&&a); // warn = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:22:13 + --> tests/ui/needless_borrow.rs:18:13 | LL | mut_ref(&mut &mut b); // warn | ^^^^^^^^^^^ help: change this to: `&mut b` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:36:13 + --> tests/ui/needless_borrow.rs:32:13 | LL | &&a | ^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:39:15 + --> tests/ui/needless_borrow.rs:35:15 | LL | 46 => &&a, | ^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:46:27 + --> tests/ui/needless_borrow.rs:42:27 | LL | break &ref_a; | ^^^^^^ help: change this to: `ref_a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:54:15 + --> tests/ui/needless_borrow.rs:50:15 | LL | let _ = x(&&&a); | ^^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:56:15 + --> tests/ui/needless_borrow.rs:52:15 | LL | let _ = x(&mut &&a); | ^^^^^^^^ help: change this to: `&a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:58:15 + --> tests/ui/needless_borrow.rs:54:15 | LL | let _ = x(&&&mut b); | ^^^^^^^^ help: change this to: `&mut b` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:60:15 + --> tests/ui/needless_borrow.rs:56:15 | LL | let _ = x(&&ref_a); | ^^^^^^^ help: change this to: `ref_a` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:64:11 + --> tests/ui/needless_borrow.rs:60:11 | LL | x(&b); | ^^ help: change this to: `b` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:72:13 + --> tests/ui/needless_borrow.rs:68:13 | LL | mut_ref(&mut x); | ^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:74:13 + --> tests/ui/needless_borrow.rs:70:13 | LL | mut_ref(&mut &mut x); | ^^^^^^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:76:23 + --> tests/ui/needless_borrow.rs:72:23 | LL | let y: &mut i32 = &mut x; | ^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:78:23 + --> tests/ui/needless_borrow.rs:74:23 | LL | let y: &mut i32 = &mut &mut x; | ^^^^^^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:88:14 + --> tests/ui/needless_borrow.rs:84:14 | LL | 0 => &mut x, | ^^^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:95:14 + --> tests/ui/needless_borrow.rs:91:14 | LL | 0 => &mut x, | ^^^^^^ help: change this to: `x` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:108:13 + --> tests/ui/needless_borrow.rs:104:13 | LL | let _ = (&x).0; | ^^^^ help: change this to: `x` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:119:5 + --> tests/ui/needless_borrow.rs:115:5 | LL | (&&()).foo(); | ^^^^^^ help: change this to: `(&())` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:129:5 + --> tests/ui/needless_borrow.rs:125:5 | LL | (&&5).foo(); | ^^^^^ help: change this to: `(&5)` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:156:23 + --> tests/ui/needless_borrow.rs:152:23 | LL | let x: (&str,) = (&"",); | ^^^ help: change this to: `""` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:199:13 + --> tests/ui/needless_borrow.rs:195:13 | LL | (&self.f)() | ^^^^^^^^^ help: change this to: `(self.f)` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:209:13 + --> tests/ui/needless_borrow.rs:205:13 | LL | (&mut self.f)() | ^^^^^^^^^^^^^ help: change this to: `(self.f)` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:247:22 + --> tests/ui/needless_borrow.rs:243:22 | LL | let _ = &mut (&mut { x.u }).x; | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:255:22 + --> tests/ui/needless_borrow.rs:251:22 | LL | let _ = &mut (&mut { x.u }).x; | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:260:22 + --> tests/ui/needless_borrow.rs:256:22 | LL | let _ = &mut (&mut x.u).x; | ^^^^^^^^^^ help: change this to: `x.u` error: this expression borrows a value the compiler would automatically borrow - --> tests/ui/needless_borrow.rs:262:22 + --> tests/ui/needless_borrow.rs:258:22 | LL | let _ = &mut (&mut { x.u }).x; | ^^^^^^^^^^^^^^ help: change this to: `{ x.u }` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:284:23 + --> tests/ui/needless_borrow.rs:280:23 | LL | option.unwrap_or((&x.0,)); | ^^^^ help: change this to: `x.0` error: this expression creates a reference which is immediately dereferenced by the compiler - --> tests/ui/needless_borrow.rs:291:13 + --> tests/ui/needless_borrow.rs:287:13 | LL | let _ = (&slice).len(); | ^^^^^^^^ help: change this to: `slice` diff --git a/tests/ui/needless_borrow_pat.fixed b/tests/ui/needless_borrow_pat.fixed index 507186676c16..741283a755aa 100644 --- a/tests/ui/needless_borrow_pat.fixed +++ b/tests/ui/needless_borrow_pat.fixed @@ -1,5 +1,6 @@ #![warn(clippy::needless_borrow)] -#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)] +#![allow(clippy::needless_borrowed_reference)] +#![expect(clippy::explicit_auto_deref)] fn f1(_: &str) {} macro_rules! m1 { @@ -30,7 +31,6 @@ macro_rules! if_chain { }; } -#[allow(dead_code)] fn main() { let x = String::new(); @@ -160,7 +160,6 @@ impl T1 for S { } // Ok - used to error due to rustc bug -#[allow(dead_code)] #[derive(Debug)] enum Foo<'a> { Str(&'a str), diff --git a/tests/ui/needless_borrow_pat.rs b/tests/ui/needless_borrow_pat.rs index ef0f97301bcf..b5b3f8b4cc30 100644 --- a/tests/ui/needless_borrow_pat.rs +++ b/tests/ui/needless_borrow_pat.rs @@ -1,5 +1,6 @@ #![warn(clippy::needless_borrow)] -#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)] +#![allow(clippy::needless_borrowed_reference)] +#![expect(clippy::explicit_auto_deref)] fn f1(_: &str) {} macro_rules! m1 { @@ -30,7 +31,6 @@ macro_rules! if_chain { }; } -#[allow(dead_code)] fn main() { let x = String::new(); @@ -160,7 +160,6 @@ impl T1 for S { } // Ok - used to error due to rustc bug -#[allow(dead_code)] #[derive(Debug)] enum Foo<'a> { Str(&'a str), diff --git a/tests/ui/needless_borrowed_ref.fixed b/tests/ui/needless_borrowed_ref.fixed index 94f801118583..0db5ae5dbe54 100644 --- a/tests/ui/needless_borrowed_ref.fixed +++ b/tests/ui/needless_borrowed_ref.fixed @@ -1,10 +1,8 @@ #![warn(clippy::needless_borrowed_reference)] -#![allow( - unused, +#![expect( irrefutable_let_patterns, non_shorthand_field_patterns, clippy::needless_borrow, - clippy::needless_ifs, clippy::unneeded_wildcard_pattern )] diff --git a/tests/ui/needless_borrowed_ref.rs b/tests/ui/needless_borrowed_ref.rs index 77334e07b25e..95dcd1bbc731 100644 --- a/tests/ui/needless_borrowed_ref.rs +++ b/tests/ui/needless_borrowed_ref.rs @@ -1,10 +1,8 @@ #![warn(clippy::needless_borrowed_reference)] -#![allow( - unused, +#![expect( irrefutable_let_patterns, non_shorthand_field_patterns, clippy::needless_borrow, - clippy::needless_ifs, clippy::unneeded_wildcard_pattern )] diff --git a/tests/ui/needless_borrowed_ref.stderr b/tests/ui/needless_borrowed_ref.stderr index f29789c66334..980022715628 100644 --- a/tests/ui/needless_borrowed_ref.stderr +++ b/tests/ui/needless_borrowed_ref.stderr @@ -1,5 +1,5 @@ error: this pattern takes a reference on something that is being dereferenced - --> tests/ui/needless_borrowed_ref.rs:31:34 + --> tests/ui/needless_borrowed_ref.rs:29:34 | LL | let _ = v.iter_mut().filter(|&ref a| a.is_empty()); | ^^^^^^ @@ -13,7 +13,7 @@ LL + let _ = v.iter_mut().filter(|a| a.is_empty()); | error: this pattern takes a reference on something that is being dereferenced - --> tests/ui/needless_borrowed_ref.rs:36:17 + --> tests/ui/needless_borrowed_ref.rs:34:17 | LL | if let Some(&ref v) = thingy {} | ^^^^^^ @@ -25,7 +25,7 @@ LL + if let Some(v) = thingy {} | error: this pattern takes a reference on something that is being dereferenced - --> tests/ui/needless_borrowed_ref.rs:39:14 + --> tests/ui/needless_borrowed_ref.rs:37:14 | LL | if let &[&ref a, ref b] = slice_of_refs {} | ^^^^^^ @@ -37,7 +37,7 @@ LL + if let &[a, ref b] = slice_of_refs {} | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:42:9 + --> tests/ui/needless_borrowed_ref.rs:40:9 | LL | let &[ref a, ..] = &array; | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + let [a, ..] = &array; | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:44:9 + --> tests/ui/needless_borrowed_ref.rs:42:9 | LL | let &[ref a, ref b, ..] = &array; | ^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + let [a, b, ..] = &array; | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:47:12 + --> tests/ui/needless_borrowed_ref.rs:45:12 | LL | if let &[ref a, ref b] = slice {} | ^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + if let [a, b] = slice {} | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:49:12 + --> tests/ui/needless_borrowed_ref.rs:47:12 | LL | if let &[ref a, ref b] = &vec[..] {} | ^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + if let [a, b] = &vec[..] {} | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:52:12 + --> tests/ui/needless_borrowed_ref.rs:50:12 | LL | if let &[ref a, ref b, ..] = slice {} | ^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + if let [a, b, ..] = slice {} | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:54:12 + --> tests/ui/needless_borrowed_ref.rs:52:12 | LL | if let &[ref a, .., ref b] = slice {} | ^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + if let [a, .., b] = slice {} | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:56:12 + --> tests/ui/needless_borrowed_ref.rs:54:12 | LL | if let &[.., ref a, ref b] = slice {} | ^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + if let [.., a, b] = slice {} | error: dereferencing a slice pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:59:12 + --> tests/ui/needless_borrowed_ref.rs:57:12 | LL | if let &[ref a, _] = slice {} | ^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + if let [a, _] = slice {} | error: dereferencing a tuple pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:62:12 + --> tests/ui/needless_borrowed_ref.rs:60:12 | LL | if let &(ref a, ref b, ref c) = &tuple {} | ^^^^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + if let (a, b, c) = &tuple {} | error: dereferencing a tuple pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:64:12 + --> tests/ui/needless_borrowed_ref.rs:62:12 | LL | if let &(ref a, _, ref c) = &tuple {} | ^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL + if let (a, _, c) = &tuple {} | error: dereferencing a tuple pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:66:12 + --> tests/ui/needless_borrowed_ref.rs:64:12 | LL | if let &(ref a, ..) = &tuple {} | ^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + if let (a, ..) = &tuple {} | error: dereferencing a tuple pattern where every element takes a reference - --> tests/ui/needless_borrowed_ref.rs:69:12 + --> tests/ui/needless_borrowed_ref.rs:67:12 | LL | if let &TupleStruct(ref a, ..) = &tuple_struct {} | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + if let TupleStruct(a, ..) = &tuple_struct {} | error: dereferencing a struct pattern where every field's pattern takes a reference - --> tests/ui/needless_borrowed_ref.rs:72:12 + --> tests/ui/needless_borrowed_ref.rs:70:12 | LL | if let &Struct { | ____________^ @@ -202,7 +202,7 @@ LL ~ c: renamed, | error: dereferencing a struct pattern where every field's pattern takes a reference - --> tests/ui/needless_borrowed_ref.rs:80:12 + --> tests/ui/needless_borrowed_ref.rs:78:12 | LL | if let &Struct { ref a, b: _, .. } = &s {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/needless_borrows_for_generic_args.fixed b/tests/ui/needless_borrows_for_generic_args.fixed index 8dea0d259772..dfa85b262390 100644 --- a/tests/ui/needless_borrows_for_generic_args.fixed +++ b/tests/ui/needless_borrows_for_generic_args.fixed @@ -1,8 +1,8 @@ #![warn(clippy::needless_borrows_for_generic_args)] -#![allow( - clippy::unnecessary_to_owned, +#![expect( + clippy::needless_borrow, clippy::unnecessary_literal_unwrap, - clippy::needless_borrow + clippy::unnecessary_to_owned )] use core::ops::Deref; @@ -128,7 +128,6 @@ fn main() { fn dont_warn(mut x: Iter) { takes_iter(&mut x); } - #[allow(unused_mut)] fn warn(mut x: &mut Iter) { takes_iter(x) //~^ needless_borrows_for_generic_args diff --git a/tests/ui/needless_borrows_for_generic_args.rs b/tests/ui/needless_borrows_for_generic_args.rs index bc2db6774e96..5ef3d732bf73 100644 --- a/tests/ui/needless_borrows_for_generic_args.rs +++ b/tests/ui/needless_borrows_for_generic_args.rs @@ -1,8 +1,8 @@ #![warn(clippy::needless_borrows_for_generic_args)] -#![allow( - clippy::unnecessary_to_owned, +#![expect( + clippy::needless_borrow, clippy::unnecessary_literal_unwrap, - clippy::needless_borrow + clippy::unnecessary_to_owned )] use core::ops::Deref; @@ -128,7 +128,6 @@ fn main() { fn dont_warn(mut x: Iter) { takes_iter(&mut x); } - #[allow(unused_mut)] fn warn(mut x: &mut Iter) { takes_iter(&mut x) //~^ needless_borrows_for_generic_args diff --git a/tests/ui/needless_borrows_for_generic_args.stderr b/tests/ui/needless_borrows_for_generic_args.stderr index 8829854e3073..5f7a14ade261 100644 --- a/tests/ui/needless_borrows_for_generic_args.stderr +++ b/tests/ui/needless_borrows_for_generic_args.stderr @@ -38,31 +38,31 @@ LL | multiple_constraints_normalizes_to_same(&X, X); | ^^ help: change this to: `X` error: the borrowed expression implements the required traits - --> tests/ui/needless_borrows_for_generic_args.rs:133:24 + --> tests/ui/needless_borrows_for_generic_args.rs:132:24 | LL | takes_iter(&mut x) | ^^^^^^ help: change this to: `x` error: the borrowed expression implements the required traits - --> tests/ui/needless_borrows_for_generic_args.rs:143:41 + --> tests/ui/needless_borrows_for_generic_args.rs:142:41 | LL | let _ = Command::new("ls").args(&["-a", "-l"]).status().unwrap(); | ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]` error: the borrowed expression implements the required traits - --> tests/ui/needless_borrows_for_generic_args.rs:255:13 + --> tests/ui/needless_borrows_for_generic_args.rs:254:13 | LL | foo(&a); | ^^ help: change this to: `a` error: the borrowed expression implements the required traits - --> tests/ui/needless_borrows_for_generic_args.rs:340:11 + --> tests/ui/needless_borrows_for_generic_args.rs:339:11 | LL | f(&String::new()); // Lint, makes no difference | ^^^^^^^^^^^^^^ help: change this to: `String::new()` error: the borrowed expression implements the required traits - --> tests/ui/needless_borrows_for_generic_args.rs:345:11 + --> tests/ui/needless_borrows_for_generic_args.rs:344:11 | LL | f(&"".to_owned()); // Lint | ^^^^^^^^^^^^^^ help: change this to: `"".to_owned()` diff --git a/tests/ui/needless_character_iteration.fixed b/tests/ui/needless_character_iteration.fixed index e25db9bb590f..b75020894ce5 100644 --- a/tests/ui/needless_character_iteration.fixed +++ b/tests/ui/needless_character_iteration.fixed @@ -1,5 +1,6 @@ #![warn(clippy::needless_character_iteration)] -#![allow(clippy::map_identity, clippy::unnecessary_operation)] +#![allow(clippy::unnecessary_operation)] +#![expect(clippy::map_identity)] #[derive(Default)] struct S { diff --git a/tests/ui/needless_character_iteration.rs b/tests/ui/needless_character_iteration.rs index 9b184dab6bc8..df2f9f34f592 100644 --- a/tests/ui/needless_character_iteration.rs +++ b/tests/ui/needless_character_iteration.rs @@ -1,5 +1,6 @@ #![warn(clippy::needless_character_iteration)] -#![allow(clippy::map_identity, clippy::unnecessary_operation)] +#![allow(clippy::unnecessary_operation)] +#![expect(clippy::map_identity)] #[derive(Default)] struct S { diff --git a/tests/ui/needless_character_iteration.stderr b/tests/ui/needless_character_iteration.stderr index 995404996644..3cdf9de012e9 100644 --- a/tests/ui/needless_character_iteration.stderr +++ b/tests/ui/needless_character_iteration.stderr @@ -1,5 +1,5 @@ error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:18:5 + --> tests/ui/needless_character_iteration.rs:19:5 | LL | "foo".chars().all(|c| c.is_ascii()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"foo".is_ascii()` @@ -8,37 +8,37 @@ LL | "foo".chars().all(|c| c.is_ascii()); = help: to override `-D warnings` add `#[allow(clippy::needless_character_iteration)]` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:21:5 + --> tests/ui/needless_character_iteration.rs:22:5 | LL | "foo".chars().any(|c| !c.is_ascii()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!"foo".is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:24:5 + --> tests/ui/needless_character_iteration.rs:25:5 | LL | "foo".chars().all(|c| char::is_ascii(&c)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"foo".is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:27:5 + --> tests/ui/needless_character_iteration.rs:28:5 | LL | "foo".chars().any(|c| !char::is_ascii(&c)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!"foo".is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:31:5 + --> tests/ui/needless_character_iteration.rs:32:5 | LL | s.chars().all(|c| c.is_ascii()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:34:5 + --> tests/ui/needless_character_iteration.rs:35:5 | LL | "foo".to_string().chars().any(|c| !c.is_ascii()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!"foo".to_string().is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:37:5 + --> tests/ui/needless_character_iteration.rs:38:5 | LL | / "foo".chars().all(|c| { LL | | @@ -49,7 +49,7 @@ LL | | }); | |______^ help: try: `"foo".is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:43:5 + --> tests/ui/needless_character_iteration.rs:44:5 | LL | / "foo".chars().any(|c| { LL | | @@ -60,7 +60,7 @@ LL | | }); | |______^ help: try: `!"foo".is_ascii()` error: checking if a string is ascii using iterators - --> tests/ui/needless_character_iteration.rs:50:5 + --> tests/ui/needless_character_iteration.rs:51:5 | LL | S::default().field().chars().all(|x| x.is_ascii()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `S::default().field().is_ascii()` diff --git a/tests/ui/needless_collect.fixed b/tests/ui/needless_collect.fixed index 2d59c1d42b05..a8067018b828 100644 --- a/tests/ui/needless_collect.fixed +++ b/tests/ui/needless_collect.fixed @@ -1,15 +1,7 @@ -#![allow( - unused, - clippy::needless_ifs, - clippy::suspicious_map, - clippy::iter_count, - clippy::manual_contains -)] - +#![warn(clippy::needless_collect)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList}; -#[warn(clippy::needless_collect)] -#[allow(unused_variables, clippy::iter_cloned_collect, clippy::iter_next_slice)] +#[allow(clippy::iter_cloned_collect, clippy::iter_next_slice)] fn main() { let sample = [1; 5]; let len = sample.iter().count(); @@ -192,6 +184,7 @@ pub fn issue8055(v: impl IntoIterator) -> Result { inner: T, @@ -220,7 +213,6 @@ fn issue16270() { _ = &(1..3).collect::>()[..]; } -#[warn(clippy::needless_collect)] mod collect_push_then_iter { use std::collections::{BinaryHeap, LinkedList, VecDeque}; diff --git a/tests/ui/needless_collect.rs b/tests/ui/needless_collect.rs index 346cddd88e70..109b873a2db2 100644 --- a/tests/ui/needless_collect.rs +++ b/tests/ui/needless_collect.rs @@ -1,15 +1,7 @@ -#![allow( - unused, - clippy::needless_ifs, - clippy::suspicious_map, - clippy::iter_count, - clippy::manual_contains -)] - +#![warn(clippy::needless_collect)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList}; -#[warn(clippy::needless_collect)] -#[allow(unused_variables, clippy::iter_cloned_collect, clippy::iter_next_slice)] +#[allow(clippy::iter_cloned_collect, clippy::iter_next_slice)] fn main() { let sample = [1; 5]; let len = sample.iter().collect::>().len(); @@ -192,6 +184,7 @@ pub fn issue8055(v: impl IntoIterator) -> Result { inner: T, @@ -220,7 +213,6 @@ fn issue16270() { _ = &(1..3).collect::>()[..]; } -#[warn(clippy::needless_collect)] mod collect_push_then_iter { use std::collections::{BinaryHeap, LinkedList, VecDeque}; diff --git a/tests/ui/needless_collect.stderr b/tests/ui/needless_collect.stderr index b10312224c8e..7e05410fb504 100644 --- a/tests/ui/needless_collect.stderr +++ b/tests/ui/needless_collect.stderr @@ -1,5 +1,5 @@ error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:15:29 + --> tests/ui/needless_collect.rs:7:29 | LL | let len = sample.iter().collect::>().len(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` @@ -8,121 +8,121 @@ LL | let len = sample.iter().collect::>().len(); = help: to override `-D warnings` add `#[allow(clippy::needless_collect)]` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:17:22 + --> tests/ui/needless_collect.rs:9:22 | LL | if sample.iter().collect::>().is_empty() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:21:28 + --> tests/ui/needless_collect.rs:13:28 | LL | sample.iter().cloned().collect::>().contains(&1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:24:36 + --> tests/ui/needless_collect.rs:16:36 | LL | let _ = sample.iter().cloned().collect::>()[1]; | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `nth(1).unwrap()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:31:35 + --> tests/ui/needless_collect.rs:23:35 | LL | sample.iter().map(|x| (x, x)).collect::>().is_empty(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:33:35 + --> tests/ui/needless_collect.rs:25:35 | LL | sample.iter().map(|x| (x, x)).collect::>().is_empty(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:41:19 + --> tests/ui/needless_collect.rs:33:19 | LL | sample.iter().collect::>().len(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:43:19 + --> tests/ui/needless_collect.rs:35:19 | LL | sample.iter().collect::>().is_empty(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:45:28 + --> tests/ui/needless_collect.rs:37:28 | LL | sample.iter().cloned().collect::>().contains(&1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:47:19 + --> tests/ui/needless_collect.rs:39:19 | LL | sample.iter().collect::>().contains(&&1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &1)` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:51:19 + --> tests/ui/needless_collect.rs:43:19 | LL | sample.iter().collect::>().len(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:53:19 + --> tests/ui/needless_collect.rs:45:19 | LL | sample.iter().collect::>().is_empty(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:59:27 + --> tests/ui/needless_collect.rs:51:27 | LL | let _ = sample.iter().collect::>().is_empty(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:61:27 + --> tests/ui/needless_collect.rs:53:27 | LL | let _ = sample.iter().collect::>().contains(&&0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:84:27 + --> tests/ui/needless_collect.rs:76:27 | LL | let _ = sample.iter().collect::>().is_empty(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:86:27 + --> tests/ui/needless_collect.rs:78:27 | LL | let _ = sample.iter().collect::>().contains(&&0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)` error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:91:40 + --> tests/ui/needless_collect.rs:83:40 | LL | Vec::::new().extend((0..10).collect::>()); | ^^^^^^^^^^^^^^^^^^^^ help: remove this call error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:93:20 + --> tests/ui/needless_collect.rs:85:20 | LL | foo((0..10).collect::>()); | ^^^^^^^^^^^^^^^^^^^^ help: remove this call error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:95:49 + --> tests/ui/needless_collect.rs:87:49 | LL | bar((0..10).collect::>(), (0..10).collect::>()); | ^^^^^^^^^^^^^^^^^^^^ help: remove this call error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:97:37 + --> tests/ui/needless_collect.rs:89:37 | LL | baz((0..10), (), ('a'..='z').collect::>()) | ^^^^^^^^^^^^^^^^^^^^ help: remove this call error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:228:26 + --> tests/ui/needless_collect.rs:220:26 | LL | let mut v = iter.collect::>(); | ^^^^^^^ @@ -139,7 +139,7 @@ LL ~ iter.chain([1]).map(|x| x + 1).collect() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:240:26 + --> tests/ui/needless_collect.rs:232:26 | LL | let mut v = iter.collect::>(); | ^^^^^^^ @@ -157,7 +157,7 @@ LL ~ iter.chain([1, 2]).map(|x| x + 1).collect() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:248:26 + --> tests/ui/needless_collect.rs:240:26 | LL | let mut v = iter.collect::>(); | ^^^^^^^ @@ -174,7 +174,7 @@ LL ~ iter.chain([1]).map(|x| x + 1).collect() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:268:27 + --> tests/ui/needless_collect.rs:260:27 | LL | let mut ll = iter.collect::>(); | ^^^^^^^ @@ -191,7 +191,7 @@ LL ~ iter.chain(s).map(|x| x + 1).collect() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:275:26 + --> tests/ui/needless_collect.rs:267:26 | LL | let mut v = iter.collect::>(); | ^^^^^^^ @@ -209,7 +209,7 @@ LL ~ [1, 2].into_iter().chain(iter).map(|x| x + 1).collect() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect.rs:286:26 + --> tests/ui/needless_collect.rs:278:26 | LL | let mut v = iter.collect::>(); | ^^^^^^^ diff --git a/tests/ui/needless_collect_indirect.fixed b/tests/ui/needless_collect_indirect.fixed index 22b9bb6f6a20..45104c34f778 100644 --- a/tests/ui/needless_collect_indirect.fixed +++ b/tests/ui/needless_collect_indirect.fixed @@ -1,11 +1,6 @@ -#![allow( - clippy::uninlined_format_args, - clippy::useless_vec, - clippy::needless_ifs, - clippy::iter_next_slice, - clippy::iter_count -)] #![warn(clippy::needless_collect)] +#![allow(clippy::iter_count, clippy::iter_next_slice)] +#![expect(clippy::needless_ifs, clippy::useless_vec)] use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque}; diff --git a/tests/ui/needless_collect_indirect.rs b/tests/ui/needless_collect_indirect.rs index 20b7ae91a6b8..77ac9fe29ba5 100644 --- a/tests/ui/needless_collect_indirect.rs +++ b/tests/ui/needless_collect_indirect.rs @@ -1,11 +1,6 @@ -#![allow( - clippy::uninlined_format_args, - clippy::useless_vec, - clippy::needless_ifs, - clippy::iter_next_slice, - clippy::iter_count -)] #![warn(clippy::needless_collect)] +#![allow(clippy::iter_count, clippy::iter_next_slice)] +#![expect(clippy::needless_ifs, clippy::useless_vec)] use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque}; diff --git a/tests/ui/needless_collect_indirect.stderr b/tests/ui/needless_collect_indirect.stderr index d34f1c37558d..c7bf1b14df80 100644 --- a/tests/ui/needless_collect_indirect.stderr +++ b/tests/ui/needless_collect_indirect.stderr @@ -1,5 +1,5 @@ error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:14:39 + --> tests/ui/needless_collect_indirect.rs:9:39 | LL | let indirect_iter = sample.iter().collect::>(); | ^^^^^^^ @@ -18,7 +18,7 @@ LL ~ sample.iter().map(|x| (x, x + 1)).collect::>(); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:18:38 + --> tests/ui/needless_collect_indirect.rs:13:38 | LL | let indirect_len = sample.iter().collect::>(); | ^^^^^^^ @@ -35,7 +35,7 @@ LL ~ sample.iter().count(); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:22:40 + --> tests/ui/needless_collect_indirect.rs:17:40 | LL | let indirect_empty = sample.iter().collect::>(); | ^^^^^^^ @@ -52,7 +52,7 @@ LL ~ sample.iter().next().is_none(); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:26:43 + --> tests/ui/needless_collect_indirect.rs:21:43 | LL | let indirect_contains = sample.iter().collect::>(); | ^^^^^^^ @@ -69,7 +69,7 @@ LL ~ sample.iter().any(|x| x == &5); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:40:48 + --> tests/ui/needless_collect_indirect.rs:35:48 | LL | let non_copy_contains = sample.into_iter().collect::>(); | ^^^^^^^ @@ -86,7 +86,7 @@ LL ~ sample.into_iter().any(|x| x == a); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:71:51 + --> tests/ui/needless_collect_indirect.rs:66:51 | LL | let buffer: Vec<&str> = string.split('/').collect(); | ^^^^^^^ @@ -103,7 +103,7 @@ LL ~ string.split('/').count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:78:55 + --> tests/ui/needless_collect_indirect.rs:73:55 | LL | let indirect_len: VecDeque<_> = sample.iter().collect(); | ^^^^^^^ @@ -120,7 +120,7 @@ LL ~ sample.iter().count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:85:57 + --> tests/ui/needless_collect_indirect.rs:80:57 | LL | let indirect_len: LinkedList<_> = sample.iter().collect(); | ^^^^^^^ @@ -137,7 +137,7 @@ LL ~ sample.iter().count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:92:57 + --> tests/ui/needless_collect_indirect.rs:87:57 | LL | let indirect_len: BinaryHeap<_> = sample.iter().collect(); | ^^^^^^^ @@ -154,7 +154,7 @@ LL ~ sample.iter().count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:154:59 + --> tests/ui/needless_collect_indirect.rs:149:59 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -172,7 +172,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == i); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:181:59 + --> tests/ui/needless_collect_indirect.rs:176:59 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -190,7 +190,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:212:63 + --> tests/ui/needless_collect_indirect.rs:207:63 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -208,7 +208,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:250:59 + --> tests/ui/needless_collect_indirect.rs:245:59 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -226,7 +226,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:277:26 + --> tests/ui/needless_collect_indirect.rs:272:26 | LL | let w = v.iter().collect::>(); | ^^^^^^^ @@ -244,7 +244,7 @@ LL ~ for _ in 0..v.iter().count() { | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:301:30 + --> tests/ui/needless_collect_indirect.rs:296:30 | LL | let mut w = v.iter().collect::>(); | ^^^^^^^ @@ -262,7 +262,7 @@ LL ~ while 1 == v.iter().count() { | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:325:30 + --> tests/ui/needless_collect_indirect.rs:320:30 | LL | let mut w = v.iter().collect::>(); | ^^^^^^^ diff --git a/tests/ui/needless_continue.rs b/tests/ui/needless_continue.rs index 3275dddf1a0f..a8bd2cdcb4a7 100644 --- a/tests/ui/needless_continue.rs +++ b/tests/ui/needless_continue.rs @@ -1,5 +1,5 @@ #![warn(clippy::needless_continue)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] macro_rules! zero { ($x:expr) => { diff --git a/tests/ui/needless_else.fixed b/tests/ui/needless_else.fixed index 0455910c3ee8..6a9cca8f7c14 100644 --- a/tests/ui/needless_else.fixed +++ b/tests/ui/needless_else.fixed @@ -1,6 +1,4 @@ -#![allow(unused)] #![warn(clippy::needless_else)] -#![allow(clippy::suspicious_else_formatting)] macro_rules! mac { ($test:expr) => { diff --git a/tests/ui/needless_else.rs b/tests/ui/needless_else.rs index 236ac631a49e..968ca590e8f0 100644 --- a/tests/ui/needless_else.rs +++ b/tests/ui/needless_else.rs @@ -1,6 +1,4 @@ -#![allow(unused)] #![warn(clippy::needless_else)] -#![allow(clippy::suspicious_else_formatting)] macro_rules! mac { ($test:expr) => { diff --git a/tests/ui/needless_else.stderr b/tests/ui/needless_else.stderr index 77ead31b31cc..0b43ca478525 100644 --- a/tests/ui/needless_else.stderr +++ b/tests/ui/needless_else.stderr @@ -1,5 +1,5 @@ error: this `else` branch is empty - --> tests/ui/needless_else.rs:23:7 + --> tests/ui/needless_else.rs:21:7 | LL | } else { | _______^ diff --git a/tests/ui/needless_for_each_fixable.fixed b/tests/ui/needless_for_each_fixable.fixed index 19b34f42af24..d6c7e42e13d3 100644 --- a/tests/ui/needless_for_each_fixable.fixed +++ b/tests/ui/needless_for_each_fixable.fixed @@ -1,6 +1,5 @@ #![warn(clippy::needless_for_each)] -#![allow(unused)] -#![allow( +#![expect( clippy::let_unit_value, clippy::match_single_binding, clippy::needless_return, diff --git a/tests/ui/needless_for_each_fixable.rs b/tests/ui/needless_for_each_fixable.rs index f04e2555a370..9bb2e6cf07d2 100644 --- a/tests/ui/needless_for_each_fixable.rs +++ b/tests/ui/needless_for_each_fixable.rs @@ -1,6 +1,5 @@ #![warn(clippy::needless_for_each)] -#![allow(unused)] -#![allow( +#![expect( clippy::let_unit_value, clippy::match_single_binding, clippy::needless_return, diff --git a/tests/ui/needless_for_each_fixable.stderr b/tests/ui/needless_for_each_fixable.stderr index 121669d15072..26d0da69c855 100644 --- a/tests/ui/needless_for_each_fixable.stderr +++ b/tests/ui/needless_for_each_fixable.stderr @@ -1,5 +1,5 @@ error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:15:5 + --> tests/ui/needless_for_each_fixable.rs:14:5 | LL | / v.iter().for_each(|elem| { LL | | @@ -18,7 +18,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:19:5 + --> tests/ui/needless_for_each_fixable.rs:18:5 | LL | / v.into_iter().for_each(|elem| { LL | | @@ -35,7 +35,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:24:5 + --> tests/ui/needless_for_each_fixable.rs:23:5 | LL | / [1, 2, 3].iter().for_each(|elem| { LL | | @@ -52,7 +52,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:30:5 + --> tests/ui/needless_for_each_fixable.rs:29:5 | LL | / hash_map.iter().for_each(|(k, v)| { LL | | @@ -69,7 +69,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:34:5 + --> tests/ui/needless_for_each_fixable.rs:33:5 | LL | / hash_map.iter_mut().for_each(|(k, v)| { LL | | @@ -86,7 +86,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:38:5 + --> tests/ui/needless_for_each_fixable.rs:37:5 | LL | / hash_map.keys().for_each(|k| { LL | | @@ -103,7 +103,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:42:5 + --> tests/ui/needless_for_each_fixable.rs:41:5 | LL | / hash_map.values().for_each(|v| { LL | | @@ -120,7 +120,7 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:50:5 + --> tests/ui/needless_for_each_fixable.rs:49:5 | LL | / my_vec().iter().for_each(|elem| { LL | | @@ -137,25 +137,25 @@ LL + } | error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:135:9 + --> tests/ui/needless_for_each_fixable.rs:134:9 | LL | rows.iter().for_each(|x| _ = v.push(x)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in rows.iter() { _ = v.push(x) }` error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:142:9 + --> tests/ui/needless_for_each_fixable.rs:141:9 | LL | rows.iter().for_each(|x| do_something(x, 1u8)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in rows.iter() { do_something(x, 1u8); }` error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:149:5 + --> tests/ui/needless_for_each_fixable.rs:148:5 | LL | vec.iter().for_each(|v| println!("{v}")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for v in vec.iter() { println!("{v}"); }` error: needless use of `for_each` - --> tests/ui/needless_for_each_fixable.rs:155:5 + --> tests/ui/needless_for_each_fixable.rs:154:5 | LL | / vec.iter().for_each(|elem| { LL | | diff --git a/tests/ui/needless_for_each_unfixable.rs b/tests/ui/needless_for_each_unfixable.rs index 24ce5786b910..1a7d0dba5f18 100644 --- a/tests/ui/needless_for_each_unfixable.rs +++ b/tests/ui/needless_for_each_unfixable.rs @@ -1,6 +1,6 @@ //@no-rustfix: overlapping suggestions #![warn(clippy::needless_for_each)] -#![allow(clippy::needless_return)] +#![expect(clippy::needless_return)] fn main() { let v: Vec = Vec::new(); diff --git a/tests/ui/needless_ifs.fixed b/tests/ui/needless_ifs.fixed index 89d5b1da7b3f..a72c680fa754 100644 --- a/tests/ui/needless_ifs.fixed +++ b/tests/ui/needless_ifs.fixed @@ -1,18 +1,17 @@ //@aux-build:proc_macros.rs +#![warn(clippy::needless_ifs)] #![allow( clippy::blocks_in_conditions, + clippy::no_effect, + clippy::short_circuit_statement, + clippy::unnecessary_operation +)] +#![expect( clippy::if_same_then_else, clippy::ifs_same_cond, - clippy::let_unit_value, clippy::needless_else, - clippy::no_effect, - clippy::nonminimal_bool, - clippy::short_circuit_statement, - clippy::unnecessary_operation, - clippy::redundant_pattern_matching, - unused + clippy::redundant_pattern_matching )] -#![warn(clippy::needless_ifs)] extern crate proc_macros; use proc_macros::{external, with_span}; @@ -97,8 +96,7 @@ fn main() { //~^ needless_ifs // Don't leave trailing attributes - #[allow(unused)] - true; + //~^ needless_ifs let () = if maybe_side_effect() {}; diff --git a/tests/ui/needless_ifs.rs b/tests/ui/needless_ifs.rs index 837eaaf9647b..370d15a168f5 100644 --- a/tests/ui/needless_ifs.rs +++ b/tests/ui/needless_ifs.rs @@ -1,18 +1,17 @@ //@aux-build:proc_macros.rs +#![warn(clippy::needless_ifs)] #![allow( clippy::blocks_in_conditions, + clippy::no_effect, + clippy::short_circuit_statement, + clippy::unnecessary_operation +)] +#![expect( clippy::if_same_then_else, clippy::ifs_same_cond, - clippy::let_unit_value, clippy::needless_else, - clippy::no_effect, - clippy::nonminimal_bool, - clippy::short_circuit_statement, - clippy::unnecessary_operation, - clippy::redundant_pattern_matching, - unused + clippy::redundant_pattern_matching )] -#![warn(clippy::needless_ifs)] extern crate proc_macros; use proc_macros::{external, with_span}; @@ -98,7 +97,6 @@ fn main() { //~^ needless_ifs // Don't leave trailing attributes - #[allow(unused)] if true {} //~^ needless_ifs diff --git a/tests/ui/needless_ifs.stderr b/tests/ui/needless_ifs.stderr index 7c7fcdc18366..8cd812dc3f37 100644 --- a/tests/ui/needless_ifs.stderr +++ b/tests/ui/needless_ifs.stderr @@ -1,5 +1,5 @@ error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:25:5 + --> tests/ui/needless_ifs.rs:24:5 | LL | if (true) {} | ^^^^^^^^^^^^ help: you can remove it @@ -8,13 +8,13 @@ LL | if (true) {} = help: to override `-D warnings` add `#[allow(clippy::needless_ifs)]` error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:28:5 + --> tests/ui/needless_ifs.rs:27:5 | LL | if maybe_side_effect() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `maybe_side_effect();` error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:34:5 + --> tests/ui/needless_ifs.rs:33:5 | LL | / if { LL | | @@ -31,7 +31,7 @@ LL + }); | error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:49:5 + --> tests/ui/needless_ifs.rs:48:5 | LL | / if { LL | | @@ -57,37 +57,37 @@ LL + } && true); | error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:94:5 + --> tests/ui/needless_ifs.rs:93:5 | LL | if { maybe_side_effect() } {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() });` error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:97:5 + --> tests/ui/needless_ifs.rs:96:5 | LL | if { maybe_side_effect() } && true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() } && true);` error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:102:5 + --> tests/ui/needless_ifs.rs:100:5 | LL | if true {} - | ^^^^^^^^^^ help: you can remove it: `true;` + | ^^^^^^^^^^ help: you can remove it error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:109:5 + --> tests/ui/needless_ifs.rs:107:5 | LL | if matches!(2, 3) {} | ^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `matches!(2, 3);` error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:111:5 + --> tests/ui/needless_ifs.rs:109:5 | LL | if matches!(2, 3) == (2 * 2 == 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `matches!(2, 3) == (2 * 2 == 5);` error: this `if` branch is empty - --> tests/ui/needless_ifs.rs:121:5 + --> tests/ui/needless_ifs.rs:119:5 | LL | if true {␋} | ^^^^^^^^^^^ help: you can remove it diff --git a/tests/ui/needless_late_init.fixed b/tests/ui/needless_late_init.fixed index b686a8e9f1a0..00cb4304d519 100644 --- a/tests/ui/needless_late_init.fixed +++ b/tests/ui/needless_late_init.fixed @@ -1,13 +1,7 @@ //@aux-build:proc_macros.rs -#![allow( - clippy::assign_op_pattern, - clippy::blocks_in_conditions, - clippy::let_and_return, - clippy::let_unit_value, - clippy::nonminimal_bool, - clippy::uninlined_format_args, - clippy::useless_vec -)] +#![warn(clippy::needless_late_init)] +#![allow(clippy::let_and_return)] +#![expect(clippy::blocks_in_conditions, clippy::let_unit_value, clippy::useless_vec)] extern crate proc_macros; diff --git a/tests/ui/needless_late_init.rs b/tests/ui/needless_late_init.rs index 23772ff70293..fd4e90900420 100644 --- a/tests/ui/needless_late_init.rs +++ b/tests/ui/needless_late_init.rs @@ -1,13 +1,7 @@ //@aux-build:proc_macros.rs -#![allow( - clippy::assign_op_pattern, - clippy::blocks_in_conditions, - clippy::let_and_return, - clippy::let_unit_value, - clippy::nonminimal_bool, - clippy::uninlined_format_args, - clippy::useless_vec -)] +#![warn(clippy::needless_late_init)] +#![allow(clippy::let_and_return)] +#![expect(clippy::blocks_in_conditions, clippy::let_unit_value, clippy::useless_vec)] extern crate proc_macros; diff --git a/tests/ui/needless_late_init.stderr b/tests/ui/needless_late_init.stderr index e3e25cdc8d76..ef157feb5b03 100644 --- a/tests/ui/needless_late_init.stderr +++ b/tests/ui/needless_late_init.stderr @@ -1,5 +1,5 @@ error: unneeded late initialization - --> tests/ui/needless_late_init.rs:25:5 + --> tests/ui/needless_late_init.rs:19:5 | LL | let a; | ^^^^^^ created here @@ -17,7 +17,7 @@ LL ~ let a = "zero"; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:29:5 + --> tests/ui/needless_late_init.rs:23:5 | LL | let b; | ^^^^^^ created here @@ -35,7 +35,7 @@ LL ~ let b = 1; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:31:5 + --> tests/ui/needless_late_init.rs:25:5 | LL | let c; | ^^^^^^ created here @@ -52,7 +52,7 @@ LL ~ let c = 2; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:36:5 + --> tests/ui/needless_late_init.rs:30:5 | LL | let d: usize; | ^^^^^^^^^^^^^ created here @@ -68,7 +68,7 @@ LL ~ let d: usize = 1; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:40:5 + --> tests/ui/needless_late_init.rs:34:5 | LL | let e; | ^^^^^^ created here @@ -84,7 +84,7 @@ LL ~ let e = format!("{}", d); | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:46:5 + --> tests/ui/needless_late_init.rs:40:5 | LL | let a; | ^^^^^^ @@ -103,7 +103,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:56:5 + --> tests/ui/needless_late_init.rs:50:5 | LL | let b; | ^^^^^^ @@ -120,7 +120,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:64:5 + --> tests/ui/needless_late_init.rs:58:5 | LL | let d; | ^^^^^^ @@ -138,7 +138,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:73:5 + --> tests/ui/needless_late_init.rs:67:5 | LL | let e; | ^^^^^^ @@ -155,7 +155,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:81:5 + --> tests/ui/needless_late_init.rs:75:5 | LL | let f; | ^^^^^^ @@ -169,7 +169,7 @@ LL ~ 1 => "three", | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:88:5 + --> tests/ui/needless_late_init.rs:82:5 | LL | let g: usize; | ^^^^^^^^^^^^^ @@ -186,7 +186,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:97:5 + --> tests/ui/needless_late_init.rs:91:5 | LL | let x; | ^^^^^^ created here @@ -203,7 +203,7 @@ LL ~ let x = 1; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:102:5 + --> tests/ui/needless_late_init.rs:96:5 | LL | let x; | ^^^^^^ created here @@ -220,7 +220,7 @@ LL ~ let x = SignificantDrop; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:107:5 + --> tests/ui/needless_late_init.rs:101:5 | LL | let x; | ^^^^^^ created here @@ -238,7 +238,7 @@ LL ~ let x = SignificantDrop; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:127:5 + --> tests/ui/needless_late_init.rs:121:5 | LL | let a; | ^^^^^^ @@ -257,7 +257,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:145:5 + --> tests/ui/needless_late_init.rs:139:5 | LL | let a; | ^^^^^^ @@ -276,7 +276,7 @@ LL ~ }; | error: unneeded late initialization - --> tests/ui/needless_late_init.rs:298:5 + --> tests/ui/needless_late_init.rs:292:5 | LL | let r; | ^^^^^^ created here diff --git a/tests/ui/needless_lifetimes.fixed b/tests/ui/needless_lifetimes.fixed index 90a07454b4d7..b4d22dc37aca 100644 --- a/tests/ui/needless_lifetimes.fixed +++ b/tests/ui/needless_lifetimes.fixed @@ -1,16 +1,13 @@ //@aux-build:proc_macros.rs -#![warn(clippy::needless_lifetimes, clippy::elidable_lifetime_names)] -#![allow( - unused, +#![warn(clippy::needless_lifetimes)] +#![deny(clippy::elidable_lifetime_names)] +#![allow(mismatched_lifetime_syntaxes)] +#![expect( + dyn_drop, clippy::boxed_local, clippy::extra_unused_type_parameters, - clippy::needless_pass_by_value, - clippy::redundant_allocation, - clippy::unnecessary_wraps, - dyn_drop, - clippy::get_first, - mismatched_lifetime_syntaxes + clippy::get_first )] extern crate proc_macros; @@ -428,7 +425,6 @@ mod issue7296 { } mod pr_9743_false_negative_fix { - #![allow(unused)] fn foo(x: &u8, y: &'_ u8) {} //~^ needless_lifetimes @@ -438,7 +434,6 @@ mod pr_9743_false_negative_fix { } mod pr_9743_output_lifetime_checks { - #![allow(unused)] // lint: only one input fn one_input(x: &u8) -> &u8 { diff --git a/tests/ui/needless_lifetimes.rs b/tests/ui/needless_lifetimes.rs index 6df38897f42d..a5a1b139d1e6 100644 --- a/tests/ui/needless_lifetimes.rs +++ b/tests/ui/needless_lifetimes.rs @@ -1,16 +1,13 @@ //@aux-build:proc_macros.rs -#![warn(clippy::needless_lifetimes, clippy::elidable_lifetime_names)] -#![allow( - unused, +#![warn(clippy::needless_lifetimes)] +#![deny(clippy::elidable_lifetime_names)] +#![allow(mismatched_lifetime_syntaxes)] +#![expect( + dyn_drop, clippy::boxed_local, clippy::extra_unused_type_parameters, - clippy::needless_pass_by_value, - clippy::redundant_allocation, - clippy::unnecessary_wraps, - dyn_drop, - clippy::get_first, - mismatched_lifetime_syntaxes + clippy::get_first )] extern crate proc_macros; @@ -428,7 +425,6 @@ mod issue7296 { } mod pr_9743_false_negative_fix { - #![allow(unused)] fn foo<'a>(x: &'a u8, y: &'_ u8) {} //~^ needless_lifetimes @@ -438,7 +434,6 @@ mod pr_9743_false_negative_fix { } mod pr_9743_output_lifetime_checks { - #![allow(unused)] // lint: only one input fn one_input<'a>(x: &'a u8) -> &'a u8 { diff --git a/tests/ui/needless_lifetimes.stderr b/tests/ui/needless_lifetimes.stderr index 138d0498c43e..e71015cf166a 100644 --- a/tests/ui/needless_lifetimes.stderr +++ b/tests/ui/needless_lifetimes.stderr @@ -1,5 +1,5 @@ error: the following explicit lifetimes could be elided: 'a, 'b - --> tests/ui/needless_lifetimes.rs:19:23 + --> tests/ui/needless_lifetimes.rs:16:23 | LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {} | ^^ ^^ ^^ ^^ @@ -13,7 +13,7 @@ LL + fn distinct_lifetimes(_x: &u8, _y: &u8, _z: u8) {} | error: the following explicit lifetimes could be elided: 'a, 'b - --> tests/ui/needless_lifetimes.rs:22:24 + --> tests/ui/needless_lifetimes.rs:19:24 | LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {} | ^^ ^^ ^^ ^^ @@ -25,7 +25,7 @@ LL + fn distinct_and_static(_x: &u8, _y: &u8, _z: &'static u8) {} | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:33:15 + --> tests/ui/needless_lifetimes.rs:30:15 | LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { | ^^ ^^ ^^ @@ -37,7 +37,7 @@ LL + fn in_and_out(x: &u8, _y: u8) -> &u8 { | error: the following explicit lifetimes could be elided: 'b - --> tests/ui/needless_lifetimes.rs:46:31 + --> tests/ui/needless_lifetimes.rs:43:31 | LL | fn multiple_in_and_out_2a<'a, 'b>(x: &'a u8, _y: &'b u8) -> &'a u8 { | ^^ ^^ @@ -49,7 +49,7 @@ LL + fn multiple_in_and_out_2a<'a>(x: &'a u8, _y: &u8) -> &'a u8 { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:54:27 + --> tests/ui/needless_lifetimes.rs:51:27 | LL | fn multiple_in_and_out_2b<'a, 'b>(_x: &'a u8, y: &'b u8) -> &'b u8 { | ^^ ^^ @@ -61,7 +61,7 @@ LL + fn multiple_in_and_out_2b<'b>(_x: &u8, y: &'b u8) -> &'b u8 { | error: the following explicit lifetimes could be elided: 'b - --> tests/ui/needless_lifetimes.rs:72:26 + --> tests/ui/needless_lifetimes.rs:69:26 | LL | fn deep_reference_1a<'a, 'b>(x: &'a u8, _y: &'b u8) -> Result<&'a u8, ()> { | ^^ ^^ @@ -73,7 +73,7 @@ LL + fn deep_reference_1a<'a>(x: &'a u8, _y: &u8) -> Result<&'a u8, ()> { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:80:22 + --> tests/ui/needless_lifetimes.rs:77:22 | LL | fn deep_reference_1b<'a, 'b>(_x: &'a u8, y: &'b u8) -> Result<&'b u8, ()> { | ^^ ^^ @@ -85,7 +85,7 @@ LL + fn deep_reference_1b<'b>(_x: &u8, y: &'b u8) -> Result<&'b u8, ()> { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:90:21 + --> tests/ui/needless_lifetimes.rs:87:21 | LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { | ^^ ^^ ^^ @@ -97,7 +97,7 @@ LL + fn deep_reference_3(x: &u8, _y: u8) -> Result<&u8, ()> { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:96:28 + --> tests/ui/needless_lifetimes.rs:93:28 | LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> | ^^ ^^ ^^ @@ -109,7 +109,7 @@ LL + fn where_clause_without_lt(x: &u8, _y: u8) -> Result<&u8, ()> | error: the following explicit lifetimes could be elided: 's - --> tests/ui/needless_lifetimes.rs:127:21 + --> tests/ui/needless_lifetimes.rs:124:21 | LL | fn self_and_out<'s>(&'s self) -> &'s u8 { | ^^ ^^ ^^ @@ -121,7 +121,7 @@ LL + fn self_and_out(&self) -> &u8 { | error: the following explicit lifetimes could be elided: 't - --> tests/ui/needless_lifetimes.rs:135:30 + --> tests/ui/needless_lifetimes.rs:132:30 | LL | fn self_and_in_out_1<'s, 't>(&'s self, _x: &'t u8) -> &'s u8 { | ^^ ^^ @@ -133,7 +133,7 @@ LL + fn self_and_in_out_1<'s>(&'s self, _x: &u8) -> &'s u8 { | error: the following explicit lifetimes could be elided: 's - --> tests/ui/needless_lifetimes.rs:143:26 + --> tests/ui/needless_lifetimes.rs:140:26 | LL | fn self_and_in_out_2<'s, 't>(&'s self, x: &'t u8) -> &'t u8 { | ^^ ^^ @@ -145,7 +145,7 @@ LL + fn self_and_in_out_2<'t>(&self, x: &'t u8) -> &'t u8 { | error: the following explicit lifetimes could be elided: 's, 't - --> tests/ui/needless_lifetimes.rs:148:29 + --> tests/ui/needless_lifetimes.rs:145:29 | LL | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {} | ^^ ^^ ^^ ^^ @@ -157,7 +157,7 @@ LL + fn distinct_self_and_in(&self, _x: &u8) {} | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:172:21 + --> tests/ui/needless_lifetimes.rs:169:21 | LL | fn struct_with_lt4b<'a, 'b>(_foo: &'a Foo<'b>) -> &'b str { | ^^ ^^ @@ -169,7 +169,7 @@ LL + fn struct_with_lt4b<'b>(_foo: &Foo<'b>) -> &'b str { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:188:22 + --> tests/ui/needless_lifetimes.rs:185:22 | LL | fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str { | ^^ ^^ ^^ @@ -181,7 +181,7 @@ LL + fn trait_obj_elided2(_arg: &dyn Drop) -> &str { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:199:20 + --> tests/ui/needless_lifetimes.rs:196:20 | LL | fn alias_with_lt4b<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'b str { | ^^ ^^ @@ -193,7 +193,7 @@ LL + fn alias_with_lt4b<'b>(_foo: &FooAlias<'b>) -> &'b str { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:204:30 + --> tests/ui/needless_lifetimes.rs:201:30 | LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { | ^^ ^^ ^ @@ -205,7 +205,7 @@ LL + fn named_input_elided_output(_arg: &str) -> &str { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:213:19 + --> tests/ui/needless_lifetimes.rs:210:19 | LL | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { | ^^ ^^ @@ -217,7 +217,7 @@ LL + fn trait_bound_ok>(_: &u8, _: T) { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:249:24 + --> tests/ui/needless_lifetimes.rs:246:24 | LL | fn needless_lt<'a>(x: &'a u8) {} | ^^ ^^ @@ -229,7 +229,7 @@ LL + fn needless_lt(x: &u8) {} | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:254:24 + --> tests/ui/needless_lifetimes.rs:251:24 | LL | fn needless_lt<'a>(_x: &'a u8) {} | ^^ ^^ @@ -241,7 +241,7 @@ LL + fn needless_lt(_x: &u8) {} | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:285:55 + --> tests/ui/needless_lifetimes.rs:282:55 | LL | fn impl_trait_elidable_nested_anonymous_lifetimes<'a>(i: &'a i32, f: impl Fn(&i32) -> &i32) -> &'a i32 { | ^^ ^^ ^^ @@ -253,7 +253,7 @@ LL + fn impl_trait_elidable_nested_anonymous_lifetimes(i: &i32, f: impl Fn(& | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:295:26 + --> tests/ui/needless_lifetimes.rs:292:26 | LL | fn generics_elidable<'a, T: Fn(&i32) -> &i32>(i: &'a i32, f: T) -> &'a i32 { | ^^ ^^ ^^ @@ -265,7 +265,7 @@ LL + fn generics_elidable &i32>(i: &i32, f: T) -> &i32 { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:308:30 + --> tests/ui/needless_lifetimes.rs:305:30 | LL | fn where_clause_elidable<'a, T>(i: &'a i32, f: T) -> &'a i32 | ^^ ^^ ^^ @@ -277,7 +277,7 @@ LL + fn where_clause_elidable(i: &i32, f: T) -> &i32 | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:324:28 + --> tests/ui/needless_lifetimes.rs:321:28 | LL | fn pointer_fn_elidable<'a>(i: &'a i32, f: fn(&i32) -> &i32) -> &'a i32 { | ^^ ^^ ^^ @@ -289,7 +289,7 @@ LL + fn pointer_fn_elidable(i: &i32, f: fn(&i32) -> &i32) -> &i32 { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:338:28 + --> tests/ui/needless_lifetimes.rs:335:28 | LL | fn nested_fn_pointer_3<'a>(_: &'a i32) -> fn(fn(&i32) -> &i32) -> i32 { | ^^ ^^ @@ -301,7 +301,7 @@ LL + fn nested_fn_pointer_3(_: &i32) -> fn(fn(&i32) -> &i32) -> i32 { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:342:28 + --> tests/ui/needless_lifetimes.rs:339:28 | LL | fn nested_fn_pointer_4<'a>(_: &'a i32) -> impl Fn(fn(&i32)) { | ^^ ^^ @@ -313,7 +313,7 @@ LL + fn nested_fn_pointer_4(_: &i32) -> impl Fn(fn(&i32)) { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:365:21 + --> tests/ui/needless_lifetimes.rs:362:21 | LL | fn implicit<'a>(&'a self) -> &'a () { | ^^ ^^ ^^ @@ -325,7 +325,7 @@ LL + fn implicit(&self) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:369:25 + --> tests/ui/needless_lifetimes.rs:366:25 | LL | fn implicit_mut<'a>(&'a mut self) -> &'a () { | ^^ ^^ ^^ @@ -337,7 +337,7 @@ LL + fn implicit_mut(&mut self) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:374:21 + --> tests/ui/needless_lifetimes.rs:371:21 | LL | fn explicit<'a>(self: &'a Arc) -> &'a () { | ^^ ^^ ^^ @@ -349,7 +349,7 @@ LL + fn explicit(self: &Arc) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:379:25 + --> tests/ui/needless_lifetimes.rs:376:25 | LL | fn explicit_mut<'a>(self: &'a mut Rc) -> &'a () { | ^^ ^^ ^^ @@ -361,7 +361,7 @@ LL + fn explicit_mut(self: &mut Rc) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:392:31 + --> tests/ui/needless_lifetimes.rs:389:31 | LL | fn lifetime_elsewhere<'a>(self: Box, here: &'a ()) -> &'a () { | ^^ ^^ ^^ @@ -373,7 +373,7 @@ LL + fn lifetime_elsewhere(self: Box, here: &()) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:399:21 + --> tests/ui/needless_lifetimes.rs:396:21 | LL | fn implicit<'a>(&'a self) -> &'a (); | ^^ ^^ ^^ @@ -385,7 +385,7 @@ LL + fn implicit(&self) -> &(); | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:401:30 + --> tests/ui/needless_lifetimes.rs:398:30 | LL | fn implicit_provided<'a>(&'a self) -> &'a () { | ^^ ^^ ^^ @@ -397,7 +397,7 @@ LL + fn implicit_provided(&self) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:407:21 + --> tests/ui/needless_lifetimes.rs:404:21 | LL | fn explicit<'a>(self: &'a Arc) -> &'a (); | ^^ ^^ ^^ @@ -409,7 +409,7 @@ LL + fn explicit(self: &Arc) -> &(); | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:410:30 + --> tests/ui/needless_lifetimes.rs:407:30 | LL | fn explicit_provided<'a>(self: &'a Arc) -> &'a () { | ^^ ^^ ^^ @@ -421,7 +421,7 @@ LL + fn explicit_provided(self: &Arc) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:421:31 + --> tests/ui/needless_lifetimes.rs:418:31 | LL | fn lifetime_elsewhere<'a>(self: Box, here: &'a ()) -> &'a (); | ^^ ^^ ^^ @@ -433,7 +433,7 @@ LL + fn lifetime_elsewhere(self: Box, here: &()) -> &(); | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:423:40 + --> tests/ui/needless_lifetimes.rs:420:40 | LL | fn lifetime_elsewhere_provided<'a>(self: Box, here: &'a ()) -> &'a () { | ^^ ^^ ^^ @@ -445,7 +445,7 @@ LL + fn lifetime_elsewhere_provided(self: Box, here: &()) -> &() { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:433:12 + --> tests/ui/needless_lifetimes.rs:429:12 | LL | fn foo<'a>(x: &'a u8, y: &'_ u8) {} | ^^ ^^ @@ -457,7 +457,7 @@ LL + fn foo(x: &u8, y: &'_ u8) {} | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:436:12 + --> tests/ui/needless_lifetimes.rs:432:12 | LL | fn bar<'a>(x: &'a u8, y: &'_ u8, z: &'_ u8) {} | ^^ ^^ @@ -469,7 +469,7 @@ LL + fn bar(x: &u8, y: &'_ u8, z: &'_ u8) {} | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:444:18 + --> tests/ui/needless_lifetimes.rs:439:18 | LL | fn one_input<'a>(x: &'a u8) -> &'a u8 { | ^^ ^^ ^^ @@ -481,7 +481,7 @@ LL + fn one_input(x: &u8) -> &u8 { | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:450:42 + --> tests/ui/needless_lifetimes.rs:445:42 | LL | fn multiple_inputs_output_not_elided<'a, 'b>(x: &'a u8, y: &'b u8, z: &'b u8) -> &'b u8 { | ^^ ^^ @@ -493,7 +493,7 @@ LL + fn multiple_inputs_output_not_elided<'b>(x: &u8, y: &'b u8, z: &'b u8) | error: the following explicit lifetimes could be elided: 'a - --> tests/ui/needless_lifetimes.rs:467:22 + --> tests/ui/needless_lifetimes.rs:462:22 | LL | fn one_input<'a>(x: &'a u8) -> &'a u8 { | ^^ ^^ ^^ diff --git a/tests/ui/needless_match.fixed b/tests/ui/needless_match.fixed index 2d7b0fa2bb2c..c4792c306e59 100644 --- a/tests/ui/needless_match.fixed +++ b/tests/ui/needless_match.fixed @@ -1,7 +1,5 @@ #![warn(clippy::needless_match)] -#![allow(clippy::manual_map, clippy::question_mark)] -#![allow(dead_code)] -#![allow(unused)] +#![expect(clippy::manual_map)] #[derive(Clone, Copy)] enum Simple { A, diff --git a/tests/ui/needless_match.rs b/tests/ui/needless_match.rs index 83e3e73feb6c..92a4264025a3 100644 --- a/tests/ui/needless_match.rs +++ b/tests/ui/needless_match.rs @@ -1,7 +1,5 @@ #![warn(clippy::needless_match)] -#![allow(clippy::manual_map, clippy::question_mark)] -#![allow(dead_code)] -#![allow(unused)] +#![expect(clippy::manual_map)] #[derive(Clone, Copy)] enum Simple { A, diff --git a/tests/ui/needless_match.stderr b/tests/ui/needless_match.stderr index 5195ecdfa555..b4ebd5a755a3 100644 --- a/tests/ui/needless_match.stderr +++ b/tests/ui/needless_match.stderr @@ -1,5 +1,5 @@ error: this match expression is unnecessary - --> tests/ui/needless_match.rs:15:18 + --> tests/ui/needless_match.rs:13:18 | LL | let _: i32 = match i { | __________________^ @@ -15,7 +15,7 @@ LL | | }; = help: to override `-D warnings` add `#[allow(clippy::needless_match)]` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:23:19 + --> tests/ui/needless_match.rs:21:19 | LL | let _: &str = match s { | ___________________^ @@ -27,7 +27,7 @@ LL | | }; | |_____^ help: replace it with: `s` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:33:21 + --> tests/ui/needless_match.rs:31:21 | LL | let _: Simple = match se { | _____________________^ @@ -40,7 +40,7 @@ LL | | }; | |_____^ help: replace it with: `se` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:56:26 + --> tests/ui/needless_match.rs:54:26 | LL | let _: Option = match x { | __________________________^ @@ -51,7 +51,7 @@ LL | | }; | |_____^ help: replace it with: `x` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:73:31 + --> tests/ui/needless_match.rs:71:31 | LL | let _: Result = match Ok(1) { | _______________________________^ @@ -62,7 +62,7 @@ LL | | }; | |_____^ help: replace it with: `Ok(1)` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:78:31 + --> tests/ui/needless_match.rs:76:31 | LL | let _: Result = match func_ret_err(0_i32) { | _______________________________^ @@ -73,25 +73,25 @@ LL | | }; | |_____^ help: replace it with: `func_ret_err(0_i32)` error: this if-let expression is unnecessary - --> tests/ui/needless_match.rs:92:13 + --> tests/ui/needless_match.rs:90:13 | LL | let _ = if let Some(a) = Some(1) { Some(a) } else { None }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)` error: this if-let expression is unnecessary - --> tests/ui/needless_match.rs:128:31 + --> tests/ui/needless_match.rs:126:31 | LL | let _: Result = if let Err(e) = x { Err(e) } else { x }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x` error: this if-let expression is unnecessary - --> tests/ui/needless_match.rs:130:31 + --> tests/ui/needless_match.rs:128:31 | LL | let _: Result = if let Ok(val) = x { Ok(val) } else { x }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x` error: this if-let expression is unnecessary - --> tests/ui/needless_match.rs:138:21 + --> tests/ui/needless_match.rs:136:21 | LL | let _: Simple = if let Simple::A = x { | _____________________^ @@ -104,7 +104,7 @@ LL | | }; | |_____^ help: replace it with: `x` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:178:26 + --> tests/ui/needless_match.rs:176:26 | LL | let _: Complex = match ce { | __________________________^ @@ -117,7 +117,7 @@ LL | | }; | |_________^ help: replace it with: `ce` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:263:17 + --> tests/ui/needless_match.rs:261:17 | LL | let _ = match e { | _________________^ @@ -128,7 +128,7 @@ LL | | }; | |_________^ help: replace it with: `e` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:270:17 + --> tests/ui/needless_match.rs:268:17 | LL | let _ = match e { | _________________^ @@ -140,7 +140,7 @@ LL | | }; | |_________^ help: replace it with: `e` error: this if-let expression is unnecessary - --> tests/ui/needless_match.rs:352:9 + --> tests/ui/needless_match.rs:350:9 | LL | / if let Some(num) = A { LL | | @@ -152,7 +152,7 @@ LL | | } | |_________^ help: replace it with: `A` error: this match expression is unnecessary - --> tests/ui/needless_match.rs:373:13 + --> tests/ui/needless_match.rs:371:13 | LL | let x = match t { | _____________^ diff --git a/tests/ui/needless_maybe_sized.fixed b/tests/ui/needless_maybe_sized.fixed index 92840a888ada..807b88efbc8f 100644 --- a/tests/ui/needless_maybe_sized.fixed +++ b/tests/ui/needless_maybe_sized.fixed @@ -1,7 +1,7 @@ //@aux-build:proc_macros.rs -#![allow(unused, clippy::multiple_bound_locations)] #![warn(clippy::needless_maybe_sized)] +#![allow(clippy::multiple_bound_locations)] extern crate proc_macros; use proc_macros::external; diff --git a/tests/ui/needless_maybe_sized.rs b/tests/ui/needless_maybe_sized.rs index 02242260af1f..5c631f45fcb9 100644 --- a/tests/ui/needless_maybe_sized.rs +++ b/tests/ui/needless_maybe_sized.rs @@ -1,7 +1,7 @@ //@aux-build:proc_macros.rs -#![allow(unused, clippy::multiple_bound_locations)] #![warn(clippy::needless_maybe_sized)] +#![allow(clippy::multiple_bound_locations)] extern crate proc_macros; use proc_macros::external; diff --git a/tests/ui/needless_option_as_deref.fixed b/tests/ui/needless_option_as_deref.fixed index fd639f3b57fa..5aec19b22252 100644 --- a/tests/ui/needless_option_as_deref.fixed +++ b/tests/ui/needless_option_as_deref.fixed @@ -1,6 +1,5 @@ -#![allow(unused)] #![warn(clippy::needless_option_as_deref)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] fn main() { // should lint diff --git a/tests/ui/needless_option_as_deref.rs b/tests/ui/needless_option_as_deref.rs index cbf7935794b3..9c4bd6ad60aa 100644 --- a/tests/ui/needless_option_as_deref.rs +++ b/tests/ui/needless_option_as_deref.rs @@ -1,6 +1,5 @@ -#![allow(unused)] #![warn(clippy::needless_option_as_deref)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] fn main() { // should lint diff --git a/tests/ui/needless_option_as_deref.stderr b/tests/ui/needless_option_as_deref.stderr index bd19dc75eed6..a86bdfe5846d 100644 --- a/tests/ui/needless_option_as_deref.stderr +++ b/tests/ui/needless_option_as_deref.stderr @@ -1,5 +1,5 @@ error: derefed type is same as origin - --> tests/ui/needless_option_as_deref.rs:7:29 + --> tests/ui/needless_option_as_deref.rs:6:29 | LL | let _: Option<&usize> = Some(&1).as_deref(); | ^^^^^^^^^^^^^^^^^^^ help: try: `Some(&1)` @@ -8,13 +8,13 @@ LL | let _: Option<&usize> = Some(&1).as_deref(); = help: to override `-D warnings` add `#[allow(clippy::needless_option_as_deref)]` error: derefed type is same as origin - --> tests/ui/needless_option_as_deref.rs:9:33 + --> tests/ui/needless_option_as_deref.rs:8:33 | LL | let _: Option<&mut usize> = Some(&mut 1).as_deref_mut(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(&mut 1)` error: derefed type is same as origin - --> tests/ui/needless_option_as_deref.rs:14:13 + --> tests/ui/needless_option_as_deref.rs:13:13 | LL | let _ = x.as_deref_mut(); | ^^^^^^^^^^^^^^^^ help: try: `x` diff --git a/tests/ui/needless_parens_on_range_literals.fixed b/tests/ui/needless_parens_on_range_literals.fixed index 7abcbc0c6e32..989dad8b8655 100644 --- a/tests/ui/needless_parens_on_range_literals.fixed +++ b/tests/ui/needless_parens_on_range_literals.fixed @@ -1,7 +1,7 @@ //@edition:2018 #![warn(clippy::needless_parens_on_range_literals)] -#![allow(clippy::almost_complete_range)] +#![expect(clippy::almost_complete_range)] fn main() { let _ = 'a'..='z'; diff --git a/tests/ui/needless_parens_on_range_literals.rs b/tests/ui/needless_parens_on_range_literals.rs index 2a6f9305883b..1c56ecd161ae 100644 --- a/tests/ui/needless_parens_on_range_literals.rs +++ b/tests/ui/needless_parens_on_range_literals.rs @@ -1,7 +1,7 @@ //@edition:2018 #![warn(clippy::needless_parens_on_range_literals)] -#![allow(clippy::almost_complete_range)] +#![expect(clippy::almost_complete_range)] fn main() { let _ = ('a')..=('z'); diff --git a/tests/ui/needless_pass_by_ref_mut.rs b/tests/ui/needless_pass_by_ref_mut.rs index bdad3e3d5b00..2ca8e06ee9b0 100644 --- a/tests/ui/needless_pass_by_ref_mut.rs +++ b/tests/ui/needless_pass_by_ref_mut.rs @@ -1,11 +1,5 @@ -#![allow( - clippy::if_same_then_else, - clippy::no_effect, - clippy::ptr_arg, - clippy::redundant_closure_call, - clippy::uninlined_format_args -)] #![warn(clippy::needless_pass_by_ref_mut)] +#![expect(clippy::no_effect, clippy::ptr_arg, clippy::redundant_closure_call)] //@no-rustfix use std::ptr::NonNull; diff --git a/tests/ui/needless_pass_by_ref_mut.stderr b/tests/ui/needless_pass_by_ref_mut.stderr index c427f4c3e42c..208031497c04 100644 --- a/tests/ui/needless_pass_by_ref_mut.stderr +++ b/tests/ui/needless_pass_by_ref_mut.stderr @@ -1,5 +1,5 @@ error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:12:11 + --> tests/ui/needless_pass_by_ref_mut.rs:6:11 | LL | fn foo(s: &mut Vec, b: &u32, x: &mut u32) { | ^----^^^^^^^^ @@ -10,7 +10,7 @@ LL | fn foo(s: &mut Vec, b: &u32, x: &mut u32) { = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:38:12 + --> tests/ui/needless_pass_by_ref_mut.rs:32:12 | LL | fn foo6(s: &mut Vec) { | ^----^^^^^^^^ @@ -18,7 +18,7 @@ LL | fn foo6(s: &mut Vec) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:49:12 + --> tests/ui/needless_pass_by_ref_mut.rs:43:12 | LL | fn bar(&mut self) {} | ^----^^^^ @@ -26,7 +26,7 @@ LL | fn bar(&mut self) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:52:29 + --> tests/ui/needless_pass_by_ref_mut.rs:46:29 | LL | fn mushroom(&self, vec: &mut Vec) -> usize { | ^----^^^^^^^^ @@ -34,7 +34,7 @@ LL | fn mushroom(&self, vec: &mut Vec) -> usize { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:130:16 + --> tests/ui/needless_pass_by_ref_mut.rs:124:16 | LL | async fn a1(x: &mut i32) { | ^----^^^ @@ -42,7 +42,7 @@ LL | async fn a1(x: &mut i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:135:16 + --> tests/ui/needless_pass_by_ref_mut.rs:129:16 | LL | async fn a2(x: &mut i32, y: String) { | ^----^^^ @@ -50,7 +50,7 @@ LL | async fn a2(x: &mut i32, y: String) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:140:16 + --> tests/ui/needless_pass_by_ref_mut.rs:134:16 | LL | async fn a3(x: &mut i32, y: String, z: String) { | ^----^^^ @@ -58,7 +58,7 @@ LL | async fn a3(x: &mut i32, y: String, z: String) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:145:16 + --> tests/ui/needless_pass_by_ref_mut.rs:139:16 | LL | async fn a4(x: &mut i32, y: i32) { | ^----^^^ @@ -66,7 +66,7 @@ LL | async fn a4(x: &mut i32, y: i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:150:24 + --> tests/ui/needless_pass_by_ref_mut.rs:144:24 | LL | async fn a5(x: i32, y: &mut i32) { | ^----^^^ @@ -74,7 +74,7 @@ LL | async fn a5(x: i32, y: &mut i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:155:24 + --> tests/ui/needless_pass_by_ref_mut.rs:149:24 | LL | async fn a6(x: i32, y: &mut i32) { | ^----^^^ @@ -82,7 +82,7 @@ LL | async fn a6(x: i32, y: &mut i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:160:32 + --> tests/ui/needless_pass_by_ref_mut.rs:154:32 | LL | async fn a7(x: i32, y: i32, z: &mut i32) { | ^----^^^ @@ -90,7 +90,7 @@ LL | async fn a7(x: i32, y: i32, z: &mut i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:165:24 + --> tests/ui/needless_pass_by_ref_mut.rs:159:24 | LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { | ^----^^^ @@ -98,7 +98,7 @@ LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:165:45 + --> tests/ui/needless_pass_by_ref_mut.rs:159:45 | LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { | ^----^^^ @@ -106,7 +106,7 @@ LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:201:16 + --> tests/ui/needless_pass_by_ref_mut.rs:195:16 | LL | fn cfg_warn(s: &mut u32) {} | ^----^^^ @@ -116,7 +116,7 @@ LL | fn cfg_warn(s: &mut u32) {} = note: this is cfg-gated and may require further changes error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:206:20 + --> tests/ui/needless_pass_by_ref_mut.rs:200:20 | LL | fn cfg_warn(s: &mut u32) {} | ^----^^^ @@ -126,7 +126,7 @@ LL | fn cfg_warn(s: &mut u32) {} = note: this is cfg-gated and may require further changes error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:219:39 + --> tests/ui/needless_pass_by_ref_mut.rs:213:39 | LL | async fn inner_async2(x: &mut i32, y: &mut u32) { | ^----^^^ @@ -134,7 +134,7 @@ LL | async fn inner_async2(x: &mut i32, y: &mut u32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:228:26 + --> tests/ui/needless_pass_by_ref_mut.rs:222:26 | LL | async fn inner_async3(x: &mut i32, y: &mut u32) { | ^----^^^ @@ -142,7 +142,7 @@ LL | async fn inner_async3(x: &mut i32, y: &mut u32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:248:30 + --> tests/ui/needless_pass_by_ref_mut.rs:242:30 | LL | async fn call_in_closure1(n: &mut str) { | ^----^^^ @@ -150,7 +150,7 @@ LL | async fn call_in_closure1(n: &mut str) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:268:16 + --> tests/ui/needless_pass_by_ref_mut.rs:262:16 | LL | fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize { | ^----^^^^^ @@ -158,7 +158,7 @@ LL | fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:280:22 + --> tests/ui/needless_pass_by_ref_mut.rs:274:22 | LL | async fn closure4(n: &mut usize) { | ^----^^^^^ @@ -166,7 +166,7 @@ LL | async fn closure4(n: &mut usize) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:335:12 + --> tests/ui/needless_pass_by_ref_mut.rs:329:12 | LL | fn bar(&mut self) {} | ^----^^^^ @@ -174,7 +174,7 @@ LL | fn bar(&mut self) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:338:18 + --> tests/ui/needless_pass_by_ref_mut.rs:332:18 | LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { | ^----^^^^ @@ -182,7 +182,7 @@ LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:338:45 + --> tests/ui/needless_pass_by_ref_mut.rs:332:45 | LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { | ^----^^^ @@ -190,7 +190,7 @@ LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:347:46 + --> tests/ui/needless_pass_by_ref_mut.rs:341:46 | LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) { | ^----^^^ @@ -198,7 +198,7 @@ LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:364:18 + --> tests/ui/needless_pass_by_ref_mut.rs:358:18 | LL | fn _empty_tup(x: &mut (())) {} | ^^----^^^ @@ -206,7 +206,7 @@ LL | fn _empty_tup(x: &mut (())) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:366:19 + --> tests/ui/needless_pass_by_ref_mut.rs:360:19 | LL | fn _single_tup(x: &mut ((i32,))) {} | ^^----^^^^^^^ @@ -214,7 +214,7 @@ LL | fn _single_tup(x: &mut ((i32,))) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:368:18 + --> tests/ui/needless_pass_by_ref_mut.rs:362:18 | LL | fn _multi_tup(x: &mut ((i32, u32))) {} | ^^----^^^^^^^^^^^ @@ -222,7 +222,7 @@ LL | fn _multi_tup(x: &mut ((i32, u32))) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:370:11 + --> tests/ui/needless_pass_by_ref_mut.rs:364:11 | LL | fn _fn(x: &mut (fn())) {} | ^^----^^^^^ @@ -230,7 +230,7 @@ LL | fn _fn(x: &mut (fn())) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:373:23 + --> tests/ui/needless_pass_by_ref_mut.rs:367:23 | LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {} | ^----^^^^^^^^^^^^^^^^^^ @@ -238,7 +238,7 @@ LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:375:20 + --> tests/ui/needless_pass_by_ref_mut.rs:369:20 | LL | fn _extern_c_fn(x: &mut extern "C" fn()) {} | ^----^^^^^^^^^^^^^^^ @@ -246,7 +246,7 @@ LL | fn _extern_c_fn(x: &mut extern "C" fn()) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:377:18 + --> tests/ui/needless_pass_by_ref_mut.rs:371:18 | LL | fn _unsafe_fn(x: &mut unsafe fn()) {} | ^----^^^^^^^^^^^ @@ -254,7 +254,7 @@ LL | fn _unsafe_fn(x: &mut unsafe fn()) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:379:25 + --> tests/ui/needless_pass_by_ref_mut.rs:373:25 | LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {} | ^----^^^^^^^^^^^^^^^^^^^^^^ @@ -262,7 +262,7 @@ LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:381:20 + --> tests/ui/needless_pass_by_ref_mut.rs:375:20 | LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {} | ^----^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -270,7 +270,7 @@ LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {} | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut.rs:383:20 + --> tests/ui/needless_pass_by_ref_mut.rs:377:20 | LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {} | ^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/needless_pass_by_ref_mut2.fixed b/tests/ui/needless_pass_by_ref_mut2.fixed index c462f1cc8d87..708c345fdca6 100644 --- a/tests/ui/needless_pass_by_ref_mut2.fixed +++ b/tests/ui/needless_pass_by_ref_mut2.fixed @@ -2,7 +2,6 @@ // they're used in `inner_async4` for some reasons... This test ensures that no // only `v` is marked as not used mutably in `inner_async4`. -#![allow(clippy::redundant_closure_call)] #![warn(clippy::needless_pass_by_ref_mut)] async fn inner_async3(x: &i32, y: &mut u32) { diff --git a/tests/ui/needless_pass_by_ref_mut2.rs b/tests/ui/needless_pass_by_ref_mut2.rs index b00f294c57f0..a73f9828e577 100644 --- a/tests/ui/needless_pass_by_ref_mut2.rs +++ b/tests/ui/needless_pass_by_ref_mut2.rs @@ -2,7 +2,6 @@ // they're used in `inner_async4` for some reasons... This test ensures that no // only `v` is marked as not used mutably in `inner_async4`. -#![allow(clippy::redundant_closure_call)] #![warn(clippy::needless_pass_by_ref_mut)] async fn inner_async3(x: &mut i32, y: &mut u32) { diff --git a/tests/ui/needless_pass_by_ref_mut2.stderr b/tests/ui/needless_pass_by_ref_mut2.stderr index aa5c412adb4d..d5d457370f24 100644 --- a/tests/ui/needless_pass_by_ref_mut2.stderr +++ b/tests/ui/needless_pass_by_ref_mut2.stderr @@ -1,5 +1,5 @@ error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut2.rs:8:26 + --> tests/ui/needless_pass_by_ref_mut2.rs:7:26 | LL | async fn inner_async3(x: &mut i32, y: &mut u32) { | ^----^^^ @@ -10,7 +10,7 @@ LL | async fn inner_async3(x: &mut i32, y: &mut u32) { = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut2.rs:17:39 + --> tests/ui/needless_pass_by_ref_mut2.rs:16:39 | LL | async fn inner_async4(u: &mut i32, v: &mut u32) { | ^----^^^ @@ -18,7 +18,7 @@ LL | async fn inner_async4(u: &mut i32, v: &mut u32) { | help: consider removing this `mut` error: this parameter is a mutable reference but is not used mutably - --> tests/ui/needless_pass_by_ref_mut2.rs:29:37 + --> tests/ui/needless_pass_by_ref_mut2.rs:28:37 | LL | fn issue16267<'a>(msg: &str, slice: &'a mut [i32]) -> &'a [i32] { | ^^^^----^^^^^ diff --git a/tests/ui/needless_pass_by_value.rs b/tests/ui/needless_pass_by_value.rs index aef7fff28705..d1a65e43e810 100644 --- a/tests/ui/needless_pass_by_value.rs +++ b/tests/ui/needless_pass_by_value.rs @@ -1,13 +1,5 @@ #![warn(clippy::needless_pass_by_value)] -#![allow(dead_code)] -#![allow( - clippy::option_option, - clippy::redundant_clone, - clippy::redundant_pattern_matching, - clippy::single_match, - clippy::uninlined_format_args, - clippy::needless_lifetimes -)] +#![expect(clippy::needless_lifetimes, clippy::single_match)] //@no-rustfix use std::borrow::Borrow; use std::collections::HashSet; diff --git a/tests/ui/needless_pass_by_value.stderr b/tests/ui/needless_pass_by_value.stderr index e4381d1db53a..72cc025f566e 100644 --- a/tests/ui/needless_pass_by_value.stderr +++ b/tests/ui/needless_pass_by_value.stderr @@ -1,5 +1,5 @@ error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:19:23 + --> tests/ui/needless_pass_by_value.rs:11:23 | LL | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec { | ^^^^^^ help: consider changing the type to: `&[T]` @@ -8,13 +8,13 @@ LL | fn foo(v: Vec, w: Vec, mut x: Vec, y: Vec) -> Vec tests/ui/needless_pass_by_value.rs:35:11 + --> tests/ui/needless_pass_by_value.rs:27:11 | LL | fn bar(x: String, y: Wrapper) { | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:35:22 + --> tests/ui/needless_pass_by_value.rs:27:22 | LL | fn bar(x: String, y: Wrapper) { | ^^^^^^^ @@ -25,7 +25,7 @@ LL | fn bar(x: String, y: &Wrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:44:71 + --> tests/ui/needless_pass_by_value.rs:36:71 | LL | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: V) { | ^ @@ -36,7 +36,7 @@ LL | fn test_borrow_trait, U: AsRef, V>(t: T, u: U, v: &V) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:58:18 + --> tests/ui/needless_pass_by_value.rs:50:18 | LL | fn test_match(x: Option>, y: Option>) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | fn test_match(x: Option>, y: Option>) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:73:24 + --> tests/ui/needless_pass_by_value.rs:65:24 | LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ @@ -58,7 +58,7 @@ LL | fn test_destructure(x: &Wrapper, y: Wrapper, z: Wrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:73:36 + --> tests/ui/needless_pass_by_value.rs:65:36 | LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ @@ -69,7 +69,7 @@ LL | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:92:49 + --> tests/ui/needless_pass_by_value.rs:84:49 | LL | fn test_blanket_ref(vals: T, serializable: S) {} | ^ @@ -80,7 +80,7 @@ LL | fn test_blanket_ref(vals: &T, serializable: S) {} | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:95:18 + --> tests/ui/needless_pass_by_value.rs:87:18 | LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^ @@ -91,7 +91,7 @@ LL | fn issue_2114(s: &String, t: String, u: Vec, v: Vec) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:95:29 + --> tests/ui/needless_pass_by_value.rs:87:29 | LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^ @@ -108,7 +108,7 @@ LL + let _ = t.to_string(); | error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:95:40 + --> tests/ui/needless_pass_by_value.rs:87:40 | LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^^^ @@ -119,7 +119,7 @@ LL | fn issue_2114(s: String, t: String, u: &Vec, v: Vec) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:95:53 + --> tests/ui/needless_pass_by_value.rs:87:53 | LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) { | ^^^^^^^^ @@ -136,13 +136,13 @@ LL + let _ = v.to_owned(); | error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:113:12 + --> tests/ui/needless_pass_by_value.rs:105:12 | LL | s: String, | ^^^^^^ help: consider changing the type to: `&str` error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:115:12 + --> tests/ui/needless_pass_by_value.rs:107:12 | LL | t: String, | ^^^^^^ @@ -153,7 +153,7 @@ LL | t: &String, | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:125:23 + --> tests/ui/needless_pass_by_value.rs:117:23 | LL | fn baz(&self, uu: U, ss: Self) {} | ^ @@ -164,7 +164,7 @@ LL | fn baz(&self, uu: &U, ss: Self) {} | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:125:30 + --> tests/ui/needless_pass_by_value.rs:117:30 | LL | fn baz(&self, uu: U, ss: Self) {} | ^^^^ @@ -175,13 +175,13 @@ LL | fn baz(&self, uu: U, ss: &Self) {} | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:149:24 + --> tests/ui/needless_pass_by_value.rs:141:24 | LL | fn bar_copy(x: u32, y: CopyWrapper) { | ^^^^^^^^^^^ | help: or consider marking this type as `Copy` - --> tests/ui/needless_pass_by_value.rs:147:1 + --> tests/ui/needless_pass_by_value.rs:139:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ @@ -191,13 +191,13 @@ LL | fn bar_copy(x: u32, y: &CopyWrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:157:29 + --> tests/ui/needless_pass_by_value.rs:149:29 | LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: or consider marking this type as `Copy` - --> tests/ui/needless_pass_by_value.rs:147:1 + --> tests/ui/needless_pass_by_value.rs:139:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ @@ -207,13 +207,13 @@ LL | fn test_destructure_copy(x: &CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:157:45 + --> tests/ui/needless_pass_by_value.rs:149:45 | LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: or consider marking this type as `Copy` - --> tests/ui/needless_pass_by_value.rs:147:1 + --> tests/ui/needless_pass_by_value.rs:139:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ @@ -223,13 +223,13 @@ LL | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:157:61 + --> tests/ui/needless_pass_by_value.rs:149:61 | LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { | ^^^^^^^^^^^ | help: or consider marking this type as `Copy` - --> tests/ui/needless_pass_by_value.rs:147:1 + --> tests/ui/needless_pass_by_value.rs:139:1 | LL | struct CopyWrapper(u32); | ^^^^^^^^^^^^^^^^^^ @@ -239,7 +239,7 @@ LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:173:40 + --> tests/ui/needless_pass_by_value.rs:165:40 | LL | fn some_fun<'b, S: Bar<'b, ()>>(items: S) {} | ^ @@ -250,7 +250,7 @@ LL | fn some_fun<'b, S: Bar<'b, ()>>(items: &S) {} | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:179:20 + --> tests/ui/needless_pass_by_value.rs:171:20 | LL | fn more_fun(items: impl Club<'static, i32>) {} | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -261,7 +261,7 @@ LL | fn more_fun(items: &impl Club<'static, i32>) {} | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:194:24 + --> tests/ui/needless_pass_by_value.rs:186:24 | LL | fn option_inner_ref(x: Option) { | ^^^^^^^^^^^^^^ @@ -272,7 +272,7 @@ LL | fn option_inner_ref(x: Option<&String>) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:204:27 + --> tests/ui/needless_pass_by_value.rs:196:27 | LL | fn non_standard_option(x: non_standard::Option) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -283,7 +283,7 @@ LL | fn non_standard_option(x: &non_standard::Option) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:209:22 + --> tests/ui/needless_pass_by_value.rs:201:22 | LL | fn option_by_name(x: Option>>>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -294,7 +294,7 @@ LL | fn option_by_name(x: Option tests/ui/needless_pass_by_value.rs:216:18 + --> tests/ui/needless_pass_by_value.rs:208:18 | LL | fn non_option(x: OptStr) { | ^^^^^^ @@ -305,7 +305,7 @@ LL | fn non_option(x: &OptStr) { | + error: this argument is passed by value, but not consumed in the function body - --> tests/ui/needless_pass_by_value.rs:223:25 + --> tests/ui/needless_pass_by_value.rs:215:25 | LL | fn non_option_either(x: Opt) { | ^^^^^^^^^^^ diff --git a/tests/ui/needless_pub_self.fixed b/tests/ui/needless_pub_self.fixed index 7b4601ba8a37..8a2c443c47ab 100644 --- a/tests/ui/needless_pub_self.fixed +++ b/tests/ui/needless_pub_self.fixed @@ -1,7 +1,6 @@ //@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] -#![allow(unused)] #![warn(clippy::needless_pub_self)] #![no_main] #![rustfmt::skip] // rustfmt will remove `in`, understandable diff --git a/tests/ui/needless_pub_self.rs b/tests/ui/needless_pub_self.rs index f64a56c37989..7bd2d028364f 100644 --- a/tests/ui/needless_pub_self.rs +++ b/tests/ui/needless_pub_self.rs @@ -1,7 +1,6 @@ //@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] -#![allow(unused)] #![warn(clippy::needless_pub_self)] #![no_main] #![rustfmt::skip] // rustfmt will remove `in`, understandable diff --git a/tests/ui/needless_pub_self.stderr b/tests/ui/needless_pub_self.stderr index c362d11804ec..17b69e09d202 100644 --- a/tests/ui/needless_pub_self.stderr +++ b/tests/ui/needless_pub_self.stderr @@ -1,5 +1,5 @@ error: unnecessary `pub(self)` - --> tests/ui/needless_pub_self.rs:13:1 + --> tests/ui/needless_pub_self.rs:12:1 | LL | pub(self) fn a() {} | ^^^^^^^^^ @@ -9,7 +9,7 @@ LL | pub(self) fn a() {} = help: remove it error: unnecessary `pub(in self)` - --> tests/ui/needless_pub_self.rs:15:1 + --> tests/ui/needless_pub_self.rs:14:1 | LL | pub(in self) fn b() {} | ^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | pub(in self) fn b() {} = help: remove it error: unnecessary `pub(self)` - --> tests/ui/needless_pub_self.rs:22:5 + --> tests/ui/needless_pub_self.rs:21:5 | LL | pub(self) fn f() {} | ^^^^^^^^^ diff --git a/tests/ui/needless_question_mark.fixed b/tests/ui/needless_question_mark.fixed index 375c38771eb6..c4e02c7ac6f6 100644 --- a/tests/ui/needless_question_mark.fixed +++ b/tests/ui/needless_question_mark.fixed @@ -1,11 +1,5 @@ #![warn(clippy::needless_question_mark)] -#![allow( - clippy::needless_return, - clippy::unnecessary_unwrap, - clippy::upper_case_acronyms, - dead_code, - unused_must_use -)] +#![expect(clippy::needless_return, clippy::unnecessary_unwrap)] struct TO { magic: Option, diff --git a/tests/ui/needless_question_mark.rs b/tests/ui/needless_question_mark.rs index 5f6bd0c0f166..87843e3e11c8 100644 --- a/tests/ui/needless_question_mark.rs +++ b/tests/ui/needless_question_mark.rs @@ -1,11 +1,5 @@ #![warn(clippy::needless_question_mark)] -#![allow( - clippy::needless_return, - clippy::unnecessary_unwrap, - clippy::upper_case_acronyms, - dead_code, - unused_must_use -)] +#![expect(clippy::needless_return, clippy::unnecessary_unwrap)] struct TO { magic: Option, diff --git a/tests/ui/needless_question_mark.stderr b/tests/ui/needless_question_mark.stderr index 8516cee48e67..8e0a740cc0ab 100644 --- a/tests/ui/needless_question_mark.stderr +++ b/tests/ui/needless_question_mark.stderr @@ -1,5 +1,5 @@ error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:20:12 + --> tests/ui/needless_question_mark.rs:14:12 | LL | return Some(to.magic?); | ^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + return to.magic; | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:29:12 + --> tests/ui/needless_question_mark.rs:23:12 | LL | return Some(to.magic?) | ^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + return to.magic | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:35:5 + --> tests/ui/needless_question_mark.rs:29:5 | LL | Some(to.magic?) | ^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + to.magic | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:41:21 + --> tests/ui/needless_question_mark.rs:35:21 | LL | to.and_then(|t| Some(t.magic?)) | ^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + to.and_then(|t| t.magic) | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:51:9 + --> tests/ui/needless_question_mark.rs:45:9 | LL | Some(t.magic?) | ^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + t.magic | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:57:12 + --> tests/ui/needless_question_mark.rs:51:12 | LL | return Ok(tr.magic?); | ^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + return tr.magic; | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:65:12 + --> tests/ui/needless_question_mark.rs:59:12 | LL | return Ok(tr.magic?) | ^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + return tr.magic | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:70:5 + --> tests/ui/needless_question_mark.rs:64:5 | LL | Ok(tr.magic?) | ^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + tr.magic | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:75:21 + --> tests/ui/needless_question_mark.rs:69:21 | LL | tr.and_then(|t| Ok(t.magic?)) | ^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + tr.and_then(|t| t.magic) | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:84:9 + --> tests/ui/needless_question_mark.rs:78:9 | LL | Ok(t.magic?) | ^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + t.magic | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:92:16 + --> tests/ui/needless_question_mark.rs:86:16 | LL | return Ok(t.magic?); | ^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + return t.magic; | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:128:27 + --> tests/ui/needless_question_mark.rs:122:27 | LL | || -> Option<_> { Some(Some($expr)?) }() | ^^^^^^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL + || -> Option<_> { Some($expr) }() | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:140:5 + --> tests/ui/needless_question_mark.rs:134:5 | LL | Some(to.magic?) | ^^^^^^^^^^^^^^^ @@ -161,7 +161,7 @@ LL + to.magic | error: enclosing `Ok` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:149:5 + --> tests/ui/needless_question_mark.rs:143:5 | LL | Ok(s.magic?) | ^^^^^^^^^^^^ @@ -173,7 +173,7 @@ LL + s.magic | error: enclosing `Some` and `?` operator are unneeded - --> tests/ui/needless_question_mark.rs:154:7 + --> tests/ui/needless_question_mark.rs:148:7 | LL | { Some(a?) } | ^^^^^^^^ diff --git a/tests/ui/needless_range_loop.rs b/tests/ui/needless_range_loop.rs index ea4591d8b71a..dcb702626604 100644 --- a/tests/ui/needless_range_loop.rs +++ b/tests/ui/needless_range_loop.rs @@ -1,10 +1,5 @@ #![warn(clippy::needless_range_loop)] -#![allow( - clippy::uninlined_format_args, - clippy::unnecessary_literal_unwrap, - clippy::useless_vec, - clippy::manual_slice_fill -)] +#![expect(clippy::unnecessary_literal_unwrap, clippy::useless_vec)] //@no-rustfix static STATIC: [usize; 4] = [0, 1, 8, 16]; const CONST: [usize; 4] = [0, 1, 8, 16]; diff --git a/tests/ui/needless_range_loop.stderr b/tests/ui/needless_range_loop.stderr index 33a519d8a80d..ab9693bb46d6 100644 --- a/tests/ui/needless_range_loop.stderr +++ b/tests/ui/needless_range_loop.stderr @@ -1,5 +1,5 @@ error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:16:14 + --> tests/ui/needless_range_loop.rs:11:14 | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + for in &vec { | error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:27:14 + --> tests/ui/needless_range_loop.rs:22:14 | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + for in &vec { | error: the loop variable `j` is only used to index `STATIC` - --> tests/ui/needless_range_loop.rs:34:14 + --> tests/ui/needless_range_loop.rs:29:14 | LL | for j in 0..4 { | ^^^^ @@ -37,7 +37,7 @@ LL + for in &STATIC { | error: the loop variable `j` is only used to index `CONST` - --> tests/ui/needless_range_loop.rs:40:14 + --> tests/ui/needless_range_loop.rs:35:14 | LL | for j in 0..4 { | ^^^^ @@ -49,7 +49,7 @@ LL + for in &CONST { | error: the loop variable `i` is used to index `vec` - --> tests/ui/needless_range_loop.rs:46:14 + --> tests/ui/needless_range_loop.rs:41:14 | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + for (i, ) in vec.iter().enumerate() { | error: the loop variable `i` is only used to index `vec2` - --> tests/ui/needless_range_loop.rs:56:14 + --> tests/ui/needless_range_loop.rs:51:14 | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + for in vec2.iter().take(vec.len()) { | error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:62:14 + --> tests/ui/needless_range_loop.rs:57:14 | LL | for i in 5..vec.len() { | ^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + for in vec.iter().skip(5) { | error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:68:14 + --> tests/ui/needless_range_loop.rs:63:14 | LL | for i in 0..MAX_LEN { | ^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + for in vec.iter().take(MAX_LEN) { | error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:74:14 + --> tests/ui/needless_range_loop.rs:69:14 | LL | for i in 0..=MAX_LEN { | ^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + for in vec.iter().take(MAX_LEN + 1) { | error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:80:14 + --> tests/ui/needless_range_loop.rs:75:14 | LL | for i in 5..10 { | ^^^^^ @@ -121,7 +121,7 @@ LL + for in vec.iter().take(10).skip(5) { | error: the loop variable `i` is only used to index `vec` - --> tests/ui/needless_range_loop.rs:86:14 + --> tests/ui/needless_range_loop.rs:81:14 | LL | for i in 5..=10 { | ^^^^^^ @@ -133,7 +133,7 @@ LL + for in vec.iter().take(10 + 1).skip(5) { | error: the loop variable `i` is used to index `vec` - --> tests/ui/needless_range_loop.rs:92:14 + --> tests/ui/needless_range_loop.rs:87:14 | LL | for i in 5..vec.len() { | ^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + for (i, ) in vec.iter().enumerate().skip(5) { | error: the loop variable `i` is used to index `vec` - --> tests/ui/needless_range_loop.rs:98:14 + --> tests/ui/needless_range_loop.rs:93:14 | LL | for i in 5..10 { | ^^^^^ @@ -157,7 +157,7 @@ LL + for (i, ) in vec.iter().enumerate().take(10).skip(5) { | error: the loop variable `i` is used to index `vec` - --> tests/ui/needless_range_loop.rs:105:14 + --> tests/ui/needless_range_loop.rs:100:14 | LL | for i in 0..vec.len() { | ^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + for (i, ) in vec.iter_mut().enumerate() { | error: the loop variable `i` is used to index `a` - --> tests/ui/needless_range_loop.rs:235:14 + --> tests/ui/needless_range_loop.rs:230:14 | LL | for i in 0..MAX_LEN { | ^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + for (i, ) in a.iter().enumerate().take(MAX_LEN) { | error: the loop variable `i` is only used to index `a` - --> tests/ui/needless_range_loop.rs:240:14 + --> tests/ui/needless_range_loop.rs:235:14 | LL | for i in 0..MAX_LEN { | ^^^^^^^^^^ diff --git a/tests/ui/needless_range_loop2.rs b/tests/ui/needless_range_loop2.rs index 68784a8df19d..333a4d8e5e76 100644 --- a/tests/ui/needless_range_loop2.rs +++ b/tests/ui/needless_range_loop2.rs @@ -1,5 +1,5 @@ #![warn(clippy::needless_range_loop)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] //@no-rustfix fn calc_idx(i: usize) -> usize { (i + i + 20) % 4 diff --git a/tests/ui/needless_raw_string.fixed b/tests/ui/needless_raw_string.fixed index 88f9096db03c..93225f56e377 100644 --- a/tests/ui/needless_raw_string.fixed +++ b/tests/ui/needless_raw_string.fixed @@ -1,5 +1,5 @@ -#![allow(clippy::needless_raw_string_hashes, clippy::no_effect, unused)] #![warn(clippy::needless_raw_strings)] +#![expect(clippy::needless_raw_string_hashes, clippy::no_effect)] fn main() { "aaa"; diff --git a/tests/ui/needless_raw_string.rs b/tests/ui/needless_raw_string.rs index 6913b8b75546..fcd32cd65112 100644 --- a/tests/ui/needless_raw_string.rs +++ b/tests/ui/needless_raw_string.rs @@ -1,5 +1,5 @@ -#![allow(clippy::needless_raw_string_hashes, clippy::no_effect, unused)] #![warn(clippy::needless_raw_strings)] +#![expect(clippy::needless_raw_string_hashes, clippy::no_effect)] fn main() { r#"aaa"#; diff --git a/tests/ui/needless_raw_string_hashes.fixed b/tests/ui/needless_raw_string_hashes.fixed index bc7da202df4a..0a2a684f5b0f 100644 --- a/tests/ui/needless_raw_string_hashes.fixed +++ b/tests/ui/needless_raw_string_hashes.fixed @@ -1,5 +1,5 @@ -#![allow(clippy::no_effect, unused)] #![warn(clippy::needless_raw_string_hashes)] +#![expect(clippy::no_effect)] fn main() { r"\aaa"; diff --git a/tests/ui/needless_raw_string_hashes.rs b/tests/ui/needless_raw_string_hashes.rs index 3f2f92a4097c..a793099c441b 100644 --- a/tests/ui/needless_raw_string_hashes.rs +++ b/tests/ui/needless_raw_string_hashes.rs @@ -1,5 +1,5 @@ -#![allow(clippy::no_effect, unused)] #![warn(clippy::needless_raw_string_hashes)] +#![expect(clippy::no_effect)] fn main() { r#"\aaa"#; diff --git a/tests/ui/needless_return.fixed b/tests/ui/needless_return.fixed index f5f8bb21e815..72986b9f8960 100644 --- a/tests/ui/needless_return.fixed +++ b/tests/ui/needless_return.fixed @@ -1,15 +1,8 @@ //@aux-build:proc_macros.rs #![feature(yeet_expr)] -#![allow(unused)] -#![allow( - clippy::if_same_then_else, - clippy::single_match, - clippy::needless_bool, - clippy::equatable_if_let, - clippy::needless_else, - clippy::missing_safety_doc -)] #![warn(clippy::needless_return)] +#![allow(clippy::single_match)] +#![expect(clippy::if_same_then_else, clippy::missing_safety_doc, clippy::needless_bool)] extern crate proc_macros; use proc_macros::with_span; diff --git a/tests/ui/needless_return.rs b/tests/ui/needless_return.rs index 495516c1c2e5..63b7a2524962 100644 --- a/tests/ui/needless_return.rs +++ b/tests/ui/needless_return.rs @@ -1,15 +1,8 @@ //@aux-build:proc_macros.rs #![feature(yeet_expr)] -#![allow(unused)] -#![allow( - clippy::if_same_then_else, - clippy::single_match, - clippy::needless_bool, - clippy::equatable_if_let, - clippy::needless_else, - clippy::missing_safety_doc -)] #![warn(clippy::needless_return)] +#![allow(clippy::single_match)] +#![expect(clippy::if_same_then_else, clippy::missing_safety_doc, clippy::needless_bool)] extern crate proc_macros; use proc_macros::with_span; diff --git a/tests/ui/needless_return.stderr b/tests/ui/needless_return.stderr index 206bd8ee5af1..5292a776ad7c 100644 --- a/tests/ui/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -1,5 +1,5 @@ error: unneeded `return` statement - --> tests/ui/needless_return.rs:30:5 + --> tests/ui/needless_return.rs:23:5 | LL | return true; | ^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:35:5 + --> tests/ui/needless_return.rs:28:5 | LL | return true; | ^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:41:5 + --> tests/ui/needless_return.rs:34:5 | LL | return true;;; | ^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:47:5 + --> tests/ui/needless_return.rs:40:5 | LL | return true;; ; ; | ^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:53:9 + --> tests/ui/needless_return.rs:46:9 | LL | return true; | ^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:56:9 + --> tests/ui/needless_return.rs:49:9 | LL | return false; | ^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + false | error: unneeded `return` statement - --> tests/ui/needless_return.rs:63:17 + --> tests/ui/needless_return.rs:56:17 | LL | true => return false, | ^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + true => false, | error: unneeded `return` statement - --> tests/ui/needless_return.rs:66:13 + --> tests/ui/needless_return.rs:59:13 | LL | return true; | ^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:74:9 + --> tests/ui/needless_return.rs:67:9 | LL | return true; | ^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:77:16 + --> tests/ui/needless_return.rs:70:16 | LL | let _ = || return true; | ^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + let _ = || true; | error: unneeded `return` statement - --> tests/ui/needless_return.rs:82:5 + --> tests/ui/needless_return.rs:75:5 | LL | return the_answer!(); | ^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + the_answer!() | error: unneeded `return` statement - --> tests/ui/needless_return.rs:87:5 + --> tests/ui/needless_return.rs:80:5 | LL | return; | ^^^^^^ @@ -146,7 +146,7 @@ LL + fn test_void_fun() { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:93:9 + --> tests/ui/needless_return.rs:86:9 | LL | return; | ^^^^^^ @@ -159,7 +159,7 @@ LL + if b { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:96:9 + --> tests/ui/needless_return.rs:89:9 | LL | return; | ^^^^^^ @@ -172,7 +172,7 @@ LL + } else { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:104:14 + --> tests/ui/needless_return.rs:97:14 | LL | _ => return, | ^^^^^^ @@ -184,7 +184,7 @@ LL + _ => (), | error: unneeded `return` statement - --> tests/ui/needless_return.rs:114:13 + --> tests/ui/needless_return.rs:107:13 | LL | return; | ^^^^^^ @@ -197,7 +197,7 @@ LL + let _ = 42; | error: unneeded `return` statement - --> tests/ui/needless_return.rs:117:14 + --> tests/ui/needless_return.rs:110:14 | LL | _ => return, | ^^^^^^ @@ -209,7 +209,7 @@ LL + _ => (), | error: unneeded `return` statement - --> tests/ui/needless_return.rs:131:9 + --> tests/ui/needless_return.rs:124:9 | LL | return String::from("test"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -221,7 +221,7 @@ LL + String::from("test") | error: unneeded `return` statement - --> tests/ui/needless_return.rs:134:9 + --> tests/ui/needless_return.rs:127:9 | LL | return String::new(); | ^^^^^^^^^^^^^^^^^^^^ @@ -233,7 +233,7 @@ LL + String::new() | error: unneeded `return` statement - --> tests/ui/needless_return.rs:157:32 + --> tests/ui/needless_return.rs:150:32 | LL | bar.unwrap_or_else(|_| return) | ^^^^^^ @@ -245,7 +245,7 @@ LL + bar.unwrap_or_else(|_| {}) | error: unneeded `return` statement - --> tests/ui/needless_return.rs:163:13 + --> tests/ui/needless_return.rs:156:13 | LL | return; | ^^^^^^ @@ -258,7 +258,7 @@ LL + let _ = || { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:166:20 + --> tests/ui/needless_return.rs:159:20 | LL | let _ = || return; | ^^^^^^ @@ -270,7 +270,7 @@ LL + let _ = || {}; | error: unneeded `return` statement - --> tests/ui/needless_return.rs:173:32 + --> tests/ui/needless_return.rs:166:32 | LL | res.unwrap_or_else(|_| return Foo) | ^^^^^^^^^^ @@ -282,7 +282,7 @@ LL + res.unwrap_or_else(|_| Foo) | error: unneeded `return` statement - --> tests/ui/needless_return.rs:183:5 + --> tests/ui/needless_return.rs:176:5 | LL | return true; | ^^^^^^^^^^^ @@ -294,7 +294,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:188:5 + --> tests/ui/needless_return.rs:181:5 | LL | return true; | ^^^^^^^^^^^ @@ -306,7 +306,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:194:9 + --> tests/ui/needless_return.rs:187:9 | LL | return true; | ^^^^^^^^^^^ @@ -318,7 +318,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:197:9 + --> tests/ui/needless_return.rs:190:9 | LL | return false; | ^^^^^^^^^^^^ @@ -330,7 +330,7 @@ LL + false | error: unneeded `return` statement - --> tests/ui/needless_return.rs:204:17 + --> tests/ui/needless_return.rs:197:17 | LL | true => return false, | ^^^^^^^^^^^^ @@ -342,7 +342,7 @@ LL + true => false, | error: unneeded `return` statement - --> tests/ui/needless_return.rs:207:13 + --> tests/ui/needless_return.rs:200:13 | LL | return true; | ^^^^^^^^^^^ @@ -354,7 +354,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:215:9 + --> tests/ui/needless_return.rs:208:9 | LL | return true; | ^^^^^^^^^^^ @@ -366,7 +366,7 @@ LL + true | error: unneeded `return` statement - --> tests/ui/needless_return.rs:218:16 + --> tests/ui/needless_return.rs:211:16 | LL | let _ = || return true; | ^^^^^^^^^^^ @@ -378,7 +378,7 @@ LL + let _ = || true; | error: unneeded `return` statement - --> tests/ui/needless_return.rs:223:5 + --> tests/ui/needless_return.rs:216:5 | LL | return the_answer!(); | ^^^^^^^^^^^^^^^^^^^^ @@ -390,7 +390,7 @@ LL + the_answer!() | error: unneeded `return` statement - --> tests/ui/needless_return.rs:228:5 + --> tests/ui/needless_return.rs:221:5 | LL | return; | ^^^^^^ @@ -403,7 +403,7 @@ LL + async fn async_test_void_fun() { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:234:9 + --> tests/ui/needless_return.rs:227:9 | LL | return; | ^^^^^^ @@ -416,7 +416,7 @@ LL + if b { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:237:9 + --> tests/ui/needless_return.rs:230:9 | LL | return; | ^^^^^^ @@ -429,7 +429,7 @@ LL + } else { | error: unneeded `return` statement - --> tests/ui/needless_return.rs:245:14 + --> tests/ui/needless_return.rs:238:14 | LL | _ => return, | ^^^^^^ @@ -441,7 +441,7 @@ LL + _ => (), | error: unneeded `return` statement - --> tests/ui/needless_return.rs:259:9 + --> tests/ui/needless_return.rs:252:9 | LL | return String::from("test"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -453,7 +453,7 @@ LL + String::from("test") | error: unneeded `return` statement - --> tests/ui/needless_return.rs:262:9 + --> tests/ui/needless_return.rs:255:9 | LL | return String::new(); | ^^^^^^^^^^^^^^^^^^^^ @@ -465,7 +465,7 @@ LL + String::new() | error: unneeded `return` statement - --> tests/ui/needless_return.rs:279:5 + --> tests/ui/needless_return.rs:272:5 | LL | return format!("Hello {}", "world!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -477,7 +477,7 @@ LL + format!("Hello {}", "world!") | error: unneeded `return` statement - --> tests/ui/needless_return.rs:321:9 + --> tests/ui/needless_return.rs:314:9 | LL | return true; | ^^^^^^^^^^^ @@ -492,7 +492,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:324:9 + --> tests/ui/needless_return.rs:317:9 | LL | return false; | ^^^^^^^^^^^^ @@ -505,7 +505,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:332:13 + --> tests/ui/needless_return.rs:325:13 | LL | return 10; | ^^^^^^^^^ @@ -520,7 +520,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:336:13 + --> tests/ui/needless_return.rs:329:13 | LL | return 100; | ^^^^^^^^^^ @@ -534,7 +534,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:345:9 + --> tests/ui/needless_return.rs:338:9 | LL | return 0; | ^^^^^^^^ @@ -547,7 +547,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:353:13 + --> tests/ui/needless_return.rs:346:13 | LL | return *(x as *const isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -563,7 +563,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:356:13 + --> tests/ui/needless_return.rs:349:13 | LL | return !*(x as *const isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -577,7 +577,7 @@ LL ~ } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:365:9 + --> tests/ui/needless_return.rs:358:9 | LL | return; | ^^^^^^ @@ -590,7 +590,7 @@ LL + let _ = 42; | error: unneeded `return` statement - --> tests/ui/needless_return.rs:371:21 + --> tests/ui/needless_return.rs:364:21 | LL | let _ = 42; return; | ^^^^^^ @@ -602,7 +602,7 @@ LL + let _ = 42; | error: unneeded `return` statement - --> tests/ui/needless_return.rs:384:9 + --> tests/ui/needless_return.rs:377:9 | LL | return Ok(format!("ok!")); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -614,7 +614,7 @@ LL + Ok(format!("ok!")) | error: unneeded `return` statement - --> tests/ui/needless_return.rs:387:9 + --> tests/ui/needless_return.rs:380:9 | LL | return Err(format!("err!")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -626,7 +626,7 @@ LL + Err(format!("err!")) | error: unneeded `return` statement - --> tests/ui/needless_return.rs:394:9 + --> tests/ui/needless_return.rs:387:9 | LL | return if true { 1 } else { 2 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -638,7 +638,7 @@ LL + if true { 1 } else { 2 } | error: unneeded `return` statement - --> tests/ui/needless_return.rs:399:9 + --> tests/ui/needless_return.rs:392:9 | LL | return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -650,7 +650,7 @@ LL + (if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else | error: unneeded `return` statement - --> tests/ui/needless_return.rs:421:5 + --> tests/ui/needless_return.rs:414:5 | LL | return { "a".to_string() } + "b" + { "c" }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -662,7 +662,7 @@ LL + ({ "a".to_string() } + "b" + { "c" }) | error: unneeded `return` statement - --> tests/ui/needless_return.rs:426:5 + --> tests/ui/needless_return.rs:419:5 | LL | return "".split("").next().unwrap().to_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -674,7 +674,7 @@ LL + "".split("").next().unwrap().to_string() | error: unneeded `return` statement - --> tests/ui/needless_return.rs:461:5 + --> tests/ui/needless_return.rs:454:5 | LL | return unsafe { todo() } as *const i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -686,7 +686,7 @@ LL + (unsafe { todo() } as *const i32) | error: unneeded `return` statement - --> tests/ui/needless_return.rs:468:13 + --> tests/ui/needless_return.rs:461:13 | LL | return 1; | ^^^^^^^^ @@ -698,7 +698,7 @@ LL + 1 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:471:13 + --> tests/ui/needless_return.rs:464:13 | LL | return 2; | ^^^^^^^^ @@ -710,7 +710,7 @@ LL + 2 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:474:13 + --> tests/ui/needless_return.rs:467:13 | LL | return 3; | ^^^^^^^^ @@ -722,7 +722,7 @@ LL + 3 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:481:13 + --> tests/ui/needless_return.rs:474:13 | LL | return 1; | ^^^^^^^^ @@ -734,7 +734,7 @@ LL + 1 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:486:13 + --> tests/ui/needless_return.rs:479:13 | LL | return 3; | ^^^^^^^^ @@ -746,7 +746,7 @@ LL + 3 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:493:13 + --> tests/ui/needless_return.rs:486:13 | LL | return 1; | ^^^^^^^^ @@ -758,7 +758,7 @@ LL + 1 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:498:13 + --> tests/ui/needless_return.rs:491:13 | LL | return 3; | ^^^^^^^^ @@ -770,7 +770,7 @@ LL + 3 | error: unneeded `return` statement - --> tests/ui/needless_return.rs:506:13 + --> tests/ui/needless_return.rs:499:13 | LL | return 1; | ^^^^^^^^ diff --git a/tests/ui/needless_return_with_question_mark.fixed b/tests/ui/needless_return_with_question_mark.fixed index a8e9f09fa5ec..bd6c7a18722e 100644 --- a/tests/ui/needless_return_with_question_mark.fixed +++ b/tests/ui/needless_return_with_question_mark.fixed @@ -1,12 +1,11 @@ //@aux-build:proc_macros.rs -#![allow( +#![warn(clippy::needless_return_with_question_mark)] +#![expect( + clippy::diverging_sub_expression, clippy::needless_return, clippy::no_effect, clippy::unit_arg, - clippy::useless_conversion, - clippy::diverging_sub_expression, - clippy::let_unit_value, - unused + clippy::useless_conversion )] #[macro_use] diff --git a/tests/ui/needless_return_with_question_mark.rs b/tests/ui/needless_return_with_question_mark.rs index aba7ffb273bc..a92dd92ab0bc 100644 --- a/tests/ui/needless_return_with_question_mark.rs +++ b/tests/ui/needless_return_with_question_mark.rs @@ -1,12 +1,11 @@ //@aux-build:proc_macros.rs -#![allow( +#![warn(clippy::needless_return_with_question_mark)] +#![expect( + clippy::diverging_sub_expression, clippy::needless_return, clippy::no_effect, clippy::unit_arg, - clippy::useless_conversion, - clippy::diverging_sub_expression, - clippy::let_unit_value, - unused + clippy::useless_conversion )] #[macro_use] diff --git a/tests/ui/needless_return_with_question_mark.stderr b/tests/ui/needless_return_with_question_mark.stderr index d73a0e3fdc89..5aec5ec00b61 100644 --- a/tests/ui/needless_return_with_question_mark.stderr +++ b/tests/ui/needless_return_with_question_mark.stderr @@ -1,5 +1,5 @@ error: unneeded `return` statement with `?` operator - --> tests/ui/needless_return_with_question_mark.rs:29:5 + --> tests/ui/needless_return_with_question_mark.rs:28:5 | LL | return Err(())?; | ^^^^^^^ help: remove it @@ -8,25 +8,25 @@ LL | return Err(())?; = help: to override `-D warnings` add `#[allow(clippy::needless_return_with_question_mark)]` error: unneeded `return` statement with `?` operator - --> tests/ui/needless_return_with_question_mark.rs:70:9 + --> tests/ui/needless_return_with_question_mark.rs:69:9 | LL | return Err(())?; | ^^^^^^^ help: remove it error: unneeded `return` statement with `?` operator - --> tests/ui/needless_return_with_question_mark.rs:134:9 + --> tests/ui/needless_return_with_question_mark.rs:133:9 | LL | return Err(())?; | ^^^^^^^ help: remove it error: unneeded `return` statement with `?` operator - --> tests/ui/needless_return_with_question_mark.rs:143:13 + --> tests/ui/needless_return_with_question_mark.rs:142:13 | LL | return Err(())?; | ^^^^^^^ help: remove it error: unneeded `return` statement with `?` operator - --> tests/ui/needless_return_with_question_mark.rs:163:5 + --> tests/ui/needless_return_with_question_mark.rs:162:5 | LL | return Err(())?; | ^^^^^^^ help: remove it diff --git a/tests/ui/needless_splitn.fixed b/tests/ui/needless_splitn.fixed index bf5c1717ae53..c6a180a00e5e 100644 --- a/tests/ui/needless_splitn.fixed +++ b/tests/ui/needless_splitn.fixed @@ -1,11 +1,10 @@ //@edition:2018 #![warn(clippy::needless_splitn)] -#![allow(clippy::iter_skip_next, clippy::iter_nth_zero, clippy::manual_split_once)] +#![expect(clippy::iter_nth_zero, clippy::manual_split_once)] extern crate itertools; -#[allow(unused_imports)] use itertools::Itertools; fn main() { diff --git a/tests/ui/needless_splitn.rs b/tests/ui/needless_splitn.rs index fdfdcb9d5ca8..d10430f7a6f9 100644 --- a/tests/ui/needless_splitn.rs +++ b/tests/ui/needless_splitn.rs @@ -1,11 +1,10 @@ //@edition:2018 #![warn(clippy::needless_splitn)] -#![allow(clippy::iter_skip_next, clippy::iter_nth_zero, clippy::manual_split_once)] +#![expect(clippy::iter_nth_zero, clippy::manual_split_once)] extern crate itertools; -#[allow(unused_imports)] use itertools::Itertools; fn main() { diff --git a/tests/ui/needless_splitn.stderr b/tests/ui/needless_splitn.stderr index 49387793a122..b71abb89ded3 100644 --- a/tests/ui/needless_splitn.stderr +++ b/tests/ui/needless_splitn.stderr @@ -1,5 +1,5 @@ error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:13:13 + --> tests/ui/needless_splitn.rs:12:13 | LL | let _ = str.splitn(2, '=').next(); | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` @@ -8,73 +8,73 @@ LL | let _ = str.splitn(2, '=').next(); = help: to override `-D warnings` add `#[allow(clippy::needless_splitn)]` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:15:13 + --> tests/ui/needless_splitn.rs:14:13 | LL | let _ = str.splitn(2, '=').nth(0); | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:19:18 + --> tests/ui/needless_splitn.rs:18:18 | LL | let (_, _) = str.splitn(3, '=').next_tuple().unwrap(); | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` error: unnecessary use of `rsplitn` - --> tests/ui/needless_splitn.rs:23:13 + --> tests/ui/needless_splitn.rs:22:13 | LL | let _ = str.rsplitn(2, '=').next(); | ^^^^^^^^^^^^^^^^^^^ help: try: `str.rsplit('=')` error: unnecessary use of `rsplitn` - --> tests/ui/needless_splitn.rs:25:13 + --> tests/ui/needless_splitn.rs:24:13 | LL | let _ = str.rsplitn(2, '=').nth(0); | ^^^^^^^^^^^^^^^^^^^ help: try: `str.rsplit('=')` error: unnecessary use of `rsplitn` - --> tests/ui/needless_splitn.rs:29:18 + --> tests/ui/needless_splitn.rs:28:18 | LL | let (_, _) = str.rsplitn(3, '=').next_tuple().unwrap(); | ^^^^^^^^^^^^^^^^^^^ help: try: `str.rsplit('=')` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:32:13 + --> tests/ui/needless_splitn.rs:31:13 | LL | let _ = str.splitn(5, '=').next(); | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:34:13 + --> tests/ui/needless_splitn.rs:33:13 | LL | let _ = str.splitn(5, '=').nth(3); | ^^^^^^^^^^^^^^^^^^ help: try: `str.split('=')` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:41:13 + --> tests/ui/needless_splitn.rs:40:13 | LL | let _ = s.splitn(2, '=').next()?; | ^^^^^^^^^^^^^^^^ help: try: `s.split('=')` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:43:13 + --> tests/ui/needless_splitn.rs:42:13 | LL | let _ = s.splitn(2, '=').nth(0)?; | ^^^^^^^^^^^^^^^^ help: try: `s.split('=')` error: unnecessary use of `rsplitn` - --> tests/ui/needless_splitn.rs:45:13 + --> tests/ui/needless_splitn.rs:44:13 | LL | let _ = s.rsplitn(2, '=').next()?; | ^^^^^^^^^^^^^^^^^ help: try: `s.rsplit('=')` error: unnecessary use of `rsplitn` - --> tests/ui/needless_splitn.rs:47:13 + --> tests/ui/needless_splitn.rs:46:13 | LL | let _ = s.rsplitn(2, '=').nth(0)?; | ^^^^^^^^^^^^^^^^^ help: try: `s.rsplit('=')` error: unnecessary use of `splitn` - --> tests/ui/needless_splitn.rs:56:13 + --> tests/ui/needless_splitn.rs:55:13 | LL | let _ = "key=value".splitn(2, '=').nth(0).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"key=value".split('=')` diff --git a/tests/ui/needless_type_cast.fixed b/tests/ui/needless_type_cast.fixed index 72eed32c4d73..921bff5ac6f5 100644 --- a/tests/ui/needless_type_cast.fixed +++ b/tests/ui/needless_type_cast.fixed @@ -1,5 +1,5 @@ #![warn(clippy::needless_type_cast)] -#![allow(clippy::no_effect, clippy::unnecessary_cast, unused)] +#![allow(clippy::unnecessary_cast)] fn takes_i32(x: i32) -> i32 { x diff --git a/tests/ui/needless_type_cast.rs b/tests/ui/needless_type_cast.rs index 31337575fcc3..d112916e3ad2 100644 --- a/tests/ui/needless_type_cast.rs +++ b/tests/ui/needless_type_cast.rs @@ -1,5 +1,5 @@ #![warn(clippy::needless_type_cast)] -#![allow(clippy::no_effect, clippy::unnecessary_cast, unused)] +#![allow(clippy::unnecessary_cast)] fn takes_i32(x: i32) -> i32 { x diff --git a/tests/ui/needless_update.rs b/tests/ui/needless_update.rs index 62e349234319..8a701e003ca8 100644 --- a/tests/ui/needless_update.rs +++ b/tests/ui/needless_update.rs @@ -1,5 +1,5 @@ #![warn(clippy::needless_update)] -#![allow(clippy::no_effect, clippy::unnecessary_struct_initialization)] +#![expect(clippy::no_effect, clippy::unnecessary_struct_initialization)] struct S { pub a: i32, diff --git a/tests/ui/neg_multiply.fixed b/tests/ui/neg_multiply.fixed index 32d466e88fc8..3c5734c941ad 100644 --- a/tests/ui/neg_multiply.fixed +++ b/tests/ui/neg_multiply.fixed @@ -1,6 +1,6 @@ #![warn(clippy::neg_multiply)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::precedence)] -#![allow(unused)] +#![allow(clippy::precedence)] +#![expect(clippy::no_effect)] use std::ops::Mul; diff --git a/tests/ui/neg_multiply.rs b/tests/ui/neg_multiply.rs index 241a72c6d990..6364c35ea5ef 100644 --- a/tests/ui/neg_multiply.rs +++ b/tests/ui/neg_multiply.rs @@ -1,6 +1,6 @@ #![warn(clippy::neg_multiply)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::precedence)] -#![allow(unused)] +#![allow(clippy::precedence)] +#![expect(clippy::no_effect)] use std::ops::Mul; diff --git a/tests/ui/new_ret_no_self.rs b/tests/ui/new_ret_no_self.rs index d61973f09b17..c134c9e53fd1 100644 --- a/tests/ui/new_ret_no_self.rs +++ b/tests/ui/new_ret_no_self.rs @@ -1,6 +1,5 @@ #![feature(type_alias_impl_trait)] #![warn(clippy::new_ret_no_self)] -#![allow(dead_code)] fn main() {} diff --git a/tests/ui/new_ret_no_self.stderr b/tests/ui/new_ret_no_self.stderr index a758c746f918..f96d3f3e891a 100644 --- a/tests/ui/new_ret_no_self.stderr +++ b/tests/ui/new_ret_no_self.stderr @@ -1,5 +1,5 @@ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:50:5 + --> tests/ui/new_ret_no_self.rs:49:5 | LL | / pub fn new(_: String) -> impl R { LL | | @@ -12,7 +12,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::new_ret_no_self)]` error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:84:5 + --> tests/ui/new_ret_no_self.rs:83:5 | LL | / pub fn new() -> u32 { LL | | @@ -22,7 +22,7 @@ LL | | } | |_____^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:95:5 + --> tests/ui/new_ret_no_self.rs:94:5 | LL | / pub fn new(_: String) -> u32 { LL | | @@ -32,7 +32,7 @@ LL | | } | |_____^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:133:5 + --> tests/ui/new_ret_no_self.rs:132:5 | LL | / pub fn new() -> (u32, u32) { LL | | @@ -42,7 +42,7 @@ LL | | } | |_____^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:162:5 + --> tests/ui/new_ret_no_self.rs:161:5 | LL | / pub fn new() -> *mut V { LL | | @@ -52,7 +52,7 @@ LL | | } | |_____^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:182:5 + --> tests/ui/new_ret_no_self.rs:181:5 | LL | / pub fn new() -> Option { LL | | @@ -62,19 +62,19 @@ LL | | } | |_____^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:237:9 + --> tests/ui/new_ret_no_self.rs:236:9 | LL | fn new() -> String; | ^^^^^^^^^^^^^^^^^^^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:250:9 + --> tests/ui/new_ret_no_self.rs:249:9 | LL | fn new(_: String) -> String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:286:9 + --> tests/ui/new_ret_no_self.rs:285:9 | LL | / fn new() -> (u32, u32) { LL | | @@ -84,7 +84,7 @@ LL | | } | |_________^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:315:9 + --> tests/ui/new_ret_no_self.rs:314:9 | LL | / fn new() -> *mut V { LL | | @@ -94,7 +94,7 @@ LL | | } | |_________^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:387:9 + --> tests/ui/new_ret_no_self.rs:386:9 | LL | / fn new(t: T) -> impl Into { LL | | @@ -104,7 +104,7 @@ LL | | } | |_________^ error: methods called `new` usually return `Self` - --> tests/ui/new_ret_no_self.rs:408:9 + --> tests/ui/new_ret_no_self.rs:407:9 | LL | / fn new(t: T) -> impl Trait2<(), i32> { LL | | diff --git a/tests/ui/new_without_default.fixed b/tests/ui/new_without_default.fixed index f6591820feeb..1632189687e1 100644 --- a/tests/ui/new_without_default.fixed +++ b/tests/ui/new_without_default.fixed @@ -1,10 +1,5 @@ -#![allow( - clippy::missing_safety_doc, - clippy::extra_unused_lifetimes, - clippy::extra_unused_type_parameters, - clippy::needless_lifetimes -)] #![warn(clippy::new_without_default)] +#![expect(clippy::extra_unused_lifetimes, clippy::missing_safety_doc)] pub struct Foo; diff --git a/tests/ui/new_without_default.rs b/tests/ui/new_without_default.rs index d3447f2e16b2..197413f409c6 100644 --- a/tests/ui/new_without_default.rs +++ b/tests/ui/new_without_default.rs @@ -1,10 +1,5 @@ -#![allow( - clippy::missing_safety_doc, - clippy::extra_unused_lifetimes, - clippy::extra_unused_type_parameters, - clippy::needless_lifetimes -)] #![warn(clippy::new_without_default)] +#![expect(clippy::extra_unused_lifetimes, clippy::missing_safety_doc)] pub struct Foo; diff --git a/tests/ui/new_without_default.stderr b/tests/ui/new_without_default.stderr index 6c0f73d13185..30d48a66d394 100644 --- a/tests/ui/new_without_default.stderr +++ b/tests/ui/new_without_default.stderr @@ -1,5 +1,5 @@ error: you should consider adding a `Default` implementation for `Foo` - --> tests/ui/new_without_default.rs:12:5 + --> tests/ui/new_without_default.rs:7:5 | LL | / pub fn new() -> Foo { LL | | @@ -20,7 +20,7 @@ LL + } | error: you should consider adding a `Default` implementation for `Bar` - --> tests/ui/new_without_default.rs:22:5 + --> tests/ui/new_without_default.rs:17:5 | LL | / pub fn new() -> Self { LL | | @@ -39,7 +39,7 @@ LL + } | error: you should consider adding a `Default` implementation for `LtKo<'c>` - --> tests/ui/new_without_default.rs:88:5 + --> tests/ui/new_without_default.rs:83:5 | LL | / pub fn new() -> LtKo<'c> { LL | | @@ -58,7 +58,7 @@ LL + } | error: you should consider adding a `Default` implementation for `Const` - --> tests/ui/new_without_default.rs:122:5 + --> tests/ui/new_without_default.rs:117:5 | LL | / pub const fn new() -> Const { LL | | @@ -76,7 +76,7 @@ LL + } | error: you should consider adding a `Default` implementation for `NewNotEqualToDerive` - --> tests/ui/new_without_default.rs:183:5 + --> tests/ui/new_without_default.rs:178:5 | LL | / pub fn new() -> Self { LL | | @@ -95,7 +95,7 @@ LL + } | error: you should consider adding a `Default` implementation for `FooGenerics` - --> tests/ui/new_without_default.rs:193:5 + --> tests/ui/new_without_default.rs:188:5 | LL | / pub fn new() -> Self { LL | | @@ -114,7 +114,7 @@ LL + } | error: you should consider adding a `Default` implementation for `BarGenerics` - --> tests/ui/new_without_default.rs:202:5 + --> tests/ui/new_without_default.rs:197:5 | LL | / pub fn new() -> Self { LL | | @@ -133,7 +133,7 @@ LL + } | error: you should consider adding a `Default` implementation for `Foo` - --> tests/ui/new_without_default.rs:215:9 + --> tests/ui/new_without_default.rs:210:9 | LL | / pub fn new() -> Self { LL | | @@ -154,7 +154,7 @@ LL ~ impl Foo { | error: you should consider adding a `Default` implementation for `MyStruct` - --> tests/ui/new_without_default.rs:262:5 + --> tests/ui/new_without_default.rs:257:5 | LL | / pub fn new() -> Self { LL | | @@ -175,7 +175,7 @@ LL + } | error: you should consider adding a `Default` implementation for `NewWithCfg` - --> tests/ui/new_without_default.rs:273:5 + --> tests/ui/new_without_default.rs:268:5 | LL | / pub fn new() -> Self { LL | | @@ -194,7 +194,7 @@ LL + } | error: you should consider adding a `Default` implementation for `NewWith2Cfgs` - --> tests/ui/new_without_default.rs:283:5 + --> tests/ui/new_without_default.rs:278:5 | LL | / pub fn new() -> Self { LL | | @@ -214,7 +214,7 @@ LL + } | error: you should consider adding a `Default` implementation for `NewWithExtraneous` - --> tests/ui/new_without_default.rs:292:5 + --> tests/ui/new_without_default.rs:287:5 | LL | / pub fn new() -> Self { LL | | @@ -232,7 +232,7 @@ LL + } | error: you should consider adding a `Default` implementation for `NewWithCfgAndExtraneous` - --> tests/ui/new_without_default.rs:302:5 + --> tests/ui/new_without_default.rs:297:5 | LL | / pub fn new() -> Self { LL | | @@ -251,7 +251,7 @@ LL + } | error: you should consider adding a `Default` implementation for `Foo` - --> tests/ui/new_without_default.rs:340:9 + --> tests/ui/new_without_default.rs:335:9 | LL | / pub fn new() -> Self LL | | @@ -278,7 +278,7 @@ LL ~ impl Foo | error: you should consider adding a `Default` implementation for `Bar` - --> tests/ui/new_without_default.rs:354:9 + --> tests/ui/new_without_default.rs:349:9 | LL | / pub fn new() -> Self LL | | diff --git a/tests/ui/no_effect.rs b/tests/ui/no_effect.rs index 4ab5bc9acdee..b4eea30f74b1 100644 --- a/tests/ui/no_effect.rs +++ b/tests/ui/no_effect.rs @@ -1,6 +1,6 @@ #![feature(fn_traits, unboxed_closures)] #![warn(clippy::no_effect_underscore_binding)] -#![allow( +#![expect( clippy::deref_addrof, clippy::redundant_field_names, clippy::uninlined_format_args, diff --git a/tests/ui/no_effect_return.rs b/tests/ui/no_effect_return.rs index 4ba2fe07785d..574da03c175e 100644 --- a/tests/ui/no_effect_return.rs +++ b/tests/ui/no_effect_return.rs @@ -1,5 +1,5 @@ //@no-rustfix: overlapping suggestions -#![allow(clippy::unused_unit, dead_code, unused)] +#![expect(clippy::unused_unit)] #![no_main] use std::ops::ControlFlow; diff --git a/tests/ui/no_mangle_with_rust_abi.rs b/tests/ui/no_mangle_with_rust_abi.rs index f4248ffc0f4d..4c61b742a0e6 100644 --- a/tests/ui/no_mangle_with_rust_abi.rs +++ b/tests/ui/no_mangle_with_rust_abi.rs @@ -1,5 +1,4 @@ //@no-rustfix: overlapping suggestions -#![allow(unused)] #![warn(clippy::no_mangle_with_rust_abi)] #[unsafe(no_mangle)] diff --git a/tests/ui/no_mangle_with_rust_abi.stderr b/tests/ui/no_mangle_with_rust_abi.stderr index 871f38e94b63..a3dd4ea9e985 100644 --- a/tests/ui/no_mangle_with_rust_abi.stderr +++ b/tests/ui/no_mangle_with_rust_abi.stderr @@ -1,5 +1,5 @@ error: `#[unsafe(no_mangle)]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi.rs:6:1 + --> tests/ui/no_mangle_with_rust_abi.rs:5:1 | LL | fn rust_abi_fn_one(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | extern "Rust" fn rust_abi_fn_one(arg_one: u32, arg_two: usize) {} | +++++++++++++ error: `#[unsafe(no_mangle)]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi.rs:10:1 + --> tests/ui/no_mangle_with_rust_abi.rs:9:1 | LL | pub fn rust_abi_fn_two(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | pub extern "Rust" fn rust_abi_fn_two(arg_one: u32, arg_two: usize) {} | +++++++++++++ error: `#[unsafe(no_mangle)]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi.rs:16:1 + --> tests/ui/no_mangle_with_rust_abi.rs:15:1 | LL | pub unsafe fn rust_abi_fn_three(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | pub unsafe extern "Rust" fn rust_abi_fn_three(arg_one: u32, arg_two: usize) | +++++++++++++ error: `#[unsafe(no_mangle)]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi.rs:22:1 + --> tests/ui/no_mangle_with_rust_abi.rs:21:1 | LL | unsafe fn rust_abi_fn_four(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | unsafe extern "Rust" fn rust_abi_fn_four(arg_one: u32, arg_two: usize) {} | +++++++++++++ error: `#[unsafe(no_mangle)]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi.rs:26:1 + --> tests/ui/no_mangle_with_rust_abi.rs:25:1 | LL | / fn rust_abi_multiline_function_really_long_name_to_overflow_args_to_multiple_lines( LL | | @@ -80,7 +80,7 @@ LL | extern "Rust" fn rust_abi_multiline_function_really_long_name_to_overflow_a | +++++++++++++ error: `#[unsafe(no_mangle)]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi.rs:52:5 + --> tests/ui/no_mangle_with_rust_abi.rs:51:5 | LL | pub(in super::r#fn) fn with_some_fn_around() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/no_mangle_with_rust_abi_2021.rs b/tests/ui/no_mangle_with_rust_abi_2021.rs index 3d5c70cad2f3..e390e9546005 100644 --- a/tests/ui/no_mangle_with_rust_abi_2021.rs +++ b/tests/ui/no_mangle_with_rust_abi_2021.rs @@ -3,7 +3,6 @@ // Edition 2024 requires the use of #[unsafe(no_mangle)] //@no-rustfix: overlapping suggestions -#![allow(unused)] #![warn(clippy::no_mangle_with_rust_abi)] #[no_mangle] diff --git a/tests/ui/no_mangle_with_rust_abi_2021.stderr b/tests/ui/no_mangle_with_rust_abi_2021.stderr index abae8fafbeee..e0d5e90460df 100644 --- a/tests/ui/no_mangle_with_rust_abi_2021.stderr +++ b/tests/ui/no_mangle_with_rust_abi_2021.stderr @@ -1,5 +1,5 @@ error: `#[no_mangle]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi_2021.rs:10:1 + --> tests/ui/no_mangle_with_rust_abi_2021.rs:9:1 | LL | fn rust_abi_fn_one(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | extern "Rust" fn rust_abi_fn_one(arg_one: u32, arg_two: usize) {} | +++++++++++++ error: `#[no_mangle]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi_2021.rs:14:1 + --> tests/ui/no_mangle_with_rust_abi_2021.rs:13:1 | LL | pub fn rust_abi_fn_two(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | pub extern "Rust" fn rust_abi_fn_two(arg_one: u32, arg_two: usize) {} | +++++++++++++ error: `#[no_mangle]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi_2021.rs:20:1 + --> tests/ui/no_mangle_with_rust_abi_2021.rs:19:1 | LL | pub unsafe fn rust_abi_fn_three(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | pub unsafe extern "Rust" fn rust_abi_fn_three(arg_one: u32, arg_two: usize) | +++++++++++++ error: `#[no_mangle]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi_2021.rs:26:1 + --> tests/ui/no_mangle_with_rust_abi_2021.rs:25:1 | LL | unsafe fn rust_abi_fn_four(arg_one: u32, arg_two: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | unsafe extern "Rust" fn rust_abi_fn_four(arg_one: u32, arg_two: usize) {} | +++++++++++++ error: `#[no_mangle]` set on a function with the default (`Rust`) ABI - --> tests/ui/no_mangle_with_rust_abi_2021.rs:30:1 + --> tests/ui/no_mangle_with_rust_abi_2021.rs:29:1 | LL | / fn rust_abi_multiline_function_really_long_name_to_overflow_args_to_multiple_lines( LL | | diff --git a/tests/ui/non_canonical_clone_impl.fixed b/tests/ui/non_canonical_clone_impl.fixed index 3e2ffaf01468..466a1304e72c 100644 --- a/tests/ui/non_canonical_clone_impl.fixed +++ b/tests/ui/non_canonical_clone_impl.fixed @@ -1,5 +1,5 @@ //@aux-build:proc_macro_derive.rs -#![allow(clippy::clone_on_copy, unused)] +#![expect(clippy::clone_on_copy)] #![allow(clippy::assigning_clones)] #![no_main] diff --git a/tests/ui/non_canonical_clone_impl.rs b/tests/ui/non_canonical_clone_impl.rs index abe388320752..5f815b567dfc 100644 --- a/tests/ui/non_canonical_clone_impl.rs +++ b/tests/ui/non_canonical_clone_impl.rs @@ -1,5 +1,5 @@ //@aux-build:proc_macro_derive.rs -#![allow(clippy::clone_on_copy, unused)] +#![expect(clippy::clone_on_copy)] #![allow(clippy::assigning_clones)] #![no_main] diff --git a/tests/ui/non_expressive_names.rs b/tests/ui/non_expressive_names.rs index 3f34dff563d2..1260d009ada0 100644 --- a/tests/ui/non_expressive_names.rs +++ b/tests/ui/non_expressive_names.rs @@ -1,4 +1,5 @@ -#![allow(clippy::println_empty_string, non_snake_case, clippy::let_unit_value)] +#![warn(clippy::just_underscores_and_digits)] +#![expect(non_snake_case)] #[derive(Clone, Debug)] enum MaybeInst { diff --git a/tests/ui/non_expressive_names.stderr b/tests/ui/non_expressive_names.stderr index 11b12d2c5f10..3bd77a730fe7 100644 --- a/tests/ui/non_expressive_names.stderr +++ b/tests/ui/non_expressive_names.stderr @@ -1,5 +1,5 @@ error: consider choosing a more descriptive name - --> tests/ui/non_expressive_names.rs:27:9 + --> tests/ui/non_expressive_names.rs:28:9 | LL | let _1 = 1; | ^^ @@ -8,31 +8,31 @@ LL | let _1 = 1; = help: to override `-D warnings` add `#[allow(clippy::just_underscores_and_digits)]` error: consider choosing a more descriptive name - --> tests/ui/non_expressive_names.rs:29:9 + --> tests/ui/non_expressive_names.rs:30:9 | LL | let ____1 = 1; | ^^^^^ error: consider choosing a more descriptive name - --> tests/ui/non_expressive_names.rs:31:9 + --> tests/ui/non_expressive_names.rs:32:9 | LL | let __1___2 = 12; | ^^^^^^^ error: consider choosing a more descriptive name - --> tests/ui/non_expressive_names.rs:53:13 + --> tests/ui/non_expressive_names.rs:54:13 | LL | let _1 = 1; | ^^ error: consider choosing a more descriptive name - --> tests/ui/non_expressive_names.rs:55:13 + --> tests/ui/non_expressive_names.rs:56:13 | LL | let ____1 = 1; | ^^^^^ error: consider choosing a more descriptive name - --> tests/ui/non_expressive_names.rs:57:13 + --> tests/ui/non_expressive_names.rs:58:13 | LL | let __1___2 = 12; | ^^^^^^^ diff --git a/tests/ui/non_minimal_cfg.fixed b/tests/ui/non_minimal_cfg.fixed index a2b69d0662ee..c3b94bdf53f6 100644 --- a/tests/ui/non_minimal_cfg.fixed +++ b/tests/ui/non_minimal_cfg.fixed @@ -1,5 +1,4 @@ -#![allow(unused)] - +#![warn(clippy::non_minimal_cfg)] #[cfg(windows)] //~^ non_minimal_cfg fn hermit() {} diff --git a/tests/ui/non_minimal_cfg.rs b/tests/ui/non_minimal_cfg.rs index 7178cd189c08..e28d4fd756d5 100644 --- a/tests/ui/non_minimal_cfg.rs +++ b/tests/ui/non_minimal_cfg.rs @@ -1,5 +1,4 @@ -#![allow(unused)] - +#![warn(clippy::non_minimal_cfg)] #[cfg(all(windows))] //~^ non_minimal_cfg fn hermit() {} diff --git a/tests/ui/non_minimal_cfg.stderr b/tests/ui/non_minimal_cfg.stderr index 3bf306dd89c2..cd09972454a4 100644 --- a/tests/ui/non_minimal_cfg.stderr +++ b/tests/ui/non_minimal_cfg.stderr @@ -1,5 +1,5 @@ error: unneeded sub `cfg` when there is only one condition - --> tests/ui/non_minimal_cfg.rs:3:7 + --> tests/ui/non_minimal_cfg.rs:2:7 | LL | #[cfg(all(windows))] | ^^^^^^^^^^^^ help: try: `windows` @@ -8,19 +8,19 @@ LL | #[cfg(all(windows))] = help: to override `-D warnings` add `#[allow(clippy::non_minimal_cfg)]` error: unneeded sub `cfg` when there is only one condition - --> tests/ui/non_minimal_cfg.rs:7:7 + --> tests/ui/non_minimal_cfg.rs:6:7 | LL | #[cfg(any(windows))] | ^^^^^^^^^^^^ help: try: `windows` error: unneeded sub `cfg` when there is only one condition - --> tests/ui/non_minimal_cfg.rs:11:11 + --> tests/ui/non_minimal_cfg.rs:10:11 | LL | #[cfg(all(any(unix), all(not(windows))))] | ^^^^^^^^^ help: try: `unix` error: unneeded sub `cfg` when there is only one condition - --> tests/ui/non_minimal_cfg.rs:11:22 + --> tests/ui/non_minimal_cfg.rs:10:22 | LL | #[cfg(all(any(unix), all(not(windows))))] | ^^^^^^^^^^^^^^^^^ help: try: `not(windows)` From 2c55f1e3083804c2f614be5ac15bb0261dce392f Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 02/11] Attributes cleanup in tests [15/20] --- tests/ui/ptr_offset_by_literal.fixed | 3 +- tests/ui/ptr_offset_by_literal.rs | 3 +- tests/ui/ptr_offset_by_literal.stderr | 24 +++---- tests/ui/ptr_offset_with_cast.fixed | 3 +- tests/ui/ptr_offset_with_cast.rs | 3 +- tests/ui/ptr_offset_with_cast.stderr | 8 +-- tests/ui/pub_use.rs | 1 - tests/ui/pub_use.stderr | 2 +- tests/ui/pub_with_shorthand.fixed | 2 +- tests/ui/pub_with_shorthand.rs | 2 +- tests/ui/pub_without_shorthand.fixed | 2 +- tests/ui/pub_without_shorthand.rs | 2 +- tests/ui/question_mark.fixed | 8 +-- tests/ui/question_mark.rs | 8 +-- tests/ui/question_mark.stderr | 52 +++++++------- tests/ui/question_mark_used.rs | 2 - tests/ui/question_mark_used.stderr | 2 +- tests/ui/range.fixed | 4 +- tests/ui/range.rs | 4 +- tests/ui/range.stderr | 6 +- tests/ui/range_contains.fixed | 12 ++-- tests/ui/range_contains.rs | 12 ++-- tests/ui/range_plus_minus_one.fixed | 2 - tests/ui/range_plus_minus_one.rs | 2 - tests/ui/range_plus_minus_one.stderr | 30 ++++---- tests/ui/range_unfixable.rs | 3 +- tests/ui/range_unfixable.stderr | 2 +- tests/ui/rc_clone_in_vec_init/arc.rs | 2 +- tests/ui/rc_clone_in_vec_init/rc.rs | 2 +- tests/ui/rc_clone_in_vec_init/weak.rs | 2 +- tests/ui/rc_mutex.rs | 2 +- tests/ui/read_line_without_trim.fixed | 1 - tests/ui/read_line_without_trim.rs | 1 - tests/ui/read_line_without_trim.stderr | 28 ++++---- tests/ui/read_zero_byte_vec.rs | 6 +- tests/ui/read_zero_byte_vec.stderr | 30 ++++---- tests/ui/recursive_format_impl.rs | 6 +- tests/ui/redundant_allocation.rs | 3 +- tests/ui/redundant_allocation.stderr | 40 +++++------ tests/ui/redundant_allocation_fixable.fixed | 3 +- tests/ui/redundant_allocation_fixable.rs | 3 +- tests/ui/redundant_allocation_fixable.stderr | 24 +++---- tests/ui/redundant_as_str.fixed | 2 +- tests/ui/redundant_as_str.rs | 2 +- tests/ui/redundant_async_block.fixed | 2 +- tests/ui/redundant_async_block.rs | 2 +- tests/ui/redundant_at_rest_pattern.fixed | 2 +- tests/ui/redundant_at_rest_pattern.rs | 2 +- tests/ui/redundant_clone.fixed | 2 +- tests/ui/redundant_clone.rs | 2 +- tests/ui/redundant_closure_call_fixable.fixed | 3 +- tests/ui/redundant_closure_call_fixable.rs | 3 +- .../ui/redundant_closure_call_fixable.stderr | 42 +++++------ tests/ui/redundant_closure_call_late.rs | 1 - tests/ui/redundant_closure_call_late.stderr | 6 +- tests/ui/redundant_else.fixed | 2 +- tests/ui/redundant_else.rs | 2 +- tests/ui/redundant_field_names.fixed | 2 +- tests/ui/redundant_field_names.rs | 2 +- tests/ui/redundant_guards.fixed | 3 +- tests/ui/redundant_guards.rs | 3 +- tests/ui/redundant_guards.stderr | 60 ++++++++-------- tests/ui/redundant_locals.rs | 2 +- ...edundant_pattern_matching_drop_order.fixed | 8 +-- .../redundant_pattern_matching_drop_order.rs | 8 +-- ...dundant_pattern_matching_drop_order.stderr | 44 ++++++------ ...dundant_pattern_matching_if_let_true.fixed | 2 +- .../redundant_pattern_matching_if_let_true.rs | 2 +- .../redundant_pattern_matching_ipaddr.fixed | 7 +- tests/ui/redundant_pattern_matching_ipaddr.rs | 7 +- .../redundant_pattern_matching_ipaddr.stderr | 40 +++++------ .../redundant_pattern_matching_option.fixed | 11 +-- tests/ui/redundant_pattern_matching_option.rs | 11 +-- .../redundant_pattern_matching_option.stderr | 70 +++++++++---------- .../ui/redundant_pattern_matching_poll.fixed | 9 +-- tests/ui/redundant_pattern_matching_poll.rs | 9 +-- .../ui/redundant_pattern_matching_poll.stderr | 40 +++++------ .../redundant_pattern_matching_result.fixed | 2 +- tests/ui/redundant_pattern_matching_result.rs | 2 +- tests/ui/redundant_pub_crate.fixed | 3 - tests/ui/redundant_pub_crate.rs | 3 - tests/ui/redundant_pub_crate.stderr | 36 +++++----- tests/ui/redundant_slicing.fixed | 2 +- tests/ui/redundant_slicing.rs | 2 +- tests/ui/redundant_static_lifetimes.fixed | 3 +- tests/ui/redundant_static_lifetimes.rs | 3 +- tests/ui/redundant_static_lifetimes.stderr | 36 +++++----- tests/ui/redundant_test_prefix.fixed | 1 - tests/ui/redundant_test_prefix.rs | 1 - tests/ui/redundant_test_prefix.stderr | 38 +++++----- tests/ui/redundant_test_prefix_noautofix.rs | 1 - .../ui/redundant_test_prefix_noautofix.stderr | 66 ++++++++--------- tests/ui/redundant_type_annotations.rs | 1 - tests/ui/redundant_type_annotations.stderr | 34 ++++----- 94 files changed, 472 insertions(+), 534 deletions(-) diff --git a/tests/ui/ptr_offset_by_literal.fixed b/tests/ui/ptr_offset_by_literal.fixed index 174616b1e151..035e76cdaf29 100644 --- a/tests/ui/ptr_offset_by_literal.fixed +++ b/tests/ui/ptr_offset_by_literal.fixed @@ -1,5 +1,6 @@ #![warn(clippy::ptr_offset_by_literal)] -#![allow(clippy::inconsistent_digit_grouping, clippy::byte_char_slices)] +#![allow(clippy::inconsistent_digit_grouping)] +#![expect(clippy::byte_char_slices)] fn main() { let arr = [b'a', b'b', b'c']; diff --git a/tests/ui/ptr_offset_by_literal.rs b/tests/ui/ptr_offset_by_literal.rs index d3202cbff982..6f6a5e52bf8a 100644 --- a/tests/ui/ptr_offset_by_literal.rs +++ b/tests/ui/ptr_offset_by_literal.rs @@ -1,5 +1,6 @@ #![warn(clippy::ptr_offset_by_literal)] -#![allow(clippy::inconsistent_digit_grouping, clippy::byte_char_slices)] +#![allow(clippy::inconsistent_digit_grouping)] +#![expect(clippy::byte_char_slices)] fn main() { let arr = [b'a', b'b', b'c']; diff --git a/tests/ui/ptr_offset_by_literal.stderr b/tests/ui/ptr_offset_by_literal.stderr index f85fef87d55f..93efaa29ab1e 100644 --- a/tests/ui/ptr_offset_by_literal.stderr +++ b/tests/ui/ptr_offset_by_literal.stderr @@ -1,5 +1,5 @@ error: use of `offset` with zero - --> tests/ui/ptr_offset_by_literal.rs:12:17 + --> tests/ui/ptr_offset_by_literal.rs:13:17 | LL | let _ = ptr.offset(0); | ^^^---------- @@ -10,7 +10,7 @@ LL | let _ = ptr.offset(0); = help: to override `-D warnings` add `#[allow(clippy::ptr_offset_by_literal)]` error: use of `offset` with zero - --> tests/ui/ptr_offset_by_literal.rs:14:17 + --> tests/ui/ptr_offset_by_literal.rs:15:17 | LL | let _ = ptr.offset(-0); | ^^^----------- @@ -18,7 +18,7 @@ LL | let _ = ptr.offset(-0); | help: remove the call to `offset` error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:17:17 + --> tests/ui/ptr_offset_by_literal.rs:18:17 | LL | let _ = ptr.offset(5); | ^^^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL + let _ = ptr.add(5); | error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:19:17 + --> tests/ui/ptr_offset_by_literal.rs:20:17 | LL | let _ = ptr.offset(-5); | ^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL + let _ = ptr.sub(5); | error: use of `wrapping_offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:25:17 + --> tests/ui/ptr_offset_by_literal.rs:26:17 | LL | let _ = ptr.wrapping_offset(5isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +54,7 @@ LL + let _ = ptr.wrapping_add(5); | error: use of `wrapping_offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:27:17 + --> tests/ui/ptr_offset_by_literal.rs:28:17 | LL | let _ = ptr.wrapping_offset(-5isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -66,7 +66,7 @@ LL + let _ = ptr.wrapping_sub(5); | error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:30:17 + --> tests/ui/ptr_offset_by_literal.rs:31:17 | LL | let _ = ptr.offset(-(5)); | ^^^^^^^^^^^^^^^^ @@ -78,7 +78,7 @@ LL + let _ = ptr.sub(5); | error: use of `wrapping_offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:32:17 + --> tests/ui/ptr_offset_by_literal.rs:33:17 | LL | let _ = ptr.wrapping_offset(-(5)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL + let _ = ptr.wrapping_sub(5); | error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:36:17 + --> tests/ui/ptr_offset_by_literal.rs:37:17 | LL | let _ = ptr.offset(2_147_483_647isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -102,7 +102,7 @@ LL + let _ = ptr.add(2_147_483_647); | error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:38:17 + --> tests/ui/ptr_offset_by_literal.rs:39:17 | LL | let _ = ptr.offset(-2_147_483_648isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL + let _ = ptr.sub(2_147_483_648); | error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:41:17 + --> tests/ui/ptr_offset_by_literal.rs:42:17 | LL | let _ = ptr.offset(5_0__isize); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -126,7 +126,7 @@ LL + let _ = ptr.add(5_0); | error: use of `offset` with a literal - --> tests/ui/ptr_offset_by_literal.rs:43:17 + --> tests/ui/ptr_offset_by_literal.rs:44:17 | LL | let _ = ptr.offset(-5_0__isize); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/ptr_offset_with_cast.fixed b/tests/ui/ptr_offset_with_cast.fixed index 42d1abeaa05a..11738f051f62 100644 --- a/tests/ui/ptr_offset_with_cast.fixed +++ b/tests/ui/ptr_offset_with_cast.fixed @@ -1,4 +1,5 @@ -#![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)] +#![warn(clippy::ptr_offset_with_cast)] +#![expect(clippy::needless_borrow, clippy::unnecessary_cast, clippy::useless_vec)] fn main() { let vec = vec![b'a', b'b', b'c']; diff --git a/tests/ui/ptr_offset_with_cast.rs b/tests/ui/ptr_offset_with_cast.rs index 6d06a6af1fa2..6512157dfd06 100644 --- a/tests/ui/ptr_offset_with_cast.rs +++ b/tests/ui/ptr_offset_with_cast.rs @@ -1,4 +1,5 @@ -#![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)] +#![warn(clippy::ptr_offset_with_cast)] +#![expect(clippy::needless_borrow, clippy::unnecessary_cast, clippy::useless_vec)] fn main() { let vec = vec![b'a', b'b', b'c']; diff --git a/tests/ui/ptr_offset_with_cast.stderr b/tests/ui/ptr_offset_with_cast.stderr index 022b3286c93b..7fd038d8adf3 100644 --- a/tests/ui/ptr_offset_with_cast.stderr +++ b/tests/ui/ptr_offset_with_cast.stderr @@ -1,5 +1,5 @@ error: use of `offset` with a `usize` casted to an `isize` - --> tests/ui/ptr_offset_with_cast.rs:12:17 + --> tests/ui/ptr_offset_with_cast.rs:13:17 | LL | let _ = ptr.offset(offset_usize as isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _ = ptr.add(offset_usize); | error: use of `wrapping_offset` with a `usize` casted to an `isize` - --> tests/ui/ptr_offset_with_cast.rs:17:17 + --> tests/ui/ptr_offset_with_cast.rs:18:17 | LL | let _ = ptr.wrapping_offset(offset_usize as isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = ptr.wrapping_add(offset_usize); | error: use of `offset` with a `usize` casted to an `isize` - --> tests/ui/ptr_offset_with_cast.rs:25:17 + --> tests/ui/ptr_offset_with_cast.rs:26:17 | LL | let _ = (&ptr).offset(offset_usize as isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + let _ = (&ptr).add(offset_usize); | error: use of `wrapping_offset` with a `usize` casted to an `isize` - --> tests/ui/ptr_offset_with_cast.rs:27:17 + --> tests/ui/ptr_offset_with_cast.rs:28:17 | LL | let _ = (&ptr).wrapping_offset(offset_usize as isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pub_use.rs b/tests/ui/pub_use.rs index be4d1b2a964b..2e8877418a44 100644 --- a/tests/ui/pub_use.rs +++ b/tests/ui/pub_use.rs @@ -1,5 +1,4 @@ #![warn(clippy::pub_use)] -#![allow(unused_imports)] #![no_main] pub mod outer { diff --git a/tests/ui/pub_use.stderr b/tests/ui/pub_use.stderr index e332a864c529..2abee7b98d39 100644 --- a/tests/ui/pub_use.stderr +++ b/tests/ui/pub_use.stderr @@ -1,5 +1,5 @@ error: using `pub use` - --> tests/ui/pub_use.rs:10:5 + --> tests/ui/pub_use.rs:9:5 | LL | pub use inner::Test; | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pub_with_shorthand.fixed b/tests/ui/pub_with_shorthand.fixed index 4036de8bbc0a..308e9f6c99a7 100644 --- a/tests/ui/pub_with_shorthand.fixed +++ b/tests/ui/pub_with_shorthand.fixed @@ -1,8 +1,8 @@ //@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] -#![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_with_shorthand)] +#![expect(clippy::needless_pub_self)] #![no_main] #![rustfmt::skip] // rustfmt will remove `in`, understandable // but very annoying for our purposes! diff --git a/tests/ui/pub_with_shorthand.rs b/tests/ui/pub_with_shorthand.rs index fac4ba990447..74db31d649c3 100644 --- a/tests/ui/pub_with_shorthand.rs +++ b/tests/ui/pub_with_shorthand.rs @@ -1,8 +1,8 @@ //@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] -#![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_with_shorthand)] +#![expect(clippy::needless_pub_self)] #![no_main] #![rustfmt::skip] // rustfmt will remove `in`, understandable // but very annoying for our purposes! diff --git a/tests/ui/pub_without_shorthand.fixed b/tests/ui/pub_without_shorthand.fixed index fbe3326400cb..ff3a1b76e566 100644 --- a/tests/ui/pub_without_shorthand.fixed +++ b/tests/ui/pub_without_shorthand.fixed @@ -1,8 +1,8 @@ //@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] -#![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_without_shorthand)] +#![expect(clippy::needless_pub_self)] #![no_main] #![rustfmt::skip] // rustfmt will remove `in`, understandable // but very annoying for our purposes! diff --git a/tests/ui/pub_without_shorthand.rs b/tests/ui/pub_without_shorthand.rs index fb756096c9d9..3536b488a220 100644 --- a/tests/ui/pub_without_shorthand.rs +++ b/tests/ui/pub_without_shorthand.rs @@ -1,8 +1,8 @@ //@aux-build:proc_macros.rs #![feature(custom_inner_attributes)] -#![allow(clippy::needless_pub_self, unused)] #![warn(clippy::pub_without_shorthand)] +#![expect(clippy::needless_pub_self)] #![no_main] #![rustfmt::skip] // rustfmt will remove `in`, understandable // but very annoying for our purposes! diff --git a/tests/ui/question_mark.fixed b/tests/ui/question_mark.fixed index 786431bc1f53..32effaf99ddd 100644 --- a/tests/ui/question_mark.fixed +++ b/tests/ui/question_mark.fixed @@ -1,9 +1,10 @@ #![feature(try_blocks)] +#![warn(clippy::question_mark)] #![allow( - clippy::unnecessary_wraps, - clippy::no_effect, clippy::needless_return, - clippy::toplevel_ref_arg + clippy::no_effect, + clippy::toplevel_ref_arg, + clippy::unnecessary_wraps )] use std::sync::MutexGuard; @@ -404,7 +405,6 @@ fn issue_13417_mut(foo: &mut StructWithOptionString) -> Option { } #[allow(clippy::disallowed_names)] -#[allow(unused)] fn issue_13417_weirder(foo: &mut StructWithOptionString, mut bar: Option) -> Option<()> { let x @ y = foo.opt_x.as_ref()?; //~^^^ question_mark diff --git a/tests/ui/question_mark.rs b/tests/ui/question_mark.rs index 7cbcc604eb59..18e8404dea22 100644 --- a/tests/ui/question_mark.rs +++ b/tests/ui/question_mark.rs @@ -1,9 +1,10 @@ #![feature(try_blocks)] +#![warn(clippy::question_mark)] #![allow( - clippy::unnecessary_wraps, - clippy::no_effect, clippy::needless_return, - clippy::toplevel_ref_arg + clippy::no_effect, + clippy::toplevel_ref_arg, + clippy::unnecessary_wraps )] use std::sync::MutexGuard; @@ -492,7 +493,6 @@ fn issue_13417_mut(foo: &mut StructWithOptionString) -> Option { } #[allow(clippy::disallowed_names)] -#[allow(unused)] fn issue_13417_weirder(foo: &mut StructWithOptionString, mut bar: Option) -> Option<()> { let Some(ref x @ ref y) = foo.opt_x else { return None; diff --git a/tests/ui/question_mark.stderr b/tests/ui/question_mark.stderr index 74fb2c45a254..abb4c9531754 100644 --- a/tests/ui/question_mark.stderr +++ b/tests/ui/question_mark.stderr @@ -1,5 +1,5 @@ error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:12:5 + --> tests/ui/question_mark.rs:13:5 | LL | / if a.is_none() { LL | | @@ -11,7 +11,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::question_mark)]` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:58:9 + --> tests/ui/question_mark.rs:59:9 | LL | / if (self.opt).is_none() { LL | | @@ -20,7 +20,7 @@ LL | | } | |_________^ help: replace it with: `(self.opt)?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:63:9 + --> tests/ui/question_mark.rs:64:9 | LL | / if self.opt.is_none() { LL | | @@ -29,7 +29,7 @@ LL | | } | |_________^ help: replace it with: `self.opt?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:68:17 + --> tests/ui/question_mark.rs:69:17 | LL | let _ = if self.opt.is_none() { | _________________^ @@ -41,7 +41,7 @@ LL | | }; | |_________^ help: replace it with: `Some(self.opt?)` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:75:17 + --> tests/ui/question_mark.rs:76:17 | LL | let _ = if let Some(x) = self.opt { | _________________^ @@ -53,7 +53,7 @@ LL | | }; | |_________^ help: replace it with: `self.opt?` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:93:9 + --> tests/ui/question_mark.rs:94:9 | LL | / if self.opt.is_none() { LL | | @@ -62,7 +62,7 @@ LL | | } | |_________^ help: replace it with: `self.opt.as_ref()?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:102:9 + --> tests/ui/question_mark.rs:103:9 | LL | / if self.opt.is_none() { LL | | @@ -71,7 +71,7 @@ LL | | } | |_________^ help: replace it with: `self.opt.as_ref()?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:111:9 + --> tests/ui/question_mark.rs:112:9 | LL | / if self.opt.is_none() { LL | | @@ -80,7 +80,7 @@ LL | | } | |_________^ help: replace it with: `self.opt.as_ref()?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:119:26 + --> tests/ui/question_mark.rs:120:26 | LL | let v: &Vec<_> = if let Some(ref v) = self.opt { | __________________________^ @@ -92,7 +92,7 @@ LL | | }; | |_________^ help: replace it with: `self.opt.as_ref()?` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:130:17 + --> tests/ui/question_mark.rs:131:17 | LL | let v = if let Some(v) = self.opt { | _________________^ @@ -104,7 +104,7 @@ LL | | }; | |_________^ help: replace it with: `self.opt?` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:152:5 + --> tests/ui/question_mark.rs:153:5 | LL | / if f().is_none() { LL | | @@ -113,7 +113,7 @@ LL | | } | |_____^ help: replace it with: `f()?;` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:157:16 + --> tests/ui/question_mark.rs:158:16 | LL | let _val = match f() { | ________________^ @@ -124,7 +124,7 @@ LL | | }; | |_____^ help: try instead: `f()?` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:163:19 + --> tests/ui/question_mark.rs:164:19 | LL | let s: &str = match &Some(String::new()) { | ___________________^ @@ -135,7 +135,7 @@ LL | | }; | |_____^ help: try instead: `&Some(String::new())?` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:169:5 + --> tests/ui/question_mark.rs:170:5 | LL | / match f() { LL | | @@ -145,7 +145,7 @@ LL | | }; | |_____^ help: try instead: `f()?` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:175:5 + --> tests/ui/question_mark.rs:176:5 | LL | / match opt_none!() { LL | | @@ -155,7 +155,7 @@ LL | | }; | |_____^ help: try instead: `opt_none!()?` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:186:5 + --> tests/ui/question_mark.rs:187:5 | LL | / match f() { LL | | @@ -176,13 +176,13 @@ LL ~ }; | error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:203:13 + --> tests/ui/question_mark.rs:204:13 | LL | let _ = if let Ok(x) = x { x } else { return x }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x?` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:206:5 + --> tests/ui/question_mark.rs:207:5 | LL | / if x.is_err() { LL | | @@ -191,7 +191,7 @@ LL | | } | |_____^ help: replace it with: `x?;` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:211:16 + --> tests/ui/question_mark.rs:212:16 | LL | let _val = match func_returning_result() { | ________________^ @@ -202,7 +202,7 @@ LL | | }; | |_____^ help: try instead: `func_returning_result()?` error: this `match` expression can be replaced with `?` - --> tests/ui/question_mark.rs:217:5 + --> tests/ui/question_mark.rs:218:5 | LL | / match func_returning_result() { LL | | @@ -212,7 +212,7 @@ LL | | }; | |_____^ help: try instead: `func_returning_result()?` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:309:5 + --> tests/ui/question_mark.rs:310:5 | LL | / if let Err(err) = func_returning_result() { LL | | @@ -221,7 +221,7 @@ LL | | } | |_____^ help: replace it with: `func_returning_result()?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:317:5 + --> tests/ui/question_mark.rs:318:5 | LL | / if let Err(err) = func_returning_result() { LL | | @@ -230,7 +230,7 @@ LL | | } | |_____^ help: replace it with: `func_returning_result()?;` error: this block may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:400:13 + --> tests/ui/question_mark.rs:401:13 | LL | / if a.is_none() { LL | | @@ -240,7 +240,7 @@ LL | | } | |_____________^ help: replace it with: `a?;` error: this `let...else` may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:461:5 + --> tests/ui/question_mark.rs:462:5 | LL | / let Some(v) = bar.foo.owned.clone() else { LL | | return None; @@ -248,7 +248,7 @@ LL | | }; | |______^ help: replace it with: `let v = bar.foo.owned.clone()?;` error: this `let...else` may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:476:5 + --> tests/ui/question_mark.rs:477:5 | LL | / let Some(ref x) = foo.opt_x else { LL | | return None; @@ -256,7 +256,7 @@ LL | | }; | |______^ help: replace it with: `let x = foo.opt_x.as_ref()?;` error: this `let...else` may be rewritten with the `?` operator - --> tests/ui/question_mark.rs:486:5 + --> tests/ui/question_mark.rs:487:5 | LL | / let Some(ref mut x) = foo.opt_x else { LL | | return None; diff --git a/tests/ui/question_mark_used.rs b/tests/ui/question_mark_used.rs index 9e204d1e9f3c..978c4d7bf171 100644 --- a/tests/ui/question_mark_used.rs +++ b/tests/ui/question_mark_used.rs @@ -1,6 +1,4 @@ // non rustfixable -#![allow(unreachable_code)] -#![allow(dead_code)] #![warn(clippy::question_mark_used)] fn other_function() -> Option { diff --git a/tests/ui/question_mark_used.stderr b/tests/ui/question_mark_used.stderr index 82f0d3250407..1a256ab2e45a 100644 --- a/tests/ui/question_mark_used.stderr +++ b/tests/ui/question_mark_used.stderr @@ -1,5 +1,5 @@ error: the `?` operator was used - --> tests/ui/question_mark_used.rs:11:5 + --> tests/ui/question_mark_used.rs:9:5 | LL | other_function()?; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/range.fixed b/tests/ui/range.fixed index c8e654600045..80a74af3b031 100644 --- a/tests/ui/range.fixed +++ b/tests/ui/range.fixed @@ -1,5 +1,4 @@ -#![allow(clippy::useless_vec)] -#[warn(clippy::range_zip_with_len)] +#![warn(clippy::range_zip_with_len)] fn main() { let v1: Vec = vec![1, 2, 3]; let v2: Vec = vec![4, 5]; @@ -21,7 +20,6 @@ fn main() { let _y = v1.iter().zip(0..v2.len()); // No error } -#[allow(unused)] fn no_panic_with_fake_range_types() { struct Range { foo: i32, diff --git a/tests/ui/range.rs b/tests/ui/range.rs index 352d517eabdd..c948a6ec5c73 100644 --- a/tests/ui/range.rs +++ b/tests/ui/range.rs @@ -1,5 +1,4 @@ -#![allow(clippy::useless_vec)] -#[warn(clippy::range_zip_with_len)] +#![warn(clippy::range_zip_with_len)] fn main() { let v1: Vec = vec![1, 2, 3]; let v2: Vec = vec![4, 5]; @@ -21,7 +20,6 @@ fn main() { let _y = v1.iter().zip(0..v2.len()); // No error } -#[allow(unused)] fn no_panic_with_fake_range_types() { struct Range { foo: i32, diff --git a/tests/ui/range.stderr b/tests/ui/range.stderr index e3b2e3c90058..34b0f7129c1d 100644 --- a/tests/ui/range.stderr +++ b/tests/ui/range.stderr @@ -1,5 +1,5 @@ error: using `.zip()` with a range and `.len()` - --> tests/ui/range.rs:6:14 + --> tests/ui/range.rs:5:14 | LL | let _x = v1.iter().zip(0..v1.len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL + let _x = v1.iter().enumerate(); | error: using `.zip()` with a range and `.len()` - --> tests/ui/range.rs:10:19 + --> tests/ui/range.rs:9:19 | LL | for (e, i) in v1.iter().zip(0..v1.len()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL + for (i, e) in v1.iter().enumerate() { | error: using `.zip()` with a range and `.len()` - --> tests/ui/range.rs:16:5 + --> tests/ui/range.rs:15:5 | LL | v1.iter().zip(0..v1.len()).for_each(|(e, i)| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/range_contains.fixed b/tests/ui/range_contains.fixed index 859f12d79d48..b76ad74d1dbe 100644 --- a/tests/ui/range_contains.fixed +++ b/tests/ui/range_contains.fixed @@ -1,10 +1,10 @@ #![warn(clippy::manual_range_contains)] -#![allow(unused)] -#![allow(clippy::no_effect)] -#![allow(clippy::short_circuit_statement)] -#![allow(clippy::unnecessary_operation)] -#![allow(clippy::impossible_comparisons)] -#![allow(clippy::redundant_comparisons)] +#![expect(clippy::impossible_comparisons, clippy::no_effect)] +#![allow( + clippy::redundant_comparisons, + clippy::short_circuit_statement, + clippy::unnecessary_operation +)] fn main() { let x = 9_i32; diff --git a/tests/ui/range_contains.rs b/tests/ui/range_contains.rs index b39767a85034..dc1ad9a8242a 100644 --- a/tests/ui/range_contains.rs +++ b/tests/ui/range_contains.rs @@ -1,10 +1,10 @@ #![warn(clippy::manual_range_contains)] -#![allow(unused)] -#![allow(clippy::no_effect)] -#![allow(clippy::short_circuit_statement)] -#![allow(clippy::unnecessary_operation)] -#![allow(clippy::impossible_comparisons)] -#![allow(clippy::redundant_comparisons)] +#![expect(clippy::impossible_comparisons, clippy::no_effect)] +#![allow( + clippy::redundant_comparisons, + clippy::short_circuit_statement, + clippy::unnecessary_operation +)] fn main() { let x = 9_i32; diff --git a/tests/ui/range_plus_minus_one.fixed b/tests/ui/range_plus_minus_one.fixed index e07a0e07368b..a93561f6a35d 100644 --- a/tests/ui/range_plus_minus_one.fixed +++ b/tests/ui/range_plus_minus_one.fixed @@ -1,6 +1,4 @@ #![warn(clippy::range_minus_one, clippy::range_plus_one)] -#![allow(unused_parens)] -#![allow(clippy::iter_with_drain)] use std::ops::{Index, IndexMut, Range, RangeBounds, RangeInclusive}; diff --git a/tests/ui/range_plus_minus_one.rs b/tests/ui/range_plus_minus_one.rs index 3e6e4f629a51..b647233a9415 100644 --- a/tests/ui/range_plus_minus_one.rs +++ b/tests/ui/range_plus_minus_one.rs @@ -1,6 +1,4 @@ #![warn(clippy::range_minus_one, clippy::range_plus_one)] -#![allow(unused_parens)] -#![allow(clippy::iter_with_drain)] use std::ops::{Index, IndexMut, Range, RangeBounds, RangeInclusive}; diff --git a/tests/ui/range_plus_minus_one.stderr b/tests/ui/range_plus_minus_one.stderr index 79c482aeaa6b..42d07f3d79e6 100644 --- a/tests/ui/range_plus_minus_one.stderr +++ b/tests/ui/range_plus_minus_one.stderr @@ -1,5 +1,5 @@ error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:31:14 + --> tests/ui/range_plus_minus_one.rs:29:14 | LL | for _ in 0..3 + 1 {} | ^^^^^^^^ help: use: `0..=3` @@ -8,79 +8,79 @@ LL | for _ in 0..3 + 1 {} = help: to override `-D warnings` add `#[allow(clippy::range_plus_one)]` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:35:14 + --> tests/ui/range_plus_minus_one.rs:33:14 | LL | for _ in 0..1 + 5 {} | ^^^^^^^^ help: use: `0..=5` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:39:14 + --> tests/ui/range_plus_minus_one.rs:37:14 | LL | for _ in 1..1 + 1 {} | ^^^^^^^^ help: use: `1..=1` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:46:14 + --> tests/ui/range_plus_minus_one.rs:44:14 | LL | for _ in 0..(1 + f()) {} | ^^^^^^^^^^^^ help: use: `0..=f()` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:60:14 + --> tests/ui/range_plus_minus_one.rs:58:14 | LL | for _ in 1..ONE + ONE {} | ^^^^^^^^^^^^ help: use: `1..=ONE` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:70:6 + --> tests/ui/range_plus_minus_one.rs:68:6 | LL | (1..10 + 1).for_each(|_| {}); | ^^^^^^^^^ help: use: `1..=10` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:75:6 + --> tests/ui/range_plus_minus_one.rs:73:6 | LL | (1..10 + 1).into_iter().for_each(|_| {}); | ^^^^^^^^^ help: use: `1..=10` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:80:18 + --> tests/ui/range_plus_minus_one.rs:78:18 | LL | let _ = (1..10 + 1).start_bound(); | ^^^^^^^^^ help: use: `1..=10` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:86:16 + --> tests/ui/range_plus_minus_one.rs:84:16 | LL | let _ = &a[1..1 + 1]; | ^^^^^^^^ help: use: `1..=1` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:90:15 + --> tests/ui/range_plus_minus_one.rs:88:15 | LL | vec.drain(2..3 + 1); | ^^^^^^^^ help: use: `2..=3` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:94:14 + --> tests/ui/range_plus_minus_one.rs:92:14 | LL | take_arg(10..20 + 1); | ^^^^^^^^^^ help: use: `10..=20` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:98:16 + --> tests/ui/range_plus_minus_one.rs:96:16 | LL | take_arg({ 10..20 + 1 }); | ^^^^^^^^^^ help: use: `10..=20` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:112:7 + --> tests/ui/range_plus_minus_one.rs:110:7 | LL | a[0..2 + 1][0] = 1; | ^^^^^^^^ help: use: `0..=2` error: an exclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:180:6 + --> tests/ui/range_plus_minus_one.rs:178:6 | LL | (1..=n - 1).sum() | ^^^^^^^^^ help: use: `1..n` @@ -89,7 +89,7 @@ LL | (1..=n - 1).sum() = help: to override `-D warnings` add `#[allow(clippy::range_minus_one)]` error: an inclusive range would be more readable - --> tests/ui/range_plus_minus_one.rs:192:14 + --> tests/ui/range_plus_minus_one.rs:190:14 | LL | for _ in test!(x)..test!(x) + 1 { | ^^^^^^^^^^^^^^^^^^^^^^ help: use: `test!(x)..=test!(x)` diff --git a/tests/ui/range_unfixable.rs b/tests/ui/range_unfixable.rs index 259be23fa1e5..6ecd0739fb42 100644 --- a/tests/ui/range_unfixable.rs +++ b/tests/ui/range_unfixable.rs @@ -1,6 +1,5 @@ //@no-rustfix -#![allow(clippy::useless_vec)] -#[warn(clippy::range_zip_with_len)] +#![warn(clippy::range_zip_with_len)] fn main() { let v1: Vec = vec![1, 2, 3]; let v2: Vec = vec![4, 5]; diff --git a/tests/ui/range_unfixable.stderr b/tests/ui/range_unfixable.stderr index 3ddb0c2a991b..14f183d96b28 100644 --- a/tests/ui/range_unfixable.stderr +++ b/tests/ui/range_unfixable.stderr @@ -1,5 +1,5 @@ error: using `.zip()` with a range and `.len()` - --> tests/ui/range_unfixable.rs:10:5 + --> tests/ui/range_unfixable.rs:9:5 | LL | v1.iter().zip(0..v1.len()).filter(|(_, i)| *i < 2).for_each(|(e, i)| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rc_clone_in_vec_init/arc.rs b/tests/ui/rc_clone_in_vec_init/arc.rs index ad5d131f34bc..c261795375d7 100644 --- a/tests/ui/rc_clone_in_vec_init/arc.rs +++ b/tests/ui/rc_clone_in_vec_init/arc.rs @@ -1,6 +1,6 @@ //@no-rustfix: overlapping suggestions #![warn(clippy::rc_clone_in_vec_init)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] use std::sync::{Arc, Mutex}; fn main() {} diff --git a/tests/ui/rc_clone_in_vec_init/rc.rs b/tests/ui/rc_clone_in_vec_init/rc.rs index d5af17c29e1d..cc1a107a853a 100644 --- a/tests/ui/rc_clone_in_vec_init/rc.rs +++ b/tests/ui/rc_clone_in_vec_init/rc.rs @@ -1,6 +1,6 @@ //@no-rustfix: overlapping suggestions #![warn(clippy::rc_clone_in_vec_init)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] use std::rc::Rc; use std::sync::Mutex; diff --git a/tests/ui/rc_clone_in_vec_init/weak.rs b/tests/ui/rc_clone_in_vec_init/weak.rs index add09b6ba859..f0ae7431375f 100644 --- a/tests/ui/rc_clone_in_vec_init/weak.rs +++ b/tests/ui/rc_clone_in_vec_init/weak.rs @@ -1,6 +1,6 @@ //@no-rustfix: overlapping suggestions #![warn(clippy::rc_clone_in_vec_init)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] use std::rc::{Rc, Weak as UnSyncWeak}; use std::sync::{Arc, Mutex, Weak as SyncWeak}; diff --git a/tests/ui/rc_mutex.rs b/tests/ui/rc_mutex.rs index c8700e13b11e..43f6fae300d2 100644 --- a/tests/ui/rc_mutex.rs +++ b/tests/ui/rc_mutex.rs @@ -1,5 +1,5 @@ #![warn(clippy::rc_mutex)] -#![allow(unused, clippy::disallowed_names)] +#![expect(clippy::disallowed_names)] use std::rc::Rc; use std::sync::Mutex; diff --git a/tests/ui/read_line_without_trim.fixed b/tests/ui/read_line_without_trim.fixed index e7f208e78d20..bbb5d98f4c9b 100644 --- a/tests/ui/read_line_without_trim.fixed +++ b/tests/ui/read_line_without_trim.fixed @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::read_line_without_trim)] fn main() { diff --git a/tests/ui/read_line_without_trim.rs b/tests/ui/read_line_without_trim.rs index 6664278b5a87..dba325fd0849 100644 --- a/tests/ui/read_line_without_trim.rs +++ b/tests/ui/read_line_without_trim.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::read_line_without_trim)] fn main() { diff --git a/tests/ui/read_line_without_trim.stderr b/tests/ui/read_line_without_trim.stderr index 5e5618111432..55a19b06e8b6 100644 --- a/tests/ui/read_line_without_trim.stderr +++ b/tests/ui/read_line_without_trim.stderr @@ -1,5 +1,5 @@ error: calling `.parse()` on a string without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:12:25 + --> tests/ui/read_line_without_trim.rs:11:25 | LL | let _x: i32 = input.parse().unwrap(); | ----- ^^^^^^^ @@ -7,7 +7,7 @@ LL | let _x: i32 = input.parse().unwrap(); | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail - --> tests/ui/read_line_without_trim.rs:11:5 + --> tests/ui/read_line_without_trim.rs:10:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | std::io::stdin().read_line(&mut input).unwrap(); = help: to override `-D warnings` add `#[allow(clippy::read_line_without_trim)]` error: calling `.parse()` on a string without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:17:20 + --> tests/ui/read_line_without_trim.rs:16:20 | LL | let _x = input.parse::().unwrap(); | ----- ^^^^^^^^^^^^^^ @@ -23,13 +23,13 @@ LL | let _x = input.parse::().unwrap(); | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail - --> tests/ui/read_line_without_trim.rs:16:5 + --> tests/ui/read_line_without_trim.rs:15:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: calling `.parse()` on a string without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:22:20 + --> tests/ui/read_line_without_trim.rs:21:20 | LL | let _x = input.parse::().unwrap(); | ----- ^^^^^^^^^^^^^^ @@ -37,13 +37,13 @@ LL | let _x = input.parse::().unwrap(); | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail - --> tests/ui/read_line_without_trim.rs:21:5 + --> tests/ui/read_line_without_trim.rs:20:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: calling `.parse()` on a string without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:27:20 + --> tests/ui/read_line_without_trim.rs:26:20 | LL | let _x = input.parse::().unwrap(); | ----- ^^^^^^^^^^^^^^ @@ -51,13 +51,13 @@ LL | let _x = input.parse::().unwrap(); | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail - --> tests/ui/read_line_without_trim.rs:26:5 + --> tests/ui/read_line_without_trim.rs:25:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: calling `.parse()` on a string without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:32:20 + --> tests/ui/read_line_without_trim.rs:31:20 | LL | let _x = input.parse::().unwrap(); | ----- ^^^^^^^^^^^^^^^ @@ -65,13 +65,13 @@ LL | let _x = input.parse::().unwrap(); | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail - --> tests/ui/read_line_without_trim.rs:31:5 + --> tests/ui/read_line_without_trim.rs:30:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: comparing a string literal without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:43:8 + --> tests/ui/read_line_without_trim.rs:42:8 | LL | if input == "foo" { | -----^^^^^^^^^ @@ -79,13 +79,13 @@ LL | if input == "foo" { | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the comparison to always fail - --> tests/ui/read_line_without_trim.rs:42:5 + --> tests/ui/read_line_without_trim.rs:41:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: checking the end of a string without trimming the trailing newline character - --> tests/ui/read_line_without_trim.rs:50:8 + --> tests/ui/read_line_without_trim.rs:49:8 | LL | if input.ends_with("foo") { | -----^^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ LL | if input.ends_with("foo") { | help: try: `input.trim_end()` | note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the parsing to always fail - --> tests/ui/read_line_without_trim.rs:49:5 + --> tests/ui/read_line_without_trim.rs:48:5 | LL | std::io::stdin().read_line(&mut input).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/read_zero_byte_vec.rs b/tests/ui/read_zero_byte_vec.rs index 720276cb5548..36d0c9a68488 100644 --- a/tests/ui/read_zero_byte_vec.rs +++ b/tests/ui/read_zero_byte_vec.rs @@ -1,9 +1,5 @@ #![warn(clippy::read_zero_byte_vec)] -#![allow( - clippy::unused_io_amount, - clippy::needless_pass_by_ref_mut, - clippy::slow_vector_initialization -)] +#![expect(clippy::slow_vector_initialization, clippy::unused_io_amount)] use std::fs::File; use std::io; use std::io::prelude::*; diff --git a/tests/ui/read_zero_byte_vec.stderr b/tests/ui/read_zero_byte_vec.stderr index 8dd74592e4c1..4e5ac17a9c47 100644 --- a/tests/ui/read_zero_byte_vec.stderr +++ b/tests/ui/read_zero_byte_vec.stderr @@ -1,5 +1,5 @@ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:22:5 + --> tests/ui/read_zero_byte_vec.rs:18:5 | LL | f.read_exact(&mut data).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL ~ f.read_exact(&mut data).unwrap(); | error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:28:5 + --> tests/ui/read_zero_byte_vec.rs:24:5 | LL | f.read_exact(&mut data2)?; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,61 +25,61 @@ LL ~ f.read_exact(&mut data2)?; | error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:33:5 + --> tests/ui/read_zero_byte_vec.rs:29:5 | LL | f.read_exact(&mut data3)?; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:38:13 + --> tests/ui/read_zero_byte_vec.rs:34:13 | LL | let _ = f.read(&mut data4)?; | ^^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:44:9 + --> tests/ui/read_zero_byte_vec.rs:40:9 | LL | f.read(&mut data5) | ^^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:51:9 + --> tests/ui/read_zero_byte_vec.rs:47:9 | LL | f.read(&mut data6) | ^^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:85:9 + --> tests/ui/read_zero_byte_vec.rs:81:9 | LL | f.read(&mut v)?; | ^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:95:5 + --> tests/ui/read_zero_byte_vec.rs:91:5 | LL | r.read(&mut data).await.unwrap(); | ^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:100:5 + --> tests/ui/read_zero_byte_vec.rs:96:5 | LL | r.read_exact(&mut data2).await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:107:5 + --> tests/ui/read_zero_byte_vec.rs:103:5 | LL | r.read(&mut data).await.unwrap(); | ^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:112:5 + --> tests/ui/read_zero_byte_vec.rs:108:5 | LL | r.read_exact(&mut data2).await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:131:30 + --> tests/ui/read_zero_byte_vec.rs:127:30 | LL | let num_bytes_received = stream_and_addr.0.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL ~ let num_bytes_received = stream_and_addr.0.read(&mut buf).unwrap(); | error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:136:30 + --> tests/ui/read_zero_byte_vec.rs:132:30 | LL | let num_bytes_received = stream_and_addr.0.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL ~ let num_bytes_received = stream_and_addr.0.read(&mut buf).unwrap(); | error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:141:32 + --> tests/ui/read_zero_byte_vec.rs:137:32 | LL | let num_bytes_received = { stream_and_addr.0.read(&mut buf) }.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ LL ~ let num_bytes_received = { stream_and_addr.0.read(&mut buf) }.unwrap(); | error: reading zero byte data to `Vec` - --> tests/ui/read_zero_byte_vec.rs:147:5 + --> tests/ui/read_zero_byte_vec.rs:143:5 | LL | f.read(&mut data).unwrap() | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/recursive_format_impl.rs b/tests/ui/recursive_format_impl.rs index 936d56877055..56a42230a08d 100644 --- a/tests/ui/recursive_format_impl.rs +++ b/tests/ui/recursive_format_impl.rs @@ -1,11 +1,11 @@ #![warn(clippy::recursive_format_impl)] -#![allow( +#![expect( clippy::borrow_deref_ref, clippy::deref_addrof, clippy::inherent_to_string_shadow_display, - clippy::useless_borrows_in_formatting, clippy::to_string_in_format_args, - clippy::uninlined_format_args + clippy::uninlined_format_args, + clippy::useless_borrows_in_formatting )] use std::fmt; diff --git a/tests/ui/redundant_allocation.rs b/tests/ui/redundant_allocation.rs index 832f147c6ed5..0e831dcddadc 100644 --- a/tests/ui/redundant_allocation.rs +++ b/tests/ui/redundant_allocation.rs @@ -1,4 +1,5 @@ -#![allow(clippy::boxed_local, clippy::disallowed_names)] +#![warn(clippy::redundant_allocation)] +#![expect(clippy::boxed_local, clippy::disallowed_names)] pub struct MyStruct; diff --git a/tests/ui/redundant_allocation.stderr b/tests/ui/redundant_allocation.stderr index 886ed2088c67..44d30f95d7bc 100644 --- a/tests/ui/redundant_allocation.stderr +++ b/tests/ui/redundant_allocation.stderr @@ -1,5 +1,5 @@ error: usage of `Box>` - --> tests/ui/redundant_allocation.rs:15:30 + --> tests/ui/redundant_allocation.rs:16:30 | LL | pub fn box_test6(foo: Box>) {} | ^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | pub fn box_test6(foo: Box>) {} = help: to override `-D warnings` add `#[allow(clippy::redundant_allocation)]` error: usage of `Box>` - --> tests/ui/redundant_allocation.rs:18:30 + --> tests/ui/redundant_allocation.rs:19:30 | LL | pub fn box_test7(foo: Box>) {} | ^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | pub fn box_test7(foo: Box>) {} = help: consider using just `Box` or `Arc` error: usage of `Box>>` - --> tests/ui/redundant_allocation.rs:21:27 + --> tests/ui/redundant_allocation.rs:22:27 | LL | pub fn box_test8() -> Box>> { | ^^^^^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | pub fn box_test8() -> Box>> { = help: consider using just `Box>` or `Rc>` error: usage of `Box>` - --> tests/ui/redundant_allocation.rs:27:30 + --> tests/ui/redundant_allocation.rs:28:30 | LL | pub fn box_test9(foo: Box>) -> Box>> { | ^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | pub fn box_test9(foo: Box>) -> Box>> { = help: consider using just `Box` or `Arc` error: usage of `Box>>` - --> tests/ui/redundant_allocation.rs:27:46 + --> tests/ui/redundant_allocation.rs:28:46 | LL | pub fn box_test9(foo: Box>) -> Box>> { | ^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | pub fn box_test9(foo: Box>) -> Box>> { = help: consider using just `Box>` or `Arc>` error: usage of `Rc>` - --> tests/ui/redundant_allocation.rs:41:24 + --> tests/ui/redundant_allocation.rs:42:24 | LL | pub fn rc_test5(a: Rc>) {} | ^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | pub fn rc_test5(a: Rc>) {} = help: consider using just `Rc` or `Box` error: usage of `Rc>` - --> tests/ui/redundant_allocation.rs:44:24 + --> tests/ui/redundant_allocation.rs:45:24 | LL | pub fn rc_test7(a: Rc>) {} | ^^^^^^^^^^^^^ @@ -64,7 +64,7 @@ LL | pub fn rc_test7(a: Rc>) {} = help: consider using just `Rc` or `Arc` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:47:26 + --> tests/ui/redundant_allocation.rs:48:26 | LL | pub fn rc_test8() -> Rc>> { | ^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | pub fn rc_test8() -> Rc>> { = help: consider using just `Rc>` or `Box>` error: usage of `Rc>` - --> tests/ui/redundant_allocation.rs:53:29 + --> tests/ui/redundant_allocation.rs:54:29 | LL | pub fn rc_test9(foo: Rc>) -> Rc>> { | ^^^^^^^^^^ @@ -82,7 +82,7 @@ LL | pub fn rc_test9(foo: Rc>) -> Rc>> { = help: consider using just `Rc` or `Arc` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:53:44 + --> tests/ui/redundant_allocation.rs:54:44 | LL | pub fn rc_test9(foo: Rc>) -> Rc>> { | ^^^^^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL | pub fn rc_test9(foo: Rc>) -> Rc>> { = help: consider using just `Rc>` or `Arc>` error: usage of `Arc>` - --> tests/ui/redundant_allocation.rs:67:25 + --> tests/ui/redundant_allocation.rs:68:25 | LL | pub fn arc_test5(a: Arc>) {} | ^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | pub fn arc_test5(a: Arc>) {} = help: consider using just `Arc` or `Box` error: usage of `Arc>` - --> tests/ui/redundant_allocation.rs:70:25 + --> tests/ui/redundant_allocation.rs:71:25 | LL | pub fn arc_test6(a: Arc>) {} | ^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | pub fn arc_test6(a: Arc>) {} = help: consider using just `Arc` or `Rc` error: usage of `Arc>>` - --> tests/ui/redundant_allocation.rs:73:27 + --> tests/ui/redundant_allocation.rs:74:27 | LL | pub fn arc_test8() -> Arc>> { | ^^^^^^^^^^^^^^^^^^^^^ @@ -118,7 +118,7 @@ LL | pub fn arc_test8() -> Arc>> { = help: consider using just `Arc>` or `Box>` error: usage of `Arc>` - --> tests/ui/redundant_allocation.rs:79:30 + --> tests/ui/redundant_allocation.rs:80:30 | LL | pub fn arc_test9(foo: Arc>) -> Arc>> { | ^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | pub fn arc_test9(foo: Arc>) -> Arc>> { = help: consider using just `Arc` or `Rc` error: usage of `Arc>>` - --> tests/ui/redundant_allocation.rs:79:45 + --> tests/ui/redundant_allocation.rs:80:45 | LL | pub fn arc_test9(foo: Arc>) -> Arc>> { | ^^^^^^^^^^^^^^^^ @@ -136,7 +136,7 @@ LL | pub fn arc_test9(foo: Arc>) -> Arc>> { = help: consider using just `Arc>` or `Rc>` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:104:27 + --> tests/ui/redundant_allocation.rs:105:27 | LL | pub fn test_rc_box(_: Rc>>) {} | ^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | pub fn test_rc_box(_: Rc>>) {} = help: consider using just `Rc>` or `Box>` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:137:31 + --> tests/ui/redundant_allocation.rs:138:31 | LL | pub fn test_rc_box_str(_: Rc>>) {} | ^^^^^^^^^^^^^^^^^ @@ -154,7 +154,7 @@ LL | pub fn test_rc_box_str(_: Rc>>) {} = help: consider using just `Rc>` or `Box>` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:140:33 + --> tests/ui/redundant_allocation.rs:141:33 | LL | pub fn test_rc_box_slice(_: Rc>>) {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -163,7 +163,7 @@ LL | pub fn test_rc_box_slice(_: Rc>>) {} = help: consider using just `Rc>` or `Box>` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:143:32 + --> tests/ui/redundant_allocation.rs:144:32 | LL | pub fn test_rc_box_path(_: Rc>>) {} | ^^^^^^^^^^^^^^^^^^ @@ -172,7 +172,7 @@ LL | pub fn test_rc_box_path(_: Rc>>) {} = help: consider using just `Rc>` or `Box>` error: usage of `Rc>>` - --> tests/ui/redundant_allocation.rs:146:34 + --> tests/ui/redundant_allocation.rs:147:34 | LL | pub fn test_rc_box_custom(_: Rc>>) {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/redundant_allocation_fixable.fixed b/tests/ui/redundant_allocation_fixable.fixed index dbc6c0794d1a..8657022a09c1 100644 --- a/tests/ui/redundant_allocation_fixable.fixed +++ b/tests/ui/redundant_allocation_fixable.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::boxed_local, clippy::needless_pass_by_value)] +#![warn(clippy::redundant_allocation)] +#![expect(clippy::boxed_local, clippy::needless_pass_by_value)] #![allow(clippy::disallowed_names)] pub struct MyStruct; diff --git a/tests/ui/redundant_allocation_fixable.rs b/tests/ui/redundant_allocation_fixable.rs index 05b6429492ce..8d80ca4a8402 100644 --- a/tests/ui/redundant_allocation_fixable.rs +++ b/tests/ui/redundant_allocation_fixable.rs @@ -1,4 +1,5 @@ -#![allow(clippy::boxed_local, clippy::needless_pass_by_value)] +#![warn(clippy::redundant_allocation)] +#![expect(clippy::boxed_local, clippy::needless_pass_by_value)] #![allow(clippy::disallowed_names)] pub struct MyStruct; diff --git a/tests/ui/redundant_allocation_fixable.stderr b/tests/ui/redundant_allocation_fixable.stderr index 407376688717..a5b6f38a4f97 100644 --- a/tests/ui/redundant_allocation_fixable.stderr +++ b/tests/ui/redundant_allocation_fixable.stderr @@ -1,5 +1,5 @@ error: usage of `Box<&T>` - --> tests/ui/redundant_allocation_fixable.rs:21:30 + --> tests/ui/redundant_allocation_fixable.rs:22:30 | LL | pub fn box_test1(foo: Box<&T>) {} | ^^^^^^^ help: try: `&T` @@ -9,7 +9,7 @@ LL | pub fn box_test1(foo: Box<&T>) {} = help: to override `-D warnings` add `#[allow(clippy::redundant_allocation)]` error: usage of `Box<&MyStruct>` - --> tests/ui/redundant_allocation_fixable.rs:24:27 + --> tests/ui/redundant_allocation_fixable.rs:25:27 | LL | pub fn box_test2(foo: Box<&MyStruct>) {} | ^^^^^^^^^^^^^^ help: try: `&MyStruct` @@ -17,7 +17,7 @@ LL | pub fn box_test2(foo: Box<&MyStruct>) {} = note: `&MyStruct` is already a pointer, `Box<&MyStruct>` allocates a pointer on the heap error: usage of `Box<&MyEnum>` - --> tests/ui/redundant_allocation_fixable.rs:27:27 + --> tests/ui/redundant_allocation_fixable.rs:28:27 | LL | pub fn box_test3(foo: Box<&MyEnum>) {} | ^^^^^^^^^^^^ help: try: `&MyEnum` @@ -25,7 +25,7 @@ LL | pub fn box_test3(foo: Box<&MyEnum>) {} = note: `&MyEnum` is already a pointer, `Box<&MyEnum>` allocates a pointer on the heap error: usage of `Box>` - --> tests/ui/redundant_allocation_fixable.rs:32:30 + --> tests/ui/redundant_allocation_fixable.rs:33:30 | LL | pub fn box_test5(foo: Box>) {} | ^^^^^^^^^^^ help: try: `Box` @@ -33,7 +33,7 @@ LL | pub fn box_test5(foo: Box>) {} = note: `Box` is already on the heap, `Box>` makes an extra allocation error: usage of `Rc<&T>` - --> tests/ui/redundant_allocation_fixable.rs:42:29 + --> tests/ui/redundant_allocation_fixable.rs:43:29 | LL | pub fn rc_test1(foo: Rc<&T>) {} | ^^^^^^ help: try: `&T` @@ -41,7 +41,7 @@ LL | pub fn rc_test1(foo: Rc<&T>) {} = note: `&T` is already a pointer, `Rc<&T>` allocates a pointer on the heap error: usage of `Rc<&MyStruct>` - --> tests/ui/redundant_allocation_fixable.rs:45:26 + --> tests/ui/redundant_allocation_fixable.rs:46:26 | LL | pub fn rc_test2(foo: Rc<&MyStruct>) {} | ^^^^^^^^^^^^^ help: try: `&MyStruct` @@ -49,7 +49,7 @@ LL | pub fn rc_test2(foo: Rc<&MyStruct>) {} = note: `&MyStruct` is already a pointer, `Rc<&MyStruct>` allocates a pointer on the heap error: usage of `Rc<&MyEnum>` - --> tests/ui/redundant_allocation_fixable.rs:48:26 + --> tests/ui/redundant_allocation_fixable.rs:49:26 | LL | pub fn rc_test3(foo: Rc<&MyEnum>) {} | ^^^^^^^^^^^ help: try: `&MyEnum` @@ -57,7 +57,7 @@ LL | pub fn rc_test3(foo: Rc<&MyEnum>) {} = note: `&MyEnum` is already a pointer, `Rc<&MyEnum>` allocates a pointer on the heap error: usage of `Rc>` - --> tests/ui/redundant_allocation_fixable.rs:53:24 + --> tests/ui/redundant_allocation_fixable.rs:54:24 | LL | pub fn rc_test6(a: Rc>) {} | ^^^^^^^^^^^^ help: try: `Rc` @@ -65,7 +65,7 @@ LL | pub fn rc_test6(a: Rc>) {} = note: `Rc` is already on the heap, `Rc>` makes an extra allocation error: usage of `Arc<&T>` - --> tests/ui/redundant_allocation_fixable.rs:63:30 + --> tests/ui/redundant_allocation_fixable.rs:64:30 | LL | pub fn arc_test1(foo: Arc<&T>) {} | ^^^^^^^ help: try: `&T` @@ -73,7 +73,7 @@ LL | pub fn arc_test1(foo: Arc<&T>) {} = note: `&T` is already a pointer, `Arc<&T>` allocates a pointer on the heap error: usage of `Arc<&MyStruct>` - --> tests/ui/redundant_allocation_fixable.rs:66:27 + --> tests/ui/redundant_allocation_fixable.rs:67:27 | LL | pub fn arc_test2(foo: Arc<&MyStruct>) {} | ^^^^^^^^^^^^^^ help: try: `&MyStruct` @@ -81,7 +81,7 @@ LL | pub fn arc_test2(foo: Arc<&MyStruct>) {} = note: `&MyStruct` is already a pointer, `Arc<&MyStruct>` allocates a pointer on the heap error: usage of `Arc<&MyEnum>` - --> tests/ui/redundant_allocation_fixable.rs:69:27 + --> tests/ui/redundant_allocation_fixable.rs:70:27 | LL | pub fn arc_test3(foo: Arc<&MyEnum>) {} | ^^^^^^^^^^^^ help: try: `&MyEnum` @@ -89,7 +89,7 @@ LL | pub fn arc_test3(foo: Arc<&MyEnum>) {} = note: `&MyEnum` is already a pointer, `Arc<&MyEnum>` allocates a pointer on the heap error: usage of `Arc>` - --> tests/ui/redundant_allocation_fixable.rs:74:25 + --> tests/ui/redundant_allocation_fixable.rs:75:25 | LL | pub fn arc_test7(a: Arc>) {} | ^^^^^^^^^^^^^^ help: try: `Arc` diff --git a/tests/ui/redundant_as_str.fixed b/tests/ui/redundant_as_str.fixed index 4c5f7893d42e..33a83bddb3b8 100644 --- a/tests/ui/redundant_as_str.fixed +++ b/tests/ui/redundant_as_str.fixed @@ -1,5 +1,5 @@ #![warn(clippy::redundant_as_str)] -#![allow(clippy::const_is_empty)] +#![expect(clippy::const_is_empty)] fn main() { let string = "Hello, world!".to_owned(); diff --git a/tests/ui/redundant_as_str.rs b/tests/ui/redundant_as_str.rs index e3baec754595..efcfc3a12d0d 100644 --- a/tests/ui/redundant_as_str.rs +++ b/tests/ui/redundant_as_str.rs @@ -1,5 +1,5 @@ #![warn(clippy::redundant_as_str)] -#![allow(clippy::const_is_empty)] +#![expect(clippy::const_is_empty)] fn main() { let string = "Hello, world!".to_owned(); diff --git a/tests/ui/redundant_async_block.fixed b/tests/ui/redundant_async_block.fixed index 2f14f27e7056..ee47029cff0a 100644 --- a/tests/ui/redundant_async_block.fixed +++ b/tests/ui/redundant_async_block.fixed @@ -1,5 +1,5 @@ -#![allow(unused, clippy::manual_async_fn)] #![warn(clippy::redundant_async_block)] +#![expect(clippy::manual_async_fn)] use std::future::{Future, IntoFuture}; diff --git a/tests/ui/redundant_async_block.rs b/tests/ui/redundant_async_block.rs index f5fe26b19cc8..d8f090a204b3 100644 --- a/tests/ui/redundant_async_block.rs +++ b/tests/ui/redundant_async_block.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::manual_async_fn)] #![warn(clippy::redundant_async_block)] +#![expect(clippy::manual_async_fn)] use std::future::{Future, IntoFuture}; diff --git a/tests/ui/redundant_at_rest_pattern.fixed b/tests/ui/redundant_at_rest_pattern.fixed index 908b9051b7ef..601cd3b91699 100644 --- a/tests/ui/redundant_at_rest_pattern.fixed +++ b/tests/ui/redundant_at_rest_pattern.fixed @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(irrefutable_let_patterns, unused)] #![warn(clippy::redundant_at_rest_pattern)] +#![expect(irrefutable_let_patterns)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/redundant_at_rest_pattern.rs b/tests/ui/redundant_at_rest_pattern.rs index 0f19459773a9..92a22842bd04 100644 --- a/tests/ui/redundant_at_rest_pattern.rs +++ b/tests/ui/redundant_at_rest_pattern.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(irrefutable_let_patterns, unused)] #![warn(clippy::redundant_at_rest_pattern)] +#![expect(irrefutable_let_patterns)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/redundant_clone.fixed b/tests/ui/redundant_clone.fixed index c1c389f7c4ed..db38c1223c12 100644 --- a/tests/ui/redundant_clone.fixed +++ b/tests/ui/redundant_clone.fixed @@ -1,6 +1,6 @@ // rustfix-only-machine-applicable #![warn(clippy::redundant_clone)] -#![allow( +#![expect( clippy::drop_non_drop, clippy::implicit_clone, clippy::pathbuf_init_then_push, diff --git a/tests/ui/redundant_clone.rs b/tests/ui/redundant_clone.rs index 78d98762efc8..d9f66e74349a 100644 --- a/tests/ui/redundant_clone.rs +++ b/tests/ui/redundant_clone.rs @@ -1,6 +1,6 @@ // rustfix-only-machine-applicable #![warn(clippy::redundant_clone)] -#![allow( +#![expect( clippy::drop_non_drop, clippy::implicit_clone, clippy::pathbuf_init_then_push, diff --git a/tests/ui/redundant_closure_call_fixable.fixed b/tests/ui/redundant_closure_call_fixable.fixed index 9f6643e8d52e..0e9a339c630f 100644 --- a/tests/ui/redundant_closure_call_fixable.fixed +++ b/tests/ui/redundant_closure_call_fixable.fixed @@ -1,7 +1,6 @@ #![warn(clippy::redundant_closure_call)] -#![allow(clippy::redundant_async_block)] +#![expect(clippy::redundant_async_block)] #![allow(clippy::type_complexity)] -#![allow(unused)] async fn something() -> u32 { 21 diff --git a/tests/ui/redundant_closure_call_fixable.rs b/tests/ui/redundant_closure_call_fixable.rs index 34f228786786..b79f874082e6 100644 --- a/tests/ui/redundant_closure_call_fixable.rs +++ b/tests/ui/redundant_closure_call_fixable.rs @@ -1,7 +1,6 @@ #![warn(clippy::redundant_closure_call)] -#![allow(clippy::redundant_async_block)] +#![expect(clippy::redundant_async_block)] #![allow(clippy::type_complexity)] -#![allow(unused)] async fn something() -> u32 { 21 diff --git a/tests/ui/redundant_closure_call_fixable.stderr b/tests/ui/redundant_closure_call_fixable.stderr index a5591cf7813b..9fd18c37cce7 100644 --- a/tests/ui/redundant_closure_call_fixable.stderr +++ b/tests/ui/redundant_closure_call_fixable.stderr @@ -1,5 +1,5 @@ error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:15:13 + --> tests/ui/redundant_closure_call_fixable.rs:14:13 | LL | let a = (|| 42)(); | ^^^^^^^^^ help: try doing something like: `42` @@ -8,7 +8,7 @@ LL | let a = (|| 42)(); = help: to override `-D warnings` add `#[allow(clippy::redundant_closure_call)]` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:17:13 + --> tests/ui/redundant_closure_call_fixable.rs:16:13 | LL | let b = (async || { | _____________^ @@ -30,7 +30,7 @@ LL ~ }; | error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:23:13 + --> tests/ui/redundant_closure_call_fixable.rs:22:13 | LL | let c = (|| { | _____________^ @@ -52,13 +52,13 @@ LL ~ }; | error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:29:13 + --> tests/ui/redundant_closure_call_fixable.rs:28:13 | LL | let d = (async || something().await)(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `async { something().await }` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:39:13 + --> tests/ui/redundant_closure_call_fixable.rs:38:13 | LL | (|| m!())() | ^^^^^^^^^^^ help: try doing something like: `m!()` @@ -69,7 +69,7 @@ LL | m2!(); = note: this error originates in the macro `m2` (in Nightly builds, run with -Z macro-backtrace for more info) error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:34:13 + --> tests/ui/redundant_closure_call_fixable.rs:33:13 | LL | (|| 0)() | ^^^^^^^^ help: try doing something like: `0` @@ -80,91 +80,91 @@ LL | m2!(); = note: this error originates in the macro `m` which comes from the expansion of the macro `m2` (in Nightly builds, run with -Z macro-backtrace for more info) error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:49:16 + --> tests/ui/redundant_closure_call_fixable.rs:48:16 | LL | assert_eq!((|| || 43)()(), 42); | ^^^^^^^^^^^^^^ help: try doing something like: `43` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:59:10 + --> tests/ui/redundant_closure_call_fixable.rs:58:10 | LL | dbg!((|| 42)()); | ^^^^^^^^^ help: try doing something like: `42` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:63:13 + --> tests/ui/redundant_closure_call_fixable.rs:62:13 | LL | let a = (|| || || 123)(); | ^^^^^^^^^^^^^^^^ help: try doing something like: `|| || 123` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:68:13 + --> tests/ui/redundant_closure_call_fixable.rs:67:13 | LL | let a = (|| || || || async || 1)()()()()(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `async { 1 }` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:78:13 + --> tests/ui/redundant_closure_call_fixable.rs:77:13 | LL | let a = (|| echo!(|| echo!(|| 1)))()()(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `1` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:81:13 + --> tests/ui/redundant_closure_call_fixable.rs:80:13 | LL | let a = (|| echo!((|| 123)))()(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `123` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:95:11 + --> tests/ui/redundant_closure_call_fixable.rs:94:11 | LL | bar()((|| || 42)()(), 5); | ^^^^^^^^^^^^^^ help: try doing something like: `42` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:97:9 + --> tests/ui/redundant_closure_call_fixable.rs:96:9 | LL | foo((|| || 42)()(), 5); | ^^^^^^^^^^^^^^ help: try doing something like: `42` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:102:5 + --> tests/ui/redundant_closure_call_fixable.rs:101:5 | LL | (|| async {})().await; | ^^^^^^^^^^^^^^^ help: try doing something like: `async {}` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:112:18 + --> tests/ui/redundant_closure_call_fixable.rs:111:18 | LL | spawn_on((|| async move {})()); | ^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `async move {}` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:118:28 + --> tests/ui/redundant_closure_call_fixable.rs:117:28 | LL | std::convert::identity((|| 13_i32 + 36_i32)()).leading_zeros(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `13_i32 + 36_i32` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:150:5 + --> tests/ui/redundant_closure_call_fixable.rs:149:5 | LL | (|| { Some(true) })() == Some(true); | ^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `Some(true)` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:152:5 + --> tests/ui/redundant_closure_call_fixable.rs:151:5 | LL | (|| Some(true))() == Some(true); | ^^^^^^^^^^^^^^^^^ help: try doing something like: `Some(true)` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:154:5 + --> tests/ui/redundant_closure_call_fixable.rs:153:5 | LL | (|| { Some(if 1 > 2 {1} else {2}) })() == Some(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `Some(if 1 > 2 {1} else {2})` error: try not to call a closure in the expression where it is declared - --> tests/ui/redundant_closure_call_fixable.rs:156:5 + --> tests/ui/redundant_closure_call_fixable.rs:155:5 | LL | (|| { Some( 1 > 2 ) })() == Some(true); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `Some( 1 > 2 )` diff --git a/tests/ui/redundant_closure_call_late.rs b/tests/ui/redundant_closure_call_late.rs index fd997b1b5fa7..6ed7636f443e 100644 --- a/tests/ui/redundant_closure_call_late.rs +++ b/tests/ui/redundant_closure_call_late.rs @@ -1,7 +1,6 @@ // non rustfixable, see redundant_closure_call_fixable.rs #![warn(clippy::redundant_closure_call)] -#![allow(clippy::needless_late_init)] fn main() { let mut i = 1; diff --git a/tests/ui/redundant_closure_call_late.stderr b/tests/ui/redundant_closure_call_late.stderr index ce2a21c23872..1455ec8c78a5 100644 --- a/tests/ui/redundant_closure_call_late.stderr +++ b/tests/ui/redundant_closure_call_late.stderr @@ -1,5 +1,5 @@ error: closure called just once immediately after it was declared - --> tests/ui/redundant_closure_call_late.rs:16:5 + --> tests/ui/redundant_closure_call_late.rs:15:5 | LL | i = redun_closure(); | ^^^^^^^^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | i = redun_closure(); = help: to override `-D warnings` add `#[allow(clippy::redundant_closure_call)]` error: closure called just once immediately after it was declared - --> tests/ui/redundant_closure_call_late.rs:21:5 + --> tests/ui/redundant_closure_call_late.rs:20:5 | LL | i = shadowed_closure(); | ^^^^^^^^^^^^^^^^^^^^^^ error: closure called just once immediately after it was declared - --> tests/ui/redundant_closure_call_late.rs:25:5 + --> tests/ui/redundant_closure_call_late.rs:24:5 | LL | i = shadowed_closure(); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/redundant_else.fixed b/tests/ui/redundant_else.fixed index 8a3279f50180..6de4bf5a4a66 100644 --- a/tests/ui/redundant_else.fixed +++ b/tests/ui/redundant_else.fixed @@ -1,5 +1,5 @@ #![warn(clippy::redundant_else)] -#![allow(clippy::needless_return, clippy::if_same_then_else, clippy::needless_late_init)] +#![expect(clippy::if_same_then_else)] fn main() { loop { diff --git a/tests/ui/redundant_else.rs b/tests/ui/redundant_else.rs index 78abf4247a56..3245c422e7d4 100644 --- a/tests/ui/redundant_else.rs +++ b/tests/ui/redundant_else.rs @@ -1,5 +1,5 @@ #![warn(clippy::redundant_else)] -#![allow(clippy::needless_return, clippy::if_same_then_else, clippy::needless_late_init)] +#![expect(clippy::if_same_then_else)] fn main() { loop { diff --git a/tests/ui/redundant_field_names.fixed b/tests/ui/redundant_field_names.fixed index 4c922030eb66..0416735e1808 100644 --- a/tests/ui/redundant_field_names.fixed +++ b/tests/ui/redundant_field_names.fixed @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::redundant_field_names)] -#![allow(clippy::extra_unused_type_parameters, clippy::no_effect, dead_code, unused_variables)] +#![expect(clippy::no_effect)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/redundant_field_names.rs b/tests/ui/redundant_field_names.rs index 7d03e269cf25..4aa14fec4086 100644 --- a/tests/ui/redundant_field_names.rs +++ b/tests/ui/redundant_field_names.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::redundant_field_names)] -#![allow(clippy::extra_unused_type_parameters, clippy::no_effect, dead_code, unused_variables)] +#![expect(clippy::no_effect)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/redundant_guards.fixed b/tests/ui/redundant_guards.fixed index f433d8263023..c5559d3562ec 100644 --- a/tests/ui/redundant_guards.fixed +++ b/tests/ui/redundant_guards.fixed @@ -1,6 +1,7 @@ //@aux-build:proc_macros.rs -#![allow(clippy::no_effect, unused, clippy::single_match, invalid_nan_comparisons)] #![warn(clippy::redundant_guards)] +#![allow(clippy::single_match)] +#![expect(invalid_nan_comparisons)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/redundant_guards.rs b/tests/ui/redundant_guards.rs index 02115af75ed0..88bd226957ac 100644 --- a/tests/ui/redundant_guards.rs +++ b/tests/ui/redundant_guards.rs @@ -1,6 +1,7 @@ //@aux-build:proc_macros.rs -#![allow(clippy::no_effect, unused, clippy::single_match, invalid_nan_comparisons)] #![warn(clippy::redundant_guards)] +#![allow(clippy::single_match)] +#![expect(invalid_nan_comparisons)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/redundant_guards.stderr b/tests/ui/redundant_guards.stderr index c889d5a5697d..cb7b9b119e20 100644 --- a/tests/ui/redundant_guards.stderr +++ b/tests/ui/redundant_guards.stderr @@ -1,5 +1,5 @@ error: redundant guard - --> tests/ui/redundant_guards.rs:21:14 + --> tests/ui/redundant_guards.rs:22:14 | LL | x if x == 0.0 => todo!(), | ^^^^^^^^ @@ -13,7 +13,7 @@ LL + 0.0 => todo!(), | error: redundant guard - --> tests/ui/redundant_guards.rs:28:14 + --> tests/ui/redundant_guards.rs:29:14 | LL | x if x == FloatWrapper(0.0) => todo!(), | ^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + FloatWrapper(0.0) => todo!(), | error: redundant guard - --> tests/ui/redundant_guards.rs:44:20 + --> tests/ui/redundant_guards.rs:45:20 | LL | C(x, y) if let 1 = y => .., | ^^^^^^^^^ @@ -37,7 +37,7 @@ LL + C(x, 1) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:51:20 + --> tests/ui/redundant_guards.rs:52:20 | LL | Some(x) if matches!(x, Some(1) if true) => .., | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + Some(Some(1)) if true => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:53:20 + --> tests/ui/redundant_guards.rs:54:20 | LL | Some(x) if matches!(x, Some(1)) => { | ^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + Some(Some(1)) => { | error: redundant guard - --> tests/ui/redundant_guards.rs:58:20 + --> tests/ui/redundant_guards.rs:59:20 | LL | Some(x) if let Some(1) = x => .., | ^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + Some(Some(1)) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:60:20 + --> tests/ui/redundant_guards.rs:61:20 | LL | Some(x) if x == Some(2) => .., | ^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + Some(Some(2)) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:62:20 + --> tests/ui/redundant_guards.rs:63:20 | LL | Some(x) if Some(2) == x => .., | ^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + Some(Some(2)) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:88:20 + --> tests/ui/redundant_guards.rs:89:20 | LL | B { e } if matches!(e, Some(A(2))) => .., | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + B { e: Some(A(2)) } => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:126:20 + --> tests/ui/redundant_guards.rs:127:20 | LL | E::A(y) if y == "not from an or pattern" => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + E::A("not from an or pattern") => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:134:14 + --> tests/ui/redundant_guards.rs:135:14 | LL | x if matches!(x, Some(0)) => .., | ^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + Some(0) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:142:14 + --> tests/ui/redundant_guards.rs:143:14 | LL | i if i == -1 => {}, | ^^^^^^^ @@ -145,7 +145,7 @@ LL + -1 => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:144:14 + --> tests/ui/redundant_guards.rs:145:14 | LL | i if i == 1 => {}, | ^^^^^^ @@ -157,7 +157,7 @@ LL + 1 => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:207:28 + --> tests/ui/redundant_guards.rs:208:28 | LL | Some(ref x) if x == &1 => {}, | ^^^^^^^ @@ -169,7 +169,7 @@ LL + Some(1) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:209:28 + --> tests/ui/redundant_guards.rs:210:28 | LL | Some(ref x) if &1 == x => {}, | ^^^^^^^ @@ -181,7 +181,7 @@ LL + Some(1) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:211:28 + --> tests/ui/redundant_guards.rs:212:28 | LL | Some(ref x) if let &2 = x => {}, | ^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + Some(2) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:213:28 + --> tests/ui/redundant_guards.rs:214:28 | LL | Some(ref x) if matches!(x, &3) => {}, | ^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL + Some(3) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:234:32 + --> tests/ui/redundant_guards.rs:235:32 | LL | B { ref c, .. } if c == &1 => {}, | ^^^^^^^ @@ -217,7 +217,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:236:32 + --> tests/ui/redundant_guards.rs:237:32 | LL | B { ref c, .. } if &1 == c => {}, | ^^^^^^^ @@ -229,7 +229,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:238:32 + --> tests/ui/redundant_guards.rs:239:32 | LL | B { ref c, .. } if let &1 = c => {}, | ^^^^^^^^^^ @@ -241,7 +241,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:240:32 + --> tests/ui/redundant_guards.rs:241:32 | LL | B { ref c, .. } if matches!(c, &1) => {}, | ^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:251:26 + --> tests/ui/redundant_guards.rs:252:26 | LL | Some(Some(x)) if x.is_empty() => {}, | ^^^^^^^^^^^^ @@ -265,7 +265,7 @@ LL + Some(Some("")) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:263:26 + --> tests/ui/redundant_guards.rs:264:26 | LL | Some(Some(x)) if x.is_empty() => {}, | ^^^^^^^^^^^^ @@ -277,7 +277,7 @@ LL + Some(Some([])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:269:26 + --> tests/ui/redundant_guards.rs:270:26 | LL | Some(Some(x)) if x.is_empty() => {}, | ^^^^^^^^^^^^ @@ -289,7 +289,7 @@ LL + Some(Some([])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:281:26 + --> tests/ui/redundant_guards.rs:282:26 | LL | Some(Some(x)) if x.starts_with(&[]) => {}, | ^^^^^^^^^^^^^^^^^^ @@ -301,7 +301,7 @@ LL + Some(Some([..])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:287:26 + --> tests/ui/redundant_guards.rs:288:26 | LL | Some(Some(x)) if x.starts_with(&[1]) => {}, | ^^^^^^^^^^^^^^^^^^^ @@ -313,7 +313,7 @@ LL + Some(Some([1, ..])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:293:26 + --> tests/ui/redundant_guards.rs:294:26 | LL | Some(Some(x)) if x.starts_with(&[1, 2]) => {}, | ^^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL + Some(Some([1, 2, ..])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:299:26 + --> tests/ui/redundant_guards.rs:300:26 | LL | Some(Some(x)) if x.ends_with(&[1, 2]) => {}, | ^^^^^^^^^^^^^^^^^^^^ @@ -337,7 +337,7 @@ LL + Some(Some([.., 1, 2])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:322:18 + --> tests/ui/redundant_guards.rs:323:18 | LL | y if y.is_empty() => {}, | ^^^^^^^^^^^^ @@ -349,7 +349,7 @@ LL + "" => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:341:22 + --> tests/ui/redundant_guards.rs:342:22 | LL | y if y.is_empty() => {}, | ^^^^^^^^^^^^ diff --git a/tests/ui/redundant_locals.rs b/tests/ui/redundant_locals.rs index b66532dd22ee..6282703dab3d 100644 --- a/tests/ui/redundant_locals.rs +++ b/tests/ui/redundant_locals.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(unused, clippy::no_effect, clippy::needless_pass_by_ref_mut)] #![warn(clippy::redundant_locals)] +#![expect(clippy::needless_pass_by_ref_mut, clippy::no_effect)] #![feature(coroutines, stmt_expr_attributes)] extern crate proc_macros; diff --git a/tests/ui/redundant_pattern_matching_drop_order.fixed b/tests/ui/redundant_pattern_matching_drop_order.fixed index 490948442e11..05965fd02055 100644 --- a/tests/ui/redundant_pattern_matching_drop_order.fixed +++ b/tests/ui/redundant_pattern_matching_drop_order.fixed @@ -1,11 +1,7 @@ // Issue #5746 #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::if_same_then_else, - clippy::equatable_if_let, - clippy::needless_ifs, - clippy::needless_else -)] +#![allow(clippy::needless_ifs)] +#![expect(clippy::needless_else)] use std::task::Poll::{Pending, Ready}; fn main() { diff --git a/tests/ui/redundant_pattern_matching_drop_order.rs b/tests/ui/redundant_pattern_matching_drop_order.rs index d40fe84693b0..5e09cca989c5 100644 --- a/tests/ui/redundant_pattern_matching_drop_order.rs +++ b/tests/ui/redundant_pattern_matching_drop_order.rs @@ -1,11 +1,7 @@ // Issue #5746 #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::if_same_then_else, - clippy::equatable_if_let, - clippy::needless_ifs, - clippy::needless_else -)] +#![allow(clippy::needless_ifs)] +#![expect(clippy::needless_else)] use std::task::Poll::{Pending, Ready}; fn main() { diff --git a/tests/ui/redundant_pattern_matching_drop_order.stderr b/tests/ui/redundant_pattern_matching_drop_order.stderr index 7f0171b8424a..e2e6e0c53496 100644 --- a/tests/ui/redundant_pattern_matching_drop_order.stderr +++ b/tests/ui/redundant_pattern_matching_drop_order.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:15:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:11:12 | LL | if let Ok(_) = m.lock() {} | ^^^^^ @@ -15,7 +15,7 @@ LL + if m.lock().is_ok() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:17:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:13:12 | LL | if let Err(_) = Err::<(), _>(m.lock().unwrap().0) {} | ^^^^^^ @@ -29,7 +29,7 @@ LL + if Err::<(), _>(m.lock().unwrap().0).is_err() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:21:16 + --> tests/ui/redundant_pattern_matching_drop_order.rs:17:16 | LL | if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {} | ^^^^^ @@ -43,7 +43,7 @@ LL + if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:24:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:20:12 | LL | if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) { | ^^^^^ @@ -57,7 +57,7 @@ LL + if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:28:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:24:12 | LL | if let Ok(_) = Ok::<_, std::sync::MutexGuard<()>>(()) {} | ^^^^^ @@ -69,7 +69,7 @@ LL + if Ok::<_, std::sync::MutexGuard<()>>(()).is_ok() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:30:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:26:12 | LL | if let Err(_) = Err::, _>(()) {} | ^^^^^^ @@ -81,7 +81,7 @@ LL + if Err::, _>(()).is_err() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:33:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:29:12 | LL | if let Ok(_) = Ok::<_, ()>(String::new()) {} | ^^^^^ @@ -93,7 +93,7 @@ LL + if Ok::<_, ()>(String::new()).is_ok() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:35:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:31:12 | LL | if let Err(_) = Err::<(), _>((String::new(), ())) {} | ^^^^^^ @@ -105,7 +105,7 @@ LL + if Err::<(), _>((String::new(), ())).is_err() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:39:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:35:12 | LL | if let Some(_) = Some(m.lock()) {} | ^^^^^^^ @@ -119,7 +119,7 @@ LL + if Some(m.lock()).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:41:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:37:12 | LL | if let Some(_) = Some(m.lock().unwrap().0) {} | ^^^^^^^ @@ -133,7 +133,7 @@ LL + if Some(m.lock().unwrap().0).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:45:16 + --> tests/ui/redundant_pattern_matching_drop_order.rs:41:16 | LL | if let None = None::> {} | ^^^^ @@ -147,7 +147,7 @@ LL + if None::>.is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:48:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:44:12 | LL | if let None = None::> { | ^^^^ @@ -161,7 +161,7 @@ LL + if None::>.is_none() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:53:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:49:12 | LL | if let None = None::> {} | ^^^^ @@ -173,7 +173,7 @@ LL + if None::>.is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:56:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:52:12 | LL | if let Some(_) = Some(String::new()) {} | ^^^^^^^ @@ -185,7 +185,7 @@ LL + if Some(String::new()).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:58:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:54:12 | LL | if let Some(_) = Some((String::new(), ())) {} | ^^^^^^^ @@ -197,7 +197,7 @@ LL + if Some((String::new(), ())).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:62:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:58:12 | LL | if let Ready(_) = Ready(m.lock()) {} | ^^^^^^^^ @@ -211,7 +211,7 @@ LL + if Ready(m.lock()).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:64:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:60:12 | LL | if let Ready(_) = Ready(m.lock().unwrap().0) {} | ^^^^^^^^ @@ -225,7 +225,7 @@ LL + if Ready(m.lock().unwrap().0).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:68:16 + --> tests/ui/redundant_pattern_matching_drop_order.rs:64:16 | LL | if let Pending = Pending::> {} | ^^^^^^^ @@ -239,7 +239,7 @@ LL + if Pending::>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:71:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:67:12 | LL | if let Pending = Pending::> { | ^^^^^^^ @@ -253,7 +253,7 @@ LL + if Pending::>.is_pending() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:76:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:72:12 | LL | if let Pending = Pending::> {} | ^^^^^^^ @@ -265,7 +265,7 @@ LL + if Pending::>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:79:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:75:12 | LL | if let Ready(_) = Ready(String::new()) {} | ^^^^^^^^ @@ -277,7 +277,7 @@ LL + if Ready(String::new()).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_drop_order.rs:81:12 + --> tests/ui/redundant_pattern_matching_drop_order.rs:77:12 | LL | if let Ready(_) = Ready((String::new(), ())) {} | ^^^^^^^^ diff --git a/tests/ui/redundant_pattern_matching_if_let_true.fixed b/tests/ui/redundant_pattern_matching_if_let_true.fixed index b746bfd1c358..d4367feaa2a1 100644 --- a/tests/ui/redundant_pattern_matching_if_let_true.fixed +++ b/tests/ui/redundant_pattern_matching_if_let_true.fixed @@ -1,5 +1,5 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow(clippy::needless_ifs, clippy::no_effect, clippy::nonminimal_bool)] +#![allow(clippy::needless_ifs, clippy::no_effect)] macro_rules! condition { () => { diff --git a/tests/ui/redundant_pattern_matching_if_let_true.rs b/tests/ui/redundant_pattern_matching_if_let_true.rs index 7be9f31e56bd..f9987202fd72 100644 --- a/tests/ui/redundant_pattern_matching_if_let_true.rs +++ b/tests/ui/redundant_pattern_matching_if_let_true.rs @@ -1,5 +1,5 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow(clippy::needless_ifs, clippy::no_effect, clippy::nonminimal_bool)] +#![allow(clippy::needless_ifs, clippy::no_effect)] macro_rules! condition { () => { diff --git a/tests/ui/redundant_pattern_matching_ipaddr.fixed b/tests/ui/redundant_pattern_matching_ipaddr.fixed index 7c05eca1b70e..cc3b7a6470ac 100644 --- a/tests/ui/redundant_pattern_matching_ipaddr.fixed +++ b/tests/ui/redundant_pattern_matching_ipaddr.fixed @@ -1,10 +1,5 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::match_like_matches_macro, - clippy::needless_bool, - clippy::needless_ifs, - clippy::uninlined_format_args -)] +#![expect(clippy::needless_ifs)] use std::net::IpAddr::{self, V4, V6}; use std::net::{Ipv4Addr, Ipv6Addr}; diff --git a/tests/ui/redundant_pattern_matching_ipaddr.rs b/tests/ui/redundant_pattern_matching_ipaddr.rs index 1d4abca49281..8fa1f58ffaaf 100644 --- a/tests/ui/redundant_pattern_matching_ipaddr.rs +++ b/tests/ui/redundant_pattern_matching_ipaddr.rs @@ -1,10 +1,5 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::match_like_matches_macro, - clippy::needless_bool, - clippy::needless_ifs, - clippy::uninlined_format_args -)] +#![expect(clippy::needless_ifs)] use std::net::IpAddr::{self, V4, V6}; use std::net::{Ipv4Addr, Ipv6Addr}; diff --git a/tests/ui/redundant_pattern_matching_ipaddr.stderr b/tests/ui/redundant_pattern_matching_ipaddr.stderr index 9f65f85fad43..65a7e9d0f94d 100644 --- a/tests/ui/redundant_pattern_matching_ipaddr.stderr +++ b/tests/ui/redundant_pattern_matching_ipaddr.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:14:12 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:9:12 | LL | if let V4(_) = &ipaddr {} | ^^^^^ @@ -13,7 +13,7 @@ LL + if ipaddr.is_ipv4() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:17:12 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:12:12 | LL | if let V4(_) = V4(Ipv4Addr::LOCALHOST) {} | ^^^^^ @@ -25,7 +25,7 @@ LL + if V4(Ipv4Addr::LOCALHOST).is_ipv4() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:20:12 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:15:12 | LL | if let V6(_) = V6(Ipv6Addr::LOCALHOST) {} | ^^^^^ @@ -37,7 +37,7 @@ LL + if V6(Ipv6Addr::LOCALHOST).is_ipv6() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:24:8 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:19:8 | LL | if matches!(V4(Ipv4Addr::LOCALHOST), V4(_)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + if V4(Ipv4Addr::LOCALHOST).is_ipv4() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:28:8 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:23:8 | LL | if matches!(V6(Ipv6Addr::LOCALHOST), V6(_)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + if V6(Ipv6Addr::LOCALHOST).is_ipv6() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:31:15 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:26:15 | LL | while let V4(_) = V4(Ipv4Addr::LOCALHOST) {} | ^^^^^ @@ -73,7 +73,7 @@ LL + while V4(Ipv4Addr::LOCALHOST).is_ipv4() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:34:15 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:29:15 | LL | while let V6(_) = V6(Ipv6Addr::LOCALHOST) {} | ^^^^^ @@ -85,7 +85,7 @@ LL + while V6(Ipv6Addr::LOCALHOST).is_ipv6() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:45:5 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:40:5 | LL | / match V4(Ipv4Addr::LOCALHOST) { LL | | @@ -105,7 +105,7 @@ LL + V4(Ipv4Addr::LOCALHOST).is_ipv4(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:51:5 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:46:5 | LL | / match V4(Ipv4Addr::LOCALHOST) { LL | | @@ -125,7 +125,7 @@ LL + V4(Ipv4Addr::LOCALHOST).is_ipv6(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:57:5 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:52:5 | LL | / match V6(Ipv6Addr::LOCALHOST) { LL | | @@ -145,7 +145,7 @@ LL + V6(Ipv6Addr::LOCALHOST).is_ipv6(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:63:5 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:58:5 | LL | / match V6(Ipv6Addr::LOCALHOST) { LL | | @@ -165,7 +165,7 @@ LL + V6(Ipv6Addr::LOCALHOST).is_ipv4(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:69:20 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:64:20 | LL | let _ = if let V4(_) = V4(Ipv4Addr::LOCALHOST) { | ^^^^^ @@ -177,7 +177,7 @@ LL + let _ = if V4(Ipv4Addr::LOCALHOST).is_ipv4() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:78:20 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:73:20 | LL | let _ = if let V4(_) = gen_ipaddr() { | ^^^^^ @@ -189,7 +189,7 @@ LL + let _ = if gen_ipaddr().is_ipv4() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:81:19 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:76:19 | LL | } else if let V6(_) = gen_ipaddr() { | ^^^^^ @@ -201,7 +201,7 @@ LL + } else if gen_ipaddr().is_ipv6() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:94:12 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:89:12 | LL | if let V4(_) = V4(Ipv4Addr::LOCALHOST) {} | ^^^^^ @@ -213,7 +213,7 @@ LL + if V4(Ipv4Addr::LOCALHOST).is_ipv4() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:97:12 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:92:12 | LL | if let V6(_) = V6(Ipv6Addr::LOCALHOST) {} | ^^^^^ @@ -225,7 +225,7 @@ LL + if V6(Ipv6Addr::LOCALHOST).is_ipv6() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:100:15 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:95:15 | LL | while let V4(_) = V4(Ipv4Addr::LOCALHOST) {} | ^^^^^ @@ -237,7 +237,7 @@ LL + while V4(Ipv4Addr::LOCALHOST).is_ipv4() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:103:15 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:98:15 | LL | while let V6(_) = V6(Ipv6Addr::LOCALHOST) {} | ^^^^^ @@ -249,7 +249,7 @@ LL + while V6(Ipv6Addr::LOCALHOST).is_ipv6() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:106:5 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:101:5 | LL | / match V4(Ipv4Addr::LOCALHOST) { LL | | @@ -269,7 +269,7 @@ LL + V4(Ipv4Addr::LOCALHOST).is_ipv4(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_ipaddr.rs:112:5 + --> tests/ui/redundant_pattern_matching_ipaddr.rs:107:5 | LL | / match V6(Ipv6Addr::LOCALHOST) { LL | | diff --git a/tests/ui/redundant_pattern_matching_option.fixed b/tests/ui/redundant_pattern_matching_option.fixed index dbebc4e9793a..8a6f1bb63876 100644 --- a/tests/ui/redundant_pattern_matching_option.fixed +++ b/tests/ui/redundant_pattern_matching_option.fixed @@ -1,11 +1,6 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::needless_bool, - clippy::needless_ifs, - clippy::match_like_matches_macro, - clippy::equatable_if_let, - clippy::if_same_then_else -)] +#![allow(clippy::needless_bool)] +#![expect(clippy::match_like_matches_macro, clippy::needless_ifs)] fn issue_11174(boolean: bool, maybe_some: Option) -> bool { maybe_some.is_none() && (!boolean) @@ -118,7 +113,7 @@ const fn issue6067() { None::<()>.is_none(); } -#[allow(clippy::deref_addrof, dead_code, clippy::needless_borrow)] +#[allow(clippy::deref_addrof, clippy::needless_borrow)] fn issue7921() { if (&None::<()>).is_none() {} //~^ redundant_pattern_matching diff --git a/tests/ui/redundant_pattern_matching_option.rs b/tests/ui/redundant_pattern_matching_option.rs index b3bb74428a54..b2e087b5211c 100644 --- a/tests/ui/redundant_pattern_matching_option.rs +++ b/tests/ui/redundant_pattern_matching_option.rs @@ -1,11 +1,6 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::needless_bool, - clippy::needless_ifs, - clippy::match_like_matches_macro, - clippy::equatable_if_let, - clippy::if_same_then_else -)] +#![allow(clippy::needless_bool)] +#![expect(clippy::match_like_matches_macro, clippy::needless_ifs)] fn issue_11174(boolean: bool, maybe_some: Option) -> bool { matches!(maybe_some, None if !boolean) @@ -138,7 +133,7 @@ const fn issue6067() { }; } -#[allow(clippy::deref_addrof, dead_code, clippy::needless_borrow)] +#[allow(clippy::deref_addrof, clippy::needless_borrow)] fn issue7921() { if let None = *(&None::<()>) {} //~^ redundant_pattern_matching diff --git a/tests/ui/redundant_pattern_matching_option.stderr b/tests/ui/redundant_pattern_matching_option.stderr index 8f02838feb35..32d00715440f 100644 --- a/tests/ui/redundant_pattern_matching_option.stderr +++ b/tests/ui/redundant_pattern_matching_option.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:11:5 + --> tests/ui/redundant_pattern_matching_option.rs:6:5 | LL | matches!(maybe_some, None if !boolean) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + maybe_some.is_none() && (!boolean) | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:16:13 + --> tests/ui/redundant_pattern_matching_option.rs:11:13 | LL | let _ = matches!(maybe_some, None if boolean || boolean2); // guard needs parentheses | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = maybe_some.is_none() && (boolean || boolean2); // guard needs p | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:32:12 + --> tests/ui/redundant_pattern_matching_option.rs:27:12 | LL | if let None = None::<()> {} | ^^^^ @@ -37,7 +37,7 @@ LL + if None::<()>.is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:35:12 + --> tests/ui/redundant_pattern_matching_option.rs:30:12 | LL | if let Some(_) = Some(42) {} | ^^^^^^^ @@ -49,7 +49,7 @@ LL + if Some(42).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:38:12 + --> tests/ui/redundant_pattern_matching_option.rs:33:12 | LL | if let Some(_) = Some(42) { | ^^^^^^^ @@ -61,7 +61,7 @@ LL + if Some(42).is_some() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:45:15 + --> tests/ui/redundant_pattern_matching_option.rs:40:15 | LL | while let Some(_) = Some(42) {} | ^^^^^^^ @@ -73,7 +73,7 @@ LL + while Some(42).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:48:15 + --> tests/ui/redundant_pattern_matching_option.rs:43:15 | LL | while let None = Some(42) {} | ^^^^ @@ -85,7 +85,7 @@ LL + while Some(42).is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:51:15 + --> tests/ui/redundant_pattern_matching_option.rs:46:15 | LL | while let None = None::<()> {} | ^^^^ @@ -97,7 +97,7 @@ LL + while None::<()>.is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:55:15 + --> tests/ui/redundant_pattern_matching_option.rs:50:15 | LL | while let Some(_) = v.pop() { | ^^^^^^^ @@ -109,7 +109,7 @@ LL + while v.pop().is_some() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:64:5 + --> tests/ui/redundant_pattern_matching_option.rs:59:5 | LL | / match Some(42) { LL | | @@ -129,7 +129,7 @@ LL + Some(42).is_some(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:70:5 + --> tests/ui/redundant_pattern_matching_option.rs:65:5 | LL | / match None::<()> { LL | | @@ -149,7 +149,7 @@ LL + None::<()>.is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:76:13 + --> tests/ui/redundant_pattern_matching_option.rs:71:13 | LL | let _ = match None::<()> { | _____________^ @@ -170,7 +170,7 @@ LL + let _ = None::<()>.is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:83:20 + --> tests/ui/redundant_pattern_matching_option.rs:78:20 | LL | let _ = if let Some(_) = opt { true } else { false }; | ^^^^^^^ @@ -182,7 +182,7 @@ LL + let _ = if opt.is_some() { true } else { false }; | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:90:20 + --> tests/ui/redundant_pattern_matching_option.rs:85:20 | LL | let _ = if let Some(_) = gen_opt() { | ^^^^^^^ @@ -194,7 +194,7 @@ LL + let _ = if gen_opt().is_some() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:93:19 + --> tests/ui/redundant_pattern_matching_option.rs:88:19 | LL | } else if let None = gen_opt() { | ^^^^ @@ -206,7 +206,7 @@ LL + } else if gen_opt().is_none() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:100:12 + --> tests/ui/redundant_pattern_matching_option.rs:95:12 | LL | if let Some(..) = gen_opt() {} | ^^^^^^^^ @@ -218,7 +218,7 @@ LL + if gen_opt().is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:116:12 + --> tests/ui/redundant_pattern_matching_option.rs:111:12 | LL | if let Some(_) = Some(42) {} | ^^^^^^^ @@ -230,7 +230,7 @@ LL + if Some(42).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:119:12 + --> tests/ui/redundant_pattern_matching_option.rs:114:12 | LL | if let None = None::<()> {} | ^^^^ @@ -242,7 +242,7 @@ LL + if None::<()>.is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:122:15 + --> tests/ui/redundant_pattern_matching_option.rs:117:15 | LL | while let Some(_) = Some(42) {} | ^^^^^^^ @@ -254,7 +254,7 @@ LL + while Some(42).is_some() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:125:15 + --> tests/ui/redundant_pattern_matching_option.rs:120:15 | LL | while let None = None::<()> {} | ^^^^ @@ -266,7 +266,7 @@ LL + while None::<()>.is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:128:5 + --> tests/ui/redundant_pattern_matching_option.rs:123:5 | LL | / match Some(42) { LL | | @@ -286,7 +286,7 @@ LL + Some(42).is_some(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:134:5 + --> tests/ui/redundant_pattern_matching_option.rs:129:5 | LL | / match None::<()> { LL | | @@ -306,7 +306,7 @@ LL + None::<()>.is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:143:12 + --> tests/ui/redundant_pattern_matching_option.rs:138:12 | LL | if let None = *(&None::<()>) {} | ^^^^ @@ -318,7 +318,7 @@ LL + if (&None::<()>).is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:145:12 + --> tests/ui/redundant_pattern_matching_option.rs:140:12 | LL | if let None = *&None::<()> {} | ^^^^ @@ -330,7 +330,7 @@ LL + if (&None::<()>).is_none() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:152:5 + --> tests/ui/redundant_pattern_matching_option.rs:147:5 | LL | / match x { LL | | @@ -350,7 +350,7 @@ LL + x.is_some(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:158:5 + --> tests/ui/redundant_pattern_matching_option.rs:153:5 | LL | / match x { LL | | @@ -370,7 +370,7 @@ LL + x.is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:164:5 + --> tests/ui/redundant_pattern_matching_option.rs:159:5 | LL | / match x { LL | | @@ -390,7 +390,7 @@ LL + x.is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:170:5 + --> tests/ui/redundant_pattern_matching_option.rs:165:5 | LL | / match x { LL | | @@ -410,7 +410,7 @@ LL + x.is_some(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:186:13 + --> tests/ui/redundant_pattern_matching_option.rs:181:13 | LL | let _ = matches!(x, Some(_)); | ^^^^^^^^^^^^^^^^^^^^ @@ -422,7 +422,7 @@ LL + let _ = x.is_some(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:189:13 + --> tests/ui/redundant_pattern_matching_option.rs:184:13 | LL | let _ = matches!(x, None); | ^^^^^^^^^^^^^^^^^ @@ -434,7 +434,7 @@ LL + let _ = x.is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:200:17 + --> tests/ui/redundant_pattern_matching_option.rs:195:17 | LL | let _ = matches!(*p, None); | ^^^^^^^^^^^^^^^^^^ @@ -446,7 +446,7 @@ LL + let _ = (*p).is_none(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:208:16 + --> tests/ui/redundant_pattern_matching_option.rs:203:16 | LL | if let Some(_) = x? { | ^^^^^^^ @@ -458,7 +458,7 @@ LL + if x?.is_some() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:228:16 + --> tests/ui/redundant_pattern_matching_option.rs:223:16 | LL | if let Some(_) = x.await { | ^^^^^^^ @@ -470,7 +470,7 @@ LL + if x.await.is_some() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:241:12 + --> tests/ui/redundant_pattern_matching_option.rs:236:12 | LL | if let Some(_) = (x! {}) {}; | ^^^^^^^ @@ -482,7 +482,7 @@ LL + if x! {}.is_some() {}; | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_option.rs:243:15 + --> tests/ui/redundant_pattern_matching_option.rs:238:15 | LL | while let Some(_) = (x! {}) {} | ^^^^^^^ diff --git a/tests/ui/redundant_pattern_matching_poll.fixed b/tests/ui/redundant_pattern_matching_poll.fixed index 735c444bb45b..1f9511d082e3 100644 --- a/tests/ui/redundant_pattern_matching_poll.fixed +++ b/tests/ui/redundant_pattern_matching_poll.fixed @@ -1,11 +1,6 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::needless_bool, - clippy::needless_ifs, - clippy::match_like_matches_macro, - clippy::equatable_if_let, - clippy::if_same_then_else -)] +#![allow(clippy::match_like_matches_macro, clippy::needless_bool)] +#![expect(clippy::needless_ifs)] use std::task::Poll::{self, Pending, Ready}; diff --git a/tests/ui/redundant_pattern_matching_poll.rs b/tests/ui/redundant_pattern_matching_poll.rs index eeca51e8be76..f2a3ada42de7 100644 --- a/tests/ui/redundant_pattern_matching_poll.rs +++ b/tests/ui/redundant_pattern_matching_poll.rs @@ -1,11 +1,6 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow( - clippy::needless_bool, - clippy::needless_ifs, - clippy::match_like_matches_macro, - clippy::equatable_if_let, - clippy::if_same_then_else -)] +#![allow(clippy::match_like_matches_macro, clippy::needless_bool)] +#![expect(clippy::needless_ifs)] use std::task::Poll::{self, Pending, Ready}; diff --git a/tests/ui/redundant_pattern_matching_poll.stderr b/tests/ui/redundant_pattern_matching_poll.stderr index 5b94965c06da..6886b7d68354 100644 --- a/tests/ui/redundant_pattern_matching_poll.stderr +++ b/tests/ui/redundant_pattern_matching_poll.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:13:12 + --> tests/ui/redundant_pattern_matching_poll.rs:8:12 | LL | if let Pending = Pending::<()> {} | ^^^^^^^ @@ -13,7 +13,7 @@ LL + if Pending::<()>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:16:12 + --> tests/ui/redundant_pattern_matching_poll.rs:11:12 | LL | if let Ready(_) = Ready(42) {} | ^^^^^^^^ @@ -25,7 +25,7 @@ LL + if Ready(42).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:19:12 + --> tests/ui/redundant_pattern_matching_poll.rs:14:12 | LL | if let Ready(_) = Ready(42) { | ^^^^^^^^ @@ -37,7 +37,7 @@ LL + if Ready(42).is_ready() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:27:8 + --> tests/ui/redundant_pattern_matching_poll.rs:22:8 | LL | if matches!(Ready(42), Ready(_)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + if Ready(42).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:31:8 + --> tests/ui/redundant_pattern_matching_poll.rs:26:8 | LL | if matches!(Pending::<()>, Pending) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + if Pending::<()>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:34:15 + --> tests/ui/redundant_pattern_matching_poll.rs:29:15 | LL | while let Ready(_) = Ready(42) {} | ^^^^^^^^ @@ -73,7 +73,7 @@ LL + while Ready(42).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:37:15 + --> tests/ui/redundant_pattern_matching_poll.rs:32:15 | LL | while let Pending = Ready(42) {} | ^^^^^^^ @@ -85,7 +85,7 @@ LL + while Ready(42).is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:40:15 + --> tests/ui/redundant_pattern_matching_poll.rs:35:15 | LL | while let Pending = Pending::<()> {} | ^^^^^^^ @@ -97,7 +97,7 @@ LL + while Pending::<()>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:47:5 + --> tests/ui/redundant_pattern_matching_poll.rs:42:5 | LL | / match Ready(42) { LL | | @@ -117,7 +117,7 @@ LL + Ready(42).is_ready(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:53:5 + --> tests/ui/redundant_pattern_matching_poll.rs:48:5 | LL | / match Pending::<()> { LL | | @@ -137,7 +137,7 @@ LL + Pending::<()>.is_pending(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:59:13 + --> tests/ui/redundant_pattern_matching_poll.rs:54:13 | LL | let _ = match Pending::<()> { | _____________^ @@ -158,7 +158,7 @@ LL + let _ = Pending::<()>.is_pending(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:66:20 + --> tests/ui/redundant_pattern_matching_poll.rs:61:20 | LL | let _ = if let Ready(_) = poll { true } else { false }; | ^^^^^^^^ @@ -170,7 +170,7 @@ LL + let _ = if poll.is_ready() { true } else { false }; | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:71:20 + --> tests/ui/redundant_pattern_matching_poll.rs:66:20 | LL | let _ = if let Ready(_) = gen_poll() { | ^^^^^^^^ @@ -182,7 +182,7 @@ LL + let _ = if gen_poll().is_ready() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:74:19 + --> tests/ui/redundant_pattern_matching_poll.rs:69:19 | LL | } else if let Pending = gen_poll() { | ^^^^^^^ @@ -194,7 +194,7 @@ LL + } else if gen_poll().is_pending() { | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:91:12 + --> tests/ui/redundant_pattern_matching_poll.rs:86:12 | LL | if let Ready(_) = Ready(42) {} | ^^^^^^^^ @@ -206,7 +206,7 @@ LL + if Ready(42).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:94:12 + --> tests/ui/redundant_pattern_matching_poll.rs:89:12 | LL | if let Pending = Pending::<()> {} | ^^^^^^^ @@ -218,7 +218,7 @@ LL + if Pending::<()>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:97:15 + --> tests/ui/redundant_pattern_matching_poll.rs:92:15 | LL | while let Ready(_) = Ready(42) {} | ^^^^^^^^ @@ -230,7 +230,7 @@ LL + while Ready(42).is_ready() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:100:15 + --> tests/ui/redundant_pattern_matching_poll.rs:95:15 | LL | while let Pending = Pending::<()> {} | ^^^^^^^ @@ -242,7 +242,7 @@ LL + while Pending::<()>.is_pending() {} | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:103:5 + --> tests/ui/redundant_pattern_matching_poll.rs:98:5 | LL | / match Ready(42) { LL | | @@ -262,7 +262,7 @@ LL + Ready(42).is_ready(); | error: redundant pattern matching - --> tests/ui/redundant_pattern_matching_poll.rs:109:5 + --> tests/ui/redundant_pattern_matching_poll.rs:104:5 | LL | / match Pending::<()> { LL | | diff --git a/tests/ui/redundant_pattern_matching_result.fixed b/tests/ui/redundant_pattern_matching_result.fixed index 8754d71aa629..6259a1e55f7d 100644 --- a/tests/ui/redundant_pattern_matching_result.fixed +++ b/tests/ui/redundant_pattern_matching_result.fixed @@ -1,5 +1,5 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow(deprecated)] +#![expect(deprecated)] #![allow( clippy::if_same_then_else, clippy::match_like_matches_macro, diff --git a/tests/ui/redundant_pattern_matching_result.rs b/tests/ui/redundant_pattern_matching_result.rs index b83b02588fb6..af6dc58e5c67 100644 --- a/tests/ui/redundant_pattern_matching_result.rs +++ b/tests/ui/redundant_pattern_matching_result.rs @@ -1,5 +1,5 @@ #![warn(clippy::redundant_pattern_matching)] -#![allow(deprecated)] +#![expect(deprecated)] #![allow( clippy::if_same_then_else, clippy::match_like_matches_macro, diff --git a/tests/ui/redundant_pub_crate.fixed b/tests/ui/redundant_pub_crate.fixed index 8a30fedede4a..cf4e8fe30502 100644 --- a/tests/ui/redundant_pub_crate.fixed +++ b/tests/ui/redundant_pub_crate.fixed @@ -1,5 +1,4 @@ //@aux-build:proc_macros.rs -#![allow(dead_code)] #![warn(clippy::redundant_pub_crate)] mod m1 { @@ -142,12 +141,10 @@ mod m5 { pub use m4::*; mod issue_8732 { - #[allow(unused_macros)] macro_rules! some_macro { () => {}; } - #[allow(unused_imports)] pub(crate) use some_macro; // ok: macro exports are exempt } diff --git a/tests/ui/redundant_pub_crate.rs b/tests/ui/redundant_pub_crate.rs index 45ba13a63b2e..d5677e1920d4 100644 --- a/tests/ui/redundant_pub_crate.rs +++ b/tests/ui/redundant_pub_crate.rs @@ -1,5 +1,4 @@ //@aux-build:proc_macros.rs -#![allow(dead_code)] #![warn(clippy::redundant_pub_crate)] mod m1 { @@ -142,12 +141,10 @@ mod m5 { pub use m4::*; mod issue_8732 { - #[allow(unused_macros)] macro_rules! some_macro { () => {}; } - #[allow(unused_imports)] pub(crate) use some_macro; // ok: macro exports are exempt } diff --git a/tests/ui/redundant_pub_crate.stderr b/tests/ui/redundant_pub_crate.stderr index 4a47a321028d..b6542e1db090 100644 --- a/tests/ui/redundant_pub_crate.stderr +++ b/tests/ui/redundant_pub_crate.stderr @@ -1,5 +1,5 @@ error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:7:5 + --> tests/ui/redundant_pub_crate.rs:6:5 | LL | pub(crate) fn g() {} // private due to m1 | ----------^^^^^ @@ -10,7 +10,7 @@ LL | pub(crate) fn g() {} // private due to m1 = help: to override `-D warnings` add `#[allow(clippy::redundant_pub_crate)]` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:14:9 + --> tests/ui/redundant_pub_crate.rs:13:9 | LL | pub(crate) fn g() {} // private due to m1_1 and m1 | ----------^^^^^ @@ -18,7 +18,7 @@ LL | pub(crate) fn g() {} // private due to m1_1 and m1 | help: consider using: `pub` error: pub(crate) module inside private module - --> tests/ui/redundant_pub_crate.rs:20:5 + --> tests/ui/redundant_pub_crate.rs:19:5 | LL | pub(crate) mod m1_2 { | ----------^^^^^^^^^ @@ -26,7 +26,7 @@ LL | pub(crate) mod m1_2 { | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:24:9 + --> tests/ui/redundant_pub_crate.rs:23:9 | LL | pub(crate) fn g() {} // private due to m1_2 and m1 | ----------^^^^^ @@ -34,7 +34,7 @@ LL | pub(crate) fn g() {} // private due to m1_2 and m1 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:32:9 + --> tests/ui/redundant_pub_crate.rs:31:9 | LL | pub(crate) fn g() {} // private due to m1 | ----------^^^^^ @@ -42,7 +42,7 @@ LL | pub(crate) fn g() {} // private due to m1 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:41:5 + --> tests/ui/redundant_pub_crate.rs:40:5 | LL | pub(crate) fn g() {} // already crate visible due to m2 | ----------^^^^^ @@ -50,7 +50,7 @@ LL | pub(crate) fn g() {} // already crate visible due to m2 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:48:9 + --> tests/ui/redundant_pub_crate.rs:47:9 | LL | pub(crate) fn g() {} // private due to m2_1 | ----------^^^^^ @@ -58,7 +58,7 @@ LL | pub(crate) fn g() {} // private due to m2_1 | help: consider using: `pub` error: pub(crate) module inside private module - --> tests/ui/redundant_pub_crate.rs:54:5 + --> tests/ui/redundant_pub_crate.rs:53:5 | LL | pub(crate) mod m2_2 { | ----------^^^^^^^^^ @@ -66,7 +66,7 @@ LL | pub(crate) mod m2_2 { | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:58:9 + --> tests/ui/redundant_pub_crate.rs:57:9 | LL | pub(crate) fn g() {} // already crate visible due to m2_2 and m2 | ----------^^^^^ @@ -74,7 +74,7 @@ LL | pub(crate) fn g() {} // already crate visible due to m2_2 and m2 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:66:9 + --> tests/ui/redundant_pub_crate.rs:65:9 | LL | pub(crate) fn g() {} // already crate visible due to m2 | ----------^^^^^ @@ -82,7 +82,7 @@ LL | pub(crate) fn g() {} // already crate visible due to m2 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:80:9 + --> tests/ui/redundant_pub_crate.rs:79:9 | LL | pub(crate) fn g() {} // private due to m3_1 | ----------^^^^^ @@ -90,7 +90,7 @@ LL | pub(crate) fn g() {} // private due to m3_1 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:89:9 + --> tests/ui/redundant_pub_crate.rs:88:9 | LL | pub(crate) fn g() {} // already crate visible due to m3_2 | ----------^^^^^ @@ -98,7 +98,7 @@ LL | pub(crate) fn g() {} // already crate visible due to m3_2 | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:104:5 + --> tests/ui/redundant_pub_crate.rs:103:5 | LL | pub(crate) fn g() {} // private: not re-exported by `pub use m4::*` | ----------^^^^^ @@ -106,7 +106,7 @@ LL | pub(crate) fn g() {} // private: not re-exported by `pub use m4::*` | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:111:9 + --> tests/ui/redundant_pub_crate.rs:110:9 | LL | pub(crate) fn g() {} // private due to m4_1 | ----------^^^^^ @@ -114,7 +114,7 @@ LL | pub(crate) fn g() {} // private due to m4_1 | help: consider using: `pub` error: pub(crate) module inside private module - --> tests/ui/redundant_pub_crate.rs:117:5 + --> tests/ui/redundant_pub_crate.rs:116:5 | LL | pub(crate) mod m4_2 { | ----------^^^^^^^^^ @@ -122,7 +122,7 @@ LL | pub(crate) mod m4_2 { | help: consider using: `pub` error: pub(crate) function inside private module - --> tests/ui/redundant_pub_crate.rs:121:9 + --> tests/ui/redundant_pub_crate.rs:120:9 | LL | pub(crate) fn g() {} // private due to m4_2 | ----------^^^^^ @@ -130,7 +130,7 @@ LL | pub(crate) fn g() {} // private due to m4_2 | help: consider using: `pub` error: pub(crate) import inside private module - --> tests/ui/redundant_pub_crate.rs:137:5 + --> tests/ui/redundant_pub_crate.rs:136:5 | LL | pub(crate) use m5_1::*; | ----------^^^^^^^^^^^^^ @@ -138,7 +138,7 @@ LL | pub(crate) use m5_1::*; | help: consider using: `pub` error: pub(crate) import inside private module - --> tests/ui/redundant_pub_crate.rs:139:27 + --> tests/ui/redundant_pub_crate.rs:138:27 | LL | pub(crate) use m5_1::{*}; | ---------- ^ diff --git a/tests/ui/redundant_slicing.fixed b/tests/ui/redundant_slicing.fixed index 385a5d97cf1a..2d194fa6f7b1 100644 --- a/tests/ui/redundant_slicing.fixed +++ b/tests/ui/redundant_slicing.fixed @@ -1,5 +1,5 @@ -#![allow(unused, clippy::deref_by_slicing)] #![warn(clippy::redundant_slicing)] +#![expect(clippy::deref_by_slicing)] use std::io::Read; diff --git a/tests/ui/redundant_slicing.rs b/tests/ui/redundant_slicing.rs index 04f181da250d..74fc86993a86 100644 --- a/tests/ui/redundant_slicing.rs +++ b/tests/ui/redundant_slicing.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::deref_by_slicing)] #![warn(clippy::redundant_slicing)] +#![expect(clippy::deref_by_slicing)] use std::io::Read; diff --git a/tests/ui/redundant_static_lifetimes.fixed b/tests/ui/redundant_static_lifetimes.fixed index 86c6ca17eb20..b878a875d518 100644 --- a/tests/ui/redundant_static_lifetimes.fixed +++ b/tests/ui/redundant_static_lifetimes.fixed @@ -1,7 +1,6 @@ -#![allow(unused)] // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint -#![allow(static_mut_refs)] +#![warn(clippy::redundant_static_lifetimes)] #[derive(Debug)] struct Foo; diff --git a/tests/ui/redundant_static_lifetimes.rs b/tests/ui/redundant_static_lifetimes.rs index 6fefe6c232d2..7a46758052be 100644 --- a/tests/ui/redundant_static_lifetimes.rs +++ b/tests/ui/redundant_static_lifetimes.rs @@ -1,7 +1,6 @@ -#![allow(unused)] // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint -#![allow(static_mut_refs)] +#![warn(clippy::redundant_static_lifetimes)] #[derive(Debug)] struct Foo; diff --git a/tests/ui/redundant_static_lifetimes.stderr b/tests/ui/redundant_static_lifetimes.stderr index 955882703955..6e892c695ae3 100644 --- a/tests/ui/redundant_static_lifetimes.stderr +++ b/tests/ui/redundant_static_lifetimes.stderr @@ -1,5 +1,5 @@ error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:8:17 + --> tests/ui/redundant_static_lifetimes.rs:7:17 | LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removing 'static. | -^^^^^^^---- help: consider removing `'static`: `&str` @@ -8,103 +8,103 @@ LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removi = help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:13:21 + --> tests/ui/redundant_static_lifetimes.rs:12:21 | LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static | -^^^^^^^---- help: consider removing `'static`: `&str` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:16:32 + --> tests/ui/redundant_static_lifetimes.rs:15:32 | LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static | -^^^^^^^---- help: consider removing `'static`: `&str` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:16:47 + --> tests/ui/redundant_static_lifetimes.rs:15:47 | LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static | -^^^^^^^---- help: consider removing `'static`: `&str` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:20:17 + --> tests/ui/redundant_static_lifetimes.rs:19:17 | LL | const VAR_SIX: &'static u8 = &5; | -^^^^^^^--- help: consider removing `'static`: `&u8` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:23:20 + --> tests/ui/redundant_static_lifetimes.rs:22:20 | LL | const VAR_HEIGHT: &'static Foo = &Foo {}; | -^^^^^^^---- help: consider removing `'static`: `&Foo` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:26:19 + --> tests/ui/redundant_static_lifetimes.rs:25:19 | LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR: Consider removing 'static. | -^^^^^^^----- help: consider removing `'static`: `&[u8]` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:29:19 + --> tests/ui/redundant_static_lifetimes.rs:28:19 | LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static. | -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)` error: constants have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:32:19 + --> tests/ui/redundant_static_lifetimes.rs:31:19 | LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static. | -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:35:25 + --> tests/ui/redundant_static_lifetimes.rs:34:25 | LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR: Consider removing 'static. | -^^^^^^^---- help: consider removing `'static`: `&str` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:40:29 + --> tests/ui/redundant_static_lifetimes.rs:39:29 | LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static | -^^^^^^^---- help: consider removing `'static`: `&str` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:43:25 + --> tests/ui/redundant_static_lifetimes.rs:42:25 | LL | static STATIC_VAR_SIX: &'static u8 = &5; | -^^^^^^^--- help: consider removing `'static`: `&u8` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:46:28 + --> tests/ui/redundant_static_lifetimes.rs:45:28 | LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {}; | -^^^^^^^---- help: consider removing `'static`: `&Foo` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:49:27 + --> tests/ui/redundant_static_lifetimes.rs:48:27 | LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR: Consider removing 'static. | -^^^^^^^----- help: consider removing `'static`: `&[u8]` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:52:27 + --> tests/ui/redundant_static_lifetimes.rs:51:27 | LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static. | -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:55:27 + --> tests/ui/redundant_static_lifetimes.rs:54:27 | LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static. | -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:58:31 + --> tests/ui/redundant_static_lifetimes.rs:57:31 | LL | static mut STATIC_MUT_SLICE: &'static mut [u32] = &mut [0]; | -^^^^^^^---------- help: consider removing `'static`: `&mut [u32]` error: statics have by default a `'static` lifetime - --> tests/ui/redundant_static_lifetimes.rs:88:16 + --> tests/ui/redundant_static_lifetimes.rs:87:16 | LL | static V: &'static u8 = &17; | -^^^^^^^--- help: consider removing `'static`: `&u8` diff --git a/tests/ui/redundant_test_prefix.fixed b/tests/ui/redundant_test_prefix.fixed index b99771f0640c..55044a6e5914 100644 --- a/tests/ui/redundant_test_prefix.fixed +++ b/tests/ui/redundant_test_prefix.fixed @@ -1,4 +1,3 @@ -#![allow(dead_code)] #![warn(clippy::redundant_test_prefix)] fn main() { diff --git a/tests/ui/redundant_test_prefix.rs b/tests/ui/redundant_test_prefix.rs index 3aec577cffa1..d7319bc2f4e1 100644 --- a/tests/ui/redundant_test_prefix.rs +++ b/tests/ui/redundant_test_prefix.rs @@ -1,4 +1,3 @@ -#![allow(dead_code)] #![warn(clippy::redundant_test_prefix)] fn main() { diff --git a/tests/ui/redundant_test_prefix.stderr b/tests/ui/redundant_test_prefix.stderr index d156af586df3..fdb74ee47206 100644 --- a/tests/ui/redundant_test_prefix.stderr +++ b/tests/ui/redundant_test_prefix.stderr @@ -1,5 +1,5 @@ error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:17:4 + --> tests/ui/redundant_test_prefix.rs:16:4 | LL | fn test_f3() { | ^^^^^^^ help: consider removing the `test_` prefix: `f3` @@ -8,109 +8,109 @@ LL | fn test_f3() { = help: to override `-D warnings` add `#[allow(clippy::redundant_test_prefix)]` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:26:4 + --> tests/ui/redundant_test_prefix.rs:25:4 | LL | fn test_f4() { | ^^^^^^^ help: consider removing the `test_` prefix: `f4` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:39:4 + --> tests/ui/redundant_test_prefix.rs:38:4 | LL | fn test_f6() { | ^^^^^^^ help: consider removing the `test_` prefix: `f6` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:54:8 + --> tests/ui/redundant_test_prefix.rs:53:8 | LL | fn test_foo() { | ^^^^^^^^ help: consider removing the `test_` prefix: `foo` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:59:8 + --> tests/ui/redundant_test_prefix.rs:58:8 | LL | fn test_foo_with_call() { | ^^^^^^^^^^^^^^^^^^ help: consider removing the `test_` prefix: `foo_with_call` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:66:8 + --> tests/ui/redundant_test_prefix.rs:65:8 | LL | fn test_f1() { | ^^^^^^^ help: consider removing the `test_` prefix: `f1` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:71:8 + --> tests/ui/redundant_test_prefix.rs:70:8 | LL | fn test_f2() { | ^^^^^^^ help: consider removing the `test_` prefix: `f2` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:76:8 + --> tests/ui/redundant_test_prefix.rs:75:8 | LL | fn test_f3() { | ^^^^^^^ help: consider removing the `test_` prefix: `f3` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:81:8 + --> tests/ui/redundant_test_prefix.rs:80:8 | LL | fn test_f4() { | ^^^^^^^ help: consider removing the `test_` prefix: `f4` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:86:8 + --> tests/ui/redundant_test_prefix.rs:85:8 | LL | fn test_f5() { | ^^^^^^^ help: consider removing the `test_` prefix: `f5` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:91:8 + --> tests/ui/redundant_test_prefix.rs:90:8 | LL | fn test_f6() { | ^^^^^^^ help: consider removing the `test_` prefix: `f6` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:100:8 + --> tests/ui/redundant_test_prefix.rs:99:8 | LL | fn test_foo() { | ^^^^^^^^ help: consider removing the `test_` prefix: `foo` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:105:8 + --> tests/ui/redundant_test_prefix.rs:104:8 | LL | fn test_foo_with_call() { | ^^^^^^^^^^^^^^^^^^ help: consider removing the `test_` prefix: `foo_with_call` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:112:8 + --> tests/ui/redundant_test_prefix.rs:111:8 | LL | fn test_f1() { | ^^^^^^^ help: consider removing the `test_` prefix: `f1` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:117:8 + --> tests/ui/redundant_test_prefix.rs:116:8 | LL | fn test_f2() { | ^^^^^^^ help: consider removing the `test_` prefix: `f2` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:122:8 + --> tests/ui/redundant_test_prefix.rs:121:8 | LL | fn test_f3() { | ^^^^^^^ help: consider removing the `test_` prefix: `f3` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:127:8 + --> tests/ui/redundant_test_prefix.rs:126:8 | LL | fn test_f4() { | ^^^^^^^ help: consider removing the `test_` prefix: `f4` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:132:8 + --> tests/ui/redundant_test_prefix.rs:131:8 | LL | fn test_f5() { | ^^^^^^^ help: consider removing the `test_` prefix: `f5` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix.rs:137:8 + --> tests/ui/redundant_test_prefix.rs:136:8 | LL | fn test_f6() { | ^^^^^^^ help: consider removing the `test_` prefix: `f6` diff --git a/tests/ui/redundant_test_prefix_noautofix.rs b/tests/ui/redundant_test_prefix_noautofix.rs index 6ad5d011d8b7..e520fe4a1a18 100644 --- a/tests/ui/redundant_test_prefix_noautofix.rs +++ b/tests/ui/redundant_test_prefix_noautofix.rs @@ -1,6 +1,5 @@ //@no-rustfix: name conflicts -#![allow(dead_code)] #![warn(clippy::redundant_test_prefix)] fn main() { diff --git a/tests/ui/redundant_test_prefix_noautofix.stderr b/tests/ui/redundant_test_prefix_noautofix.stderr index 6440faf1b3c8..734fc926b6ee 100644 --- a/tests/ui/redundant_test_prefix_noautofix.stderr +++ b/tests/ui/redundant_test_prefix_noautofix.stderr @@ -1,5 +1,5 @@ error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:19:4 + --> tests/ui/redundant_test_prefix_noautofix.rs:18:4 | LL | fn test_f3() { | ^^^^^^^ help: consider removing the `test_` prefix: `f3` @@ -8,13 +8,13 @@ LL | fn test_f3() { = help: to override `-D warnings` add `#[allow(clippy::redundant_test_prefix)]` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:28:4 + --> tests/ui/redundant_test_prefix_noautofix.rs:27:4 | LL | fn test_f4() { | ^^^^^^^ help: consider removing the `test_` prefix: `f4` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:39:4 + --> tests/ui/redundant_test_prefix_noautofix.rs:38:4 | LL | fn test_f5() { | ^^^^^^^ @@ -26,7 +26,7 @@ LL + fn f5_works() { | error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:53:4 + --> tests/ui/redundant_test_prefix_noautofix.rs:52:4 | LL | fn test_f6() { | ^^^^^^^ @@ -38,13 +38,13 @@ LL + fn f6_works() { | error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:65:4 + --> tests/ui/redundant_test_prefix_noautofix.rs:64:4 | LL | fn test_f8() { | ^^^^^^^ help: consider removing the `test_` prefix: `f8` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:88:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:87:8 | LL | fn test_f() { | ^^^^^^ @@ -56,61 +56,61 @@ LL + fn f_works() { | error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:101:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:100:8 | LL | fn test_m3_2() { | ^^^^^^^^^ help: consider removing the `test_` prefix: `m3_2` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:114:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:113:8 | LL | fn test_foo() { | ^^^^^^^^ help: consider removing the `test_` prefix: `foo` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:119:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:118:8 | LL | fn test_foo_with_call() { | ^^^^^^^^^^^^^^^^^^ help: consider removing the `test_` prefix: `foo_with_call` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:126:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:125:8 | LL | fn test_f1() { | ^^^^^^^ help: consider removing the `test_` prefix: `f1` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:131:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:130:8 | LL | fn test_f2() { | ^^^^^^^ help: consider removing the `test_` prefix: `f2` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:136:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:135:8 | LL | fn test_f3() { | ^^^^^^^ help: consider removing the `test_` prefix: `f3` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:141:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:140:8 | LL | fn test_f4() { | ^^^^^^^ help: consider removing the `test_` prefix: `f4` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:146:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:145:8 | LL | fn test_f5() { | ^^^^^^^ help: consider removing the `test_` prefix: `f5` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:151:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:150:8 | LL | fn test_f6() { | ^^^^^^^ help: consider removing the `test_` prefix: `f6` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:156:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:155:8 | LL | fn test_1() { | ^^^^^^ @@ -118,7 +118,7 @@ LL | fn test_1() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:163:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:162:8 | LL | fn test_const() { | ^^^^^^^^^^ @@ -126,7 +126,7 @@ LL | fn test_const() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:170:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:169:8 | LL | fn test_async() { | ^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | fn test_async() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:177:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:176:8 | LL | fn test_yield() { | ^^^^^^^^^^ @@ -142,7 +142,7 @@ LL | fn test_yield() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:184:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:183:8 | LL | fn test_() { | ^^^^^ @@ -150,55 +150,55 @@ LL | fn test_() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:195:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:194:8 | LL | fn test_foo() { | ^^^^^^^^ help: consider removing the `test_` prefix: `foo` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:200:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:199:8 | LL | fn test_foo_with_call() { | ^^^^^^^^^^^^^^^^^^ help: consider removing the `test_` prefix: `foo_with_call` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:207:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:206:8 | LL | fn test_f1() { | ^^^^^^^ help: consider removing the `test_` prefix: `f1` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:212:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:211:8 | LL | fn test_f2() { | ^^^^^^^ help: consider removing the `test_` prefix: `f2` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:217:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:216:8 | LL | fn test_f3() { | ^^^^^^^ help: consider removing the `test_` prefix: `f3` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:222:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:221:8 | LL | fn test_f4() { | ^^^^^^^ help: consider removing the `test_` prefix: `f4` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:227:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:226:8 | LL | fn test_f5() { | ^^^^^^^ help: consider removing the `test_` prefix: `f5` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:232:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:231:8 | LL | fn test_f6() { | ^^^^^^^ help: consider removing the `test_` prefix: `f6` error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:237:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:236:8 | LL | fn test_1() { | ^^^^^^ @@ -206,7 +206,7 @@ LL | fn test_1() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:244:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:243:8 | LL | fn test_const() { | ^^^^^^^^^^ @@ -214,7 +214,7 @@ LL | fn test_const() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:251:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:250:8 | LL | fn test_async() { | ^^^^^^^^^^ @@ -222,7 +222,7 @@ LL | fn test_async() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:258:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:257:8 | LL | fn test_yield() { | ^^^^^^^^^^ @@ -230,7 +230,7 @@ LL | fn test_yield() { = help: consider function renaming (just removing `test_` prefix will produce invalid function name) error: redundant `test_` prefix in test function name - --> tests/ui/redundant_test_prefix_noautofix.rs:265:8 + --> tests/ui/redundant_test_prefix_noautofix.rs:264:8 | LL | fn test_() { | ^^^^^ diff --git a/tests/ui/redundant_type_annotations.rs b/tests/ui/redundant_type_annotations.rs index 55c19d194a49..7106e2b54740 100644 --- a/tests/ui/redundant_type_annotations.rs +++ b/tests/ui/redundant_type_annotations.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::redundant_type_annotations)] #[derive(Debug, Default)] diff --git a/tests/ui/redundant_type_annotations.stderr b/tests/ui/redundant_type_annotations.stderr index d2f04cc4768e..f736d7e9fe53 100644 --- a/tests/ui/redundant_type_annotations.stderr +++ b/tests/ui/redundant_type_annotations.stderr @@ -1,5 +1,5 @@ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:81:9 + --> tests/ui/redundant_type_annotations.rs:80:9 | LL | let v: u32 = self.return_an_int(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,97 +8,97 @@ LL | let v: u32 = self.return_an_int(); = help: to override `-D warnings` add `#[allow(clippy::redundant_type_annotations)]` error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:84:9 + --> tests/ui/redundant_type_annotations.rs:83:9 | LL | let v: &u32 = self.return_a_ref(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:87:9 + --> tests/ui/redundant_type_annotations.rs:86:9 | LL | let v: &Slice = self.return_a_ref_to_struct(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:160:5 + --> tests/ui/redundant_type_annotations.rs:159:5 | LL | let _return: String = return_a_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:163:5 + --> tests/ui/redundant_type_annotations.rs:162:5 | LL | let _return: Pie = return_a_struct(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:166:5 + --> tests/ui/redundant_type_annotations.rs:165:5 | LL | let _return: Pizza = return_an_enum(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:169:5 + --> tests/ui/redundant_type_annotations.rs:168:5 | LL | let _return: u32 = return_an_int(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:172:5 + --> tests/ui/redundant_type_annotations.rs:171:5 | LL | let _return: String = String::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:175:5 + --> tests/ui/redundant_type_annotations.rs:174:5 | LL | let new_pie: Pie = Pie::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:178:5 + --> tests/ui/redundant_type_annotations.rs:177:5 | LL | let _return: u32 = new_pie.return_an_int(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:181:5 + --> tests/ui/redundant_type_annotations.rs:180:5 | LL | let _return: u32 = Pie::associated_return_an_int(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:184:5 + --> tests/ui/redundant_type_annotations.rs:183:5 | LL | let _return: String = Pie::associated_return_a_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:191:5 + --> tests/ui/redundant_type_annotations.rs:190:5 | LL | let _var: u32 = u32::MAX; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:194:5 + --> tests/ui/redundant_type_annotations.rs:193:5 | LL | let _var: u32 = 5_u32; | ^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:197:5 + --> tests/ui/redundant_type_annotations.rs:196:5 | LL | let _var: &str = "test"; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:200:5 + --> tests/ui/redundant_type_annotations.rs:199:5 | LL | let _var: &[u8; 4] = b"test"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant type annotation - --> tests/ui/redundant_type_annotations.rs:203:5 + --> tests/ui/redundant_type_annotations.rs:202:5 | LL | let _var: bool = false; | ^^^^^^^^^^^^^^^^^^^^^^^ From 2dd917ed0273b078ca79b9759ccf356997bd7d5d Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 03/11] Attributes cleanup in tests [19/20] --- tests/ui/unnecessary_first_then_check.fixed | 3 +- tests/ui/unnecessary_first_then_check.rs | 3 +- tests/ui/unnecessary_first_then_check.stderr | 14 +- tests/ui/unnecessary_fold.fixed | 3 +- tests/ui/unnecessary_fold.rs | 3 +- tests/ui/unnecessary_fold.stderr | 82 +++---- tests/ui/unnecessary_iter_cloned.fixed | 5 +- tests/ui/unnecessary_iter_cloned.rs | 5 +- tests/ui/unnecessary_iter_cloned.stderr | 10 +- tests/ui/unnecessary_join.fixed | 2 +- tests/ui/unnecessary_join.rs | 2 +- tests/ui/unnecessary_lazy_eval.fixed | 13 +- tests/ui/unnecessary_lazy_eval.rs | 13 +- tests/ui/unnecessary_lazy_eval.stderr | 126 +++++------ tests/ui/unnecessary_lazy_eval_unfixable.rs | 2 +- tests/ui/unnecessary_literal_unwrap.fixed | 5 +- tests/ui/unnecessary_literal_unwrap.rs | 5 +- tests/ui/unnecessary_literal_unwrap.stderr | 106 ++++----- .../unnecessary_literal_unwrap_unfixable.rs | 3 +- ...nnecessary_literal_unwrap_unfixable.stderr | 204 +++++++++--------- tests/ui/unnecessary_map_on_constructor.fixed | 1 - tests/ui/unnecessary_map_on_constructor.rs | 1 - .../ui/unnecessary_map_on_constructor.stderr | 16 +- tests/ui/unnecessary_map_or.fixed | 8 +- tests/ui/unnecessary_map_or.rs | 8 +- tests/ui/unnecessary_map_or.stderr | 60 +++--- tests/ui/unnecessary_min_or_max.fixed | 3 +- tests/ui/unnecessary_min_or_max.rs | 3 +- tests/ui/unnecessary_min_or_max.stderr | 50 ++--- tests/ui/unnecessary_mut_passed.fixed | 3 +- tests/ui/unnecessary_mut_passed.rs | 3 +- tests/ui/unnecessary_mut_passed.stderr | 36 ++-- tests/ui/unnecessary_operation.fixed | 9 +- tests/ui/unnecessary_operation.rs | 9 +- tests/ui/unnecessary_operation.stderr | 40 ++-- tests/ui/unnecessary_option_map_or_else.fixed | 6 +- tests/ui/unnecessary_option_map_or_else.rs | 6 +- .../ui/unnecessary_os_str_debug_formatting.rs | 2 +- tests/ui/unnecessary_path_debug_formatting.rs | 2 +- tests/ui/unnecessary_result_map_or_else.fixed | 8 +- tests/ui/unnecessary_result_map_or_else.rs | 8 +- .../ui/unnecessary_result_map_or_else.stderr | 14 +- tests/ui/unnecessary_safety_comment.rs | 2 +- tests/ui/unnecessary_self_imports.fixed | 1 - tests/ui/unnecessary_self_imports.rs | 1 - tests/ui/unnecessary_self_imports.stderr | 4 +- .../unnecessary_semicolon.edition2021.fixed | 2 +- .../unnecessary_semicolon.edition2024.fixed | 2 +- tests/ui/unnecessary_semicolon.rs | 2 +- tests/ui/unnecessary_sort_by.fixed | 3 +- tests/ui/unnecessary_sort_by.rs | 3 +- tests/ui/unnecessary_sort_by.stderr | 44 ++-- .../unnecessary_struct_initialization.fixed | 2 +- tests/ui/unnecessary_struct_initialization.rs | 2 +- tests/ui/unnecessary_to_owned.fixed | 19 +- tests/ui/unnecessary_to_owned.rs | 19 +- tests/ui/unnecessary_to_owned.stderr | 176 +++++++-------- tests/ui/unnecessary_to_owned_on_split.fixed | 3 +- tests/ui/unnecessary_to_owned_on_split.rs | 3 +- tests/ui/unnecessary_to_owned_on_split.stderr | 18 +- tests/ui/unnecessary_unsafety_doc.rs | 1 - tests/ui/unnecessary_unsafety_doc.stderr | 14 +- tests/ui/unnecessary_wraps.rs | 4 +- tests/ui/unnecessary_wraps.stderr | 14 +- tests/ui/unneeded_field_pattern.rs | 2 +- tests/ui/unneeded_struct_pattern.fixed | 7 +- tests/ui/unneeded_struct_pattern.rs | 7 +- tests/ui/unneeded_struct_pattern.stderr | 66 +++--- tests/ui/unneeded_wildcard_pattern.fixed | 3 +- tests/ui/unneeded_wildcard_pattern.rs | 3 +- tests/ui/unneeded_wildcard_pattern.stderr | 43 ++-- tests/ui/unnested_or_patterns.fixed | 10 +- tests/ui/unnested_or_patterns.rs | 10 +- tests/ui/unnested_or_patterns.stderr | 42 ++-- tests/ui/unnested_or_patterns2.fixed | 8 +- tests/ui/unnested_or_patterns2.rs | 8 +- tests/ui/unnested_or_patterns2.stderr | 16 +- tests/ui/unsafe_derive_deserialize.rs | 2 +- tests/ui/unsafe_removed_from_name.rs | 2 - tests/ui/unsafe_removed_from_name.stderr | 12 +- tests/ui/unseparated_prefix_literals.fixed | 1 - tests/ui/unseparated_prefix_literals.rs | 1 - tests/ui/unseparated_prefix_literals.stderr | 18 +- tests/ui/unused_async.rs | 3 +- tests/ui/unused_async.stderr | 10 +- tests/ui/unused_enumerate_index.fixed | 2 +- tests/ui/unused_enumerate_index.rs | 2 +- tests/ui/unused_format_specs_width.rs | 2 +- tests/ui/unused_io_amount.rs | 3 +- tests/ui/unused_io_amount.stderr | 70 +++--- tests/ui/unused_peekable.rs | 2 +- tests/ui/unused_result_ok.fixed | 1 - tests/ui/unused_result_ok.rs | 1 - tests/ui/unused_result_ok.stderr | 8 +- 94 files changed, 740 insertions(+), 869 deletions(-) diff --git a/tests/ui/unnecessary_first_then_check.fixed b/tests/ui/unnecessary_first_then_check.fixed index aa049eb33751..38d3db067244 100644 --- a/tests/ui/unnecessary_first_then_check.fixed +++ b/tests/ui/unnecessary_first_then_check.fixed @@ -1,5 +1,6 @@ #![warn(clippy::unnecessary_first_then_check)] -#![allow(clippy::useless_vec, clippy::const_is_empty)] +#![allow(clippy::const_is_empty)] +#![expect(clippy::useless_vec)] fn main() { let s = [1, 2, 3]; diff --git a/tests/ui/unnecessary_first_then_check.rs b/tests/ui/unnecessary_first_then_check.rs index 4c2ac3ba40a2..d2a5d68d7609 100644 --- a/tests/ui/unnecessary_first_then_check.rs +++ b/tests/ui/unnecessary_first_then_check.rs @@ -1,5 +1,6 @@ #![warn(clippy::unnecessary_first_then_check)] -#![allow(clippy::useless_vec, clippy::const_is_empty)] +#![allow(clippy::const_is_empty)] +#![expect(clippy::useless_vec)] fn main() { let s = [1, 2, 3]; diff --git a/tests/ui/unnecessary_first_then_check.stderr b/tests/ui/unnecessary_first_then_check.stderr index 408b388ecf71..a15c09204d48 100644 --- a/tests/ui/unnecessary_first_then_check.stderr +++ b/tests/ui/unnecessary_first_then_check.stderr @@ -1,5 +1,5 @@ error: unnecessary use of `first().is_some()` to check if slice is not empty - --> tests/ui/unnecessary_first_then_check.rs:6:19 + --> tests/ui/unnecessary_first_then_check.rs:7:19 | LL | let _: bool = s.first().is_some(); | ^^^^^^^^^^^^^^^^^^^ help: replace this with: `!s.is_empty()` @@ -8,37 +8,37 @@ LL | let _: bool = s.first().is_some(); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_first_then_check)]` error: unnecessary use of `first().is_none()` to check if slice is empty - --> tests/ui/unnecessary_first_then_check.rs:8:21 + --> tests/ui/unnecessary_first_then_check.rs:9:21 | LL | let _: bool = s.first().is_none(); | ^^^^^^^^^^^^^^^^^ help: replace this with: `is_empty()` error: unnecessary use of `first().is_some()` to check if slice is not empty - --> tests/ui/unnecessary_first_then_check.rs:12:19 + --> tests/ui/unnecessary_first_then_check.rs:13:19 | LL | let _: bool = v.first().is_some(); | ^^^^^^^^^^^^^^^^^^^ help: replace this with: `!v.is_empty()` error: unnecessary use of `first().is_some()` to check if slice is not empty - --> tests/ui/unnecessary_first_then_check.rs:16:19 + --> tests/ui/unnecessary_first_then_check.rs:17:19 | LL | let _: bool = n[0].first().is_some(); | ^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `!n[0].is_empty()` error: unnecessary use of `first().is_none()` to check if slice is empty - --> tests/ui/unnecessary_first_then_check.rs:18:24 + --> tests/ui/unnecessary_first_then_check.rs:19:24 | LL | let _: bool = n[0].first().is_none(); | ^^^^^^^^^^^^^^^^^ help: replace this with: `is_empty()` error: unnecessary use of `first().is_some()` to check if slice is not empty - --> tests/ui/unnecessary_first_then_check.rs:25:19 + --> tests/ui/unnecessary_first_then_check.rs:26:19 | LL | let _: bool = f[0].bar.first().is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `!f[0].bar.is_empty()` error: unnecessary use of `first().is_none()` to check if slice is empty - --> tests/ui/unnecessary_first_then_check.rs:27:28 + --> tests/ui/unnecessary_first_then_check.rs:28:28 | LL | let _: bool = f[0].bar.first().is_none(); | ^^^^^^^^^^^^^^^^^ help: replace this with: `is_empty()` diff --git a/tests/ui/unnecessary_fold.fixed b/tests/ui/unnecessary_fold.fixed index a8370ed03b74..a55378e9527f 100644 --- a/tests/ui/unnecessary_fold.fixed +++ b/tests/ui/unnecessary_fold.fixed @@ -1,5 +1,4 @@ -#![allow(dead_code)] - +#![warn(clippy::unnecessary_fold)] fn is_any(acc: bool, x: usize) -> bool { acc || x > 2 } diff --git a/tests/ui/unnecessary_fold.rs b/tests/ui/unnecessary_fold.rs index f495da6e720b..47854b6cf2c1 100644 --- a/tests/ui/unnecessary_fold.rs +++ b/tests/ui/unnecessary_fold.rs @@ -1,5 +1,4 @@ -#![allow(dead_code)] - +#![warn(clippy::unnecessary_fold)] fn is_any(acc: bool, x: usize) -> bool { acc || x > 2 } diff --git a/tests/ui/unnecessary_fold.stderr b/tests/ui/unnecessary_fold.stderr index 266ced07eb82..f7c3816da0fb 100644 --- a/tests/ui/unnecessary_fold.stderr +++ b/tests/ui/unnecessary_fold.stderr @@ -1,5 +1,5 @@ error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:12:20 + --> tests/ui/unnecessary_fold.rs:11:20 | LL | let _ = (0..3).fold(false, |acc, x| acc || x > 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)` @@ -9,7 +9,7 @@ LL | let _ = (0..3).fold(false, |acc, x| acc || x > 2); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fold)]` error: redundant closure - --> tests/ui/unnecessary_fold.rs:16:32 + --> tests/ui/unnecessary_fold.rs:15:32 | LL | let _ = (0..3).fold(false, |acc, x| is_any(acc, x)); | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `is_any` @@ -18,7 +18,7 @@ LL | let _ = (0..3).fold(false, |acc, x| is_any(acc, x)); = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:20:20 + --> tests/ui/unnecessary_fold.rs:19:20 | LL | let _ = (0..3).fold(true, |acc, x| acc && x > 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `all(|x| x > 2)` @@ -26,43 +26,43 @@ LL | let _ = (0..3).fold(true, |acc, x| acc && x > 2); = note: the `all` method is short circuiting and may change the program semantics if the iterator has side effects error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:24:25 + --> tests/ui/unnecessary_fold.rs:23:25 | LL | let _: i32 = (0..3).fold(0, |acc, x| acc + x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:26:25 + --> tests/ui/unnecessary_fold.rs:25:25 | LL | let _: i32 = (0..3).fold(0, Add::add); | ^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:28:25 + --> tests/ui/unnecessary_fold.rs:27:25 | LL | let _: i32 = (0..3).fold(0, i32::add); | ^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:32:25 + --> tests/ui/unnecessary_fold.rs:31:25 | LL | let _: i32 = (0..3).fold(1, |acc, x| acc * x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:34:25 + --> tests/ui/unnecessary_fold.rs:33:25 | LL | let _: i32 = (0..3).fold(1, Mul::mul); | ^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:36:25 + --> tests/ui/unnecessary_fold.rs:35:25 | LL | let _: i32 = (0..3).fold(1, i32::mul); | ^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:42:41 + --> tests/ui/unnecessary_fold.rs:41:41 | LL | let _: bool = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)` @@ -70,7 +70,7 @@ LL | let _: bool = (0..3).map(|x| 2 * x).fold(false, |acc, x| acc || x > 2); = note: the `any` method is short circuiting and may change the program semantics if the iterator has side effects error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:100:10 + --> tests/ui/unnecessary_fold.rs:99:10 | LL | .fold(false, |acc, x| acc || x > 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)` @@ -78,157 +78,157 @@ LL | .fold(false, |acc, x| acc || x > 2); = note: the `any` method is short circuiting and may change the program semantics if the iterator has side effects error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:113:33 + --> tests/ui/unnecessary_fold.rs:112:33 | LL | assert_eq!(map.values().fold(0, |x, y| x + y), 0); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:117:30 + --> tests/ui/unnecessary_fold.rs:116:30 | LL | let _ = map.values().fold(0, |x, y| x + y); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:119:30 + --> tests/ui/unnecessary_fold.rs:118:30 | LL | let _ = map.values().fold(0, Add::add); | ^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:121:30 + --> tests/ui/unnecessary_fold.rs:120:30 | LL | let _ = map.values().fold(1, |x, y| x * y); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:123:30 + --> tests/ui/unnecessary_fold.rs:122:30 | LL | let _ = map.values().fold(1, Mul::mul); | ^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:125:35 + --> tests/ui/unnecessary_fold.rs:124:35 | LL | let _: i32 = map.values().fold(0, |x, y| x + y); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:127:35 + --> tests/ui/unnecessary_fold.rs:126:35 | LL | let _: i32 = map.values().fold(0, Add::add); | ^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:129:35 + --> tests/ui/unnecessary_fold.rs:128:35 | LL | let _: i32 = map.values().fold(1, |x, y| x * y); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:131:35 + --> tests/ui/unnecessary_fold.rs:130:35 | LL | let _: i32 = map.values().fold(1, Mul::mul); | ^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:133:31 + --> tests/ui/unnecessary_fold.rs:132:31 | LL | anything(map.values().fold(0, |x, y| x + y)); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:135:31 + --> tests/ui/unnecessary_fold.rs:134:31 | LL | anything(map.values().fold(0, Add::add)); | ^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:137:31 + --> tests/ui/unnecessary_fold.rs:136:31 | LL | anything(map.values().fold(1, |x, y| x * y)); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:139:31 + --> tests/ui/unnecessary_fold.rs:138:31 | LL | anything(map.values().fold(1, Mul::mul)); | ^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:141:26 + --> tests/ui/unnecessary_fold.rs:140:26 | LL | num(map.values().fold(0, |x, y| x + y)); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:143:26 + --> tests/ui/unnecessary_fold.rs:142:26 | LL | num(map.values().fold(0, Add::add)); | ^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:145:26 + --> tests/ui/unnecessary_fold.rs:144:26 | LL | num(map.values().fold(1, |x, y| x * y)); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:147:26 + --> tests/ui/unnecessary_fold.rs:146:26 | LL | num(map.values().fold(1, Mul::mul)); | ^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:154:16 + --> tests/ui/unnecessary_fold.rs:153:16 | LL | (0..3).fold(0, |acc, x| acc + x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:158:16 + --> tests/ui/unnecessary_fold.rs:157:16 | LL | (0..3).fold(1, |acc, x| acc * x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:162:16 + --> tests/ui/unnecessary_fold.rs:161:16 | LL | (0..3).fold(0, |acc, x| acc + x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:166:16 + --> tests/ui/unnecessary_fold.rs:165:16 | LL | (0..3).fold(1, |acc, x| acc * x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:172:21 + --> tests/ui/unnecessary_fold.rs:171:21 | LL | let _ = (2..=3).fold(1, |a, b| a * b); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:174:21 + --> tests/ui/unnecessary_fold.rs:173:21 | LL | let _ = (1..=3).fold(0, |a, b| a + b); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:176:21 + --> tests/ui/unnecessary_fold.rs:175:21 | LL | let _ = (2..=3).fold(1, |b, a| a * b); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:178:21 + --> tests/ui/unnecessary_fold.rs:177:21 | LL | let _ = (1..=3).fold(0, |b, a| a + b); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:181:20 + --> tests/ui/unnecessary_fold.rs:180:20 | LL | let _ = (0..3).fold(false, |acc, x| x > 2 || acc); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)` @@ -236,7 +236,7 @@ LL | let _ = (0..3).fold(false, |acc, x| x > 2 || acc); = note: the `any` method is short circuiting and may change the program semantics if the iterator has side effects error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:183:20 + --> tests/ui/unnecessary_fold.rs:182:20 | LL | let _ = (0..3).fold(true, |acc, x| x > 2 && acc); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `all(|x| x > 2)` @@ -244,19 +244,19 @@ LL | let _ = (0..3).fold(true, |acc, x| x > 2 && acc); = note: the `all` method is short circuiting and may change the program semantics if the iterator has side effects error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:185:20 + --> tests/ui/unnecessary_fold.rs:184:20 | LL | let _ = (0..3).fold(0, |acc, x| x + acc); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:187:20 + --> tests/ui/unnecessary_fold.rs:186:20 | LL | let _ = (0..3).fold(1, |acc, x| x * acc); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` error: this `.fold` can be written more succinctly using another method - --> tests/ui/unnecessary_fold.rs:198:20 + --> tests/ui/unnecessary_fold.rs:197:20 | LL | let _ = (0..3).fold(false, |acc: bool, x| acc || test_expr!(x)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| test_expr!(x))` diff --git a/tests/ui/unnecessary_iter_cloned.fixed b/tests/ui/unnecessary_iter_cloned.fixed index 61f2e3745ad0..a2782bcd2163 100644 --- a/tests/ui/unnecessary_iter_cloned.fixed +++ b/tests/ui/unnecessary_iter_cloned.fixed @@ -1,7 +1,6 @@ -#![allow(unused_assignments, clippy::uninlined_format_args)] #![warn(clippy::unnecessary_to_owned)] +#![expect(clippy::uninlined_format_args)] -#[allow(dead_code)] #[derive(Clone, Copy)] enum FileType { Account, @@ -74,7 +73,6 @@ fn check_files_ref(files: &[(FileType, &std::path::Path)]) -> bool { true } -#[allow(unused_assignments)] fn check_files_mut(files: &[(FileType, &std::path::Path)]) -> bool { for (mut t, path) in files.iter().copied() { t = FileType::PrivateKey; @@ -122,7 +120,6 @@ fn check_files_self_and_arg(files: &[(FileType, &std::path::Path)]) -> bool { true } -#[allow(unused_assignments)] fn check_files_mut_path_buf(files: &[(FileType, std::path::PathBuf)]) -> bool { for (mut t, path) in files.iter().cloned() { t = FileType::PrivateKey; diff --git a/tests/ui/unnecessary_iter_cloned.rs b/tests/ui/unnecessary_iter_cloned.rs index b90ca00a5fec..1225e6f94ec5 100644 --- a/tests/ui/unnecessary_iter_cloned.rs +++ b/tests/ui/unnecessary_iter_cloned.rs @@ -1,7 +1,6 @@ -#![allow(unused_assignments, clippy::uninlined_format_args)] #![warn(clippy::unnecessary_to_owned)] +#![expect(clippy::uninlined_format_args)] -#[allow(dead_code)] #[derive(Clone, Copy)] enum FileType { Account, @@ -74,7 +73,6 @@ fn check_files_ref(files: &[(FileType, &std::path::Path)]) -> bool { true } -#[allow(unused_assignments)] fn check_files_mut(files: &[(FileType, &std::path::Path)]) -> bool { for (mut t, path) in files.iter().copied() { t = FileType::PrivateKey; @@ -122,7 +120,6 @@ fn check_files_self_and_arg(files: &[(FileType, &std::path::Path)]) -> bool { true } -#[allow(unused_assignments)] fn check_files_mut_path_buf(files: &[(FileType, std::path::PathBuf)]) -> bool { for (mut t, path) in files.iter().cloned() { t = FileType::PrivateKey; diff --git a/tests/ui/unnecessary_iter_cloned.stderr b/tests/ui/unnecessary_iter_cloned.stderr index d700446fce77..46099e4e2cfb 100644 --- a/tests/ui/unnecessary_iter_cloned.stderr +++ b/tests/ui/unnecessary_iter_cloned.stderr @@ -1,5 +1,5 @@ error: unnecessary use of `copied` - --> tests/ui/unnecessary_iter_cloned.rs:31:22 + --> tests/ui/unnecessary_iter_cloned.rs:30:22 | LL | for (t, path) in files.iter().copied() { | ^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL ~ let other = match get_file_path(t) { | error: unnecessary use of `copied` - --> tests/ui/unnecessary_iter_cloned.rs:47:22 + --> tests/ui/unnecessary_iter_cloned.rs:46:22 | LL | for (t, path) in files.iter().copied() { | ^^^^^^^^^^^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL ~ let other = match get_file_path(t) { | error: unnecessary use of `cloned` - --> tests/ui/unnecessary_iter_cloned.rs:179:18 + --> tests/ui/unnecessary_iter_cloned.rs:176:18 | LL | for c in v.iter().cloned() { | ^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL + for c in v.iter() { | error: unnecessary use of `cloned` - --> tests/ui/unnecessary_iter_cloned.rs:188:18 + --> tests/ui/unnecessary_iter_cloned.rs:185:18 | LL | for c in v.iter().cloned() { | ^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL ~ let ref_c = c; | error: unnecessary use of `cloned` - --> tests/ui/unnecessary_iter_cloned.rs:198:23 + --> tests/ui/unnecessary_iter_cloned.rs:195:23 | LL | for (i, c) in v.iter().cloned() { | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_join.fixed b/tests/ui/unnecessary_join.fixed index dab09be7ebd0..2f846b7beff4 100644 --- a/tests/ui/unnecessary_join.fixed +++ b/tests/ui/unnecessary_join.fixed @@ -1,5 +1,5 @@ #![warn(clippy::unnecessary_join)] -#![allow(clippy::uninlined_format_args, clippy::useless_vec)] +#![expect(clippy::uninlined_format_args, clippy::useless_vec)] fn main() { // should be linted diff --git a/tests/ui/unnecessary_join.rs b/tests/ui/unnecessary_join.rs index e58b2696645a..5dcc394f0157 100644 --- a/tests/ui/unnecessary_join.rs +++ b/tests/ui/unnecessary_join.rs @@ -1,5 +1,5 @@ #![warn(clippy::unnecessary_join)] -#![allow(clippy::uninlined_format_args, clippy::useless_vec)] +#![expect(clippy::uninlined_format_args, clippy::useless_vec)] fn main() { // should be linted diff --git a/tests/ui/unnecessary_lazy_eval.fixed b/tests/ui/unnecessary_lazy_eval.fixed index 409a8efbfeb9..a6a0e42c7f52 100644 --- a/tests/ui/unnecessary_lazy_eval.fixed +++ b/tests/ui/unnecessary_lazy_eval.fixed @@ -1,13 +1,7 @@ //@aux-build: proc_macros.rs #![warn(clippy::unnecessary_lazy_evaluations)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::bind_instead_of_map)] -#![allow(clippy::map_identity)] -#![allow(clippy::needless_borrow)] -#![allow(clippy::unnecessary_literal_unwrap)] -#![allow(clippy::unit_arg)] -#![allow(arithmetic_overflow)] -#![allow(unconditional_panic)] +#![expect(clippy::bind_instead_of_map, clippy::needless_borrow, clippy::redundant_closure)] +#![allow(clippy::unit_arg, clippy::unnecessary_literal_unwrap)] use std::ops::Deref; @@ -240,7 +234,6 @@ fn main() { let _: Result = res.or_else(|err| Ok(err)); } -#[allow(unused)] fn issue9485() { // should not lint, is in proc macro with_span!(span Some(42).unwrap_or_else(|| 2);); @@ -252,7 +245,7 @@ fn issue9422(x: usize) -> Option { } fn panicky_arithmetic_ops(x: usize, y: isize) { - #![allow(clippy::identity_op, clippy::eq_op)] + #![allow(clippy::eq_op, clippy::identity_op)] // See comments in `eager_or_lazy.rs` for the rules that this is meant to follow diff --git a/tests/ui/unnecessary_lazy_eval.rs b/tests/ui/unnecessary_lazy_eval.rs index 54735023a935..eb7e706a2dc6 100644 --- a/tests/ui/unnecessary_lazy_eval.rs +++ b/tests/ui/unnecessary_lazy_eval.rs @@ -1,13 +1,7 @@ //@aux-build: proc_macros.rs #![warn(clippy::unnecessary_lazy_evaluations)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::bind_instead_of_map)] -#![allow(clippy::map_identity)] -#![allow(clippy::needless_borrow)] -#![allow(clippy::unnecessary_literal_unwrap)] -#![allow(clippy::unit_arg)] -#![allow(arithmetic_overflow)] -#![allow(unconditional_panic)] +#![expect(clippy::bind_instead_of_map, clippy::needless_borrow, clippy::redundant_closure)] +#![allow(clippy::unit_arg, clippy::unnecessary_literal_unwrap)] use std::ops::Deref; @@ -240,7 +234,6 @@ fn main() { let _: Result = res.or_else(|err| Ok(err)); } -#[allow(unused)] fn issue9485() { // should not lint, is in proc macro with_span!(span Some(42).unwrap_or_else(|| 2);); @@ -252,7 +245,7 @@ fn issue9422(x: usize) -> Option { } fn panicky_arithmetic_ops(x: usize, y: isize) { - #![allow(clippy::identity_op, clippy::eq_op)] + #![allow(clippy::eq_op, clippy::identity_op)] // See comments in `eager_or_lazy.rs` for the rules that this is meant to follow diff --git a/tests/ui/unnecessary_lazy_eval.stderr b/tests/ui/unnecessary_lazy_eval.stderr index 75a06a419c71..2150f75027e9 100644 --- a/tests/ui/unnecessary_lazy_eval.stderr +++ b/tests/ui/unnecessary_lazy_eval.stderr @@ -1,5 +1,5 @@ error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:83:13 + --> tests/ui/unnecessary_lazy_eval.rs:77:13 | LL | let _ = opt.unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _ = opt.unwrap_or(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:85:13 + --> tests/ui/unnecessary_lazy_eval.rs:79:13 | LL | let _ = opt.unwrap_or_else(|| astronomers_pi); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = opt.unwrap_or(astronomers_pi); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:87:13 + --> tests/ui/unnecessary_lazy_eval.rs:81:13 | LL | let _ = opt.unwrap_or_else(|| ext_str.some_field); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + let _ = opt.unwrap_or(ext_str.some_field); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:90:13 + --> tests/ui/unnecessary_lazy_eval.rs:84:13 | LL | let _ = opt.and_then(|_| ext_opt); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + let _ = opt.and(ext_opt); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:92:13 + --> tests/ui/unnecessary_lazy_eval.rs:86:13 | LL | let _ = opt.or_else(|| ext_opt); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + let _ = opt.or(ext_opt); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:94:13 + --> tests/ui/unnecessary_lazy_eval.rs:88:13 | LL | let _ = opt.or_else(|| None); | ^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + let _ = opt.or(None); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:96:13 + --> tests/ui/unnecessary_lazy_eval.rs:90:13 | LL | let _ = opt.get_or_insert_with(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + let _ = opt.get_or_insert(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:98:13 + --> tests/ui/unnecessary_lazy_eval.rs:92:13 | LL | let _ = opt.ok_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + let _ = opt.ok_or(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:100:13 + --> tests/ui/unnecessary_lazy_eval.rs:94:13 | LL | let _ = nested_tuple_opt.unwrap_or_else(|| Some((1, 2))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + let _ = nested_tuple_opt.unwrap_or(Some((1, 2))); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:102:13 + --> tests/ui/unnecessary_lazy_eval.rs:96:13 | LL | let _ = cond.then(|| astronomers_pi); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + let _ = cond.then_some(astronomers_pi); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:104:13 + --> tests/ui/unnecessary_lazy_eval.rs:98:13 | LL | let _ = true.then(|| -> _ {}); | ^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + let _ = true.then_some({}); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:106:13 + --> tests/ui/unnecessary_lazy_eval.rs:100:13 | LL | let _ = true.then(|| {}); | ^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + let _ = true.then_some({}); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:111:13 + --> tests/ui/unnecessary_lazy_eval.rs:105:13 | LL | let _ = Some(1).unwrap_or_else(|| *r); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL + let _ = Some(1).unwrap_or(*r); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:114:13 + --> tests/ui/unnecessary_lazy_eval.rs:108:13 | LL | let _ = Some(1).unwrap_or_else(|| *b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + let _ = Some(1).unwrap_or(*b); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:117:13 + --> tests/ui/unnecessary_lazy_eval.rs:111:13 | LL | let _ = Some(1).as_ref().unwrap_or_else(|| &r); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + let _ = Some(1).as_ref().unwrap_or(&r); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:119:13 + --> tests/ui/unnecessary_lazy_eval.rs:113:13 | LL | let _ = Some(1).as_ref().unwrap_or_else(|| &b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + let _ = Some(1).as_ref().unwrap_or(&b); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:123:13 + --> tests/ui/unnecessary_lazy_eval.rs:117:13 | LL | let _ = Some(10).unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL + let _ = Some(10).unwrap_or(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:125:13 + --> tests/ui/unnecessary_lazy_eval.rs:119:13 | LL | let _ = Some(10).and_then(|_| ext_opt); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -217,7 +217,7 @@ LL + let _ = Some(10).and(ext_opt); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:127:28 + --> tests/ui/unnecessary_lazy_eval.rs:121:28 | LL | let _: Option = None.or_else(|| ext_opt); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL + let _: Option = None.or(ext_opt); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:129:13 + --> tests/ui/unnecessary_lazy_eval.rs:123:13 | LL | let _ = None.get_or_insert_with(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -241,7 +241,7 @@ LL + let _ = None.get_or_insert(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:131:35 + --> tests/ui/unnecessary_lazy_eval.rs:125:35 | LL | let _: Result = None.ok_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL + let _: Result = None.ok_or(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:133:28 + --> tests/ui/unnecessary_lazy_eval.rs:127:28 | LL | let _: Option = None.or_else(|| None); | ^^^^^^^^^^^^^^^^^^^^^ @@ -265,7 +265,7 @@ LL + let _: Option = None.or(None); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:137:13 + --> tests/ui/unnecessary_lazy_eval.rs:131:13 | LL | let _ = deep.0.unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -277,7 +277,7 @@ LL + let _ = deep.0.unwrap_or(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:139:13 + --> tests/ui/unnecessary_lazy_eval.rs:133:13 | LL | let _ = deep.0.and_then(|_| ext_opt); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -289,7 +289,7 @@ LL + let _ = deep.0.and(ext_opt); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:141:13 + --> tests/ui/unnecessary_lazy_eval.rs:135:13 | LL | let _ = deep.0.or_else(|| None); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -301,7 +301,7 @@ LL + let _ = deep.0.or(None); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:143:13 + --> tests/ui/unnecessary_lazy_eval.rs:137:13 | LL | let _ = deep.0.get_or_insert_with(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -313,7 +313,7 @@ LL + let _ = deep.0.get_or_insert(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:145:13 + --> tests/ui/unnecessary_lazy_eval.rs:139:13 | LL | let _ = deep.0.ok_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL + let _ = deep.0.ok_or(2); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:177:28 + --> tests/ui/unnecessary_lazy_eval.rs:171:28 | LL | let _: Option = None.or_else(|| Some(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -337,7 +337,7 @@ LL + let _: Option = None.or(Some(3)); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:179:13 + --> tests/ui/unnecessary_lazy_eval.rs:173:13 | LL | let _ = deep.0.or_else(|| Some(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -349,7 +349,7 @@ LL + let _ = deep.0.or(Some(3)); | error: unnecessary closure used to substitute value for `Option::None` - --> tests/ui/unnecessary_lazy_eval.rs:181:13 + --> tests/ui/unnecessary_lazy_eval.rs:175:13 | LL | let _ = opt.or_else(|| Some(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -361,7 +361,7 @@ LL + let _ = opt.or(Some(3)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:188:13 + --> tests/ui/unnecessary_lazy_eval.rs:182:13 | LL | let _ = res2.unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -373,7 +373,7 @@ LL + let _ = res2.unwrap_or(2); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:190:13 + --> tests/ui/unnecessary_lazy_eval.rs:184:13 | LL | let _ = res2.unwrap_or_else(|_| astronomers_pi); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -385,7 +385,7 @@ LL + let _ = res2.unwrap_or(astronomers_pi); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:192:13 + --> tests/ui/unnecessary_lazy_eval.rs:186:13 | LL | let _ = res2.unwrap_or_else(|_| ext_str.some_field); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -397,7 +397,7 @@ LL + let _ = res2.unwrap_or(ext_str.some_field); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:215:35 + --> tests/ui/unnecessary_lazy_eval.rs:209:35 | LL | let _: Result = res.and_then(|_| Err(2)); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -409,7 +409,7 @@ LL + let _: Result = res.and(Err(2)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:217:35 + --> tests/ui/unnecessary_lazy_eval.rs:211:35 | LL | let _: Result = res.and_then(|_| Err(astronomers_pi)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -421,7 +421,7 @@ LL + let _: Result = res.and(Err(astronomers_pi)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:219:35 + --> tests/ui/unnecessary_lazy_eval.rs:213:35 | LL | let _: Result = res.and_then(|_| Err(ext_str.some_field)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -433,7 +433,7 @@ LL + let _: Result = res.and(Err(ext_str.some_field)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:222:35 + --> tests/ui/unnecessary_lazy_eval.rs:216:35 | LL | let _: Result = res.or_else(|_| Ok(2)); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -445,7 +445,7 @@ LL + let _: Result = res.or(Ok(2)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:224:35 + --> tests/ui/unnecessary_lazy_eval.rs:218:35 | LL | let _: Result = res.or_else(|_| Ok(astronomers_pi)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -457,7 +457,7 @@ LL + let _: Result = res.or(Ok(astronomers_pi)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:226:35 + --> tests/ui/unnecessary_lazy_eval.rs:220:35 | LL | let _: Result = res.or_else(|_| Ok(ext_str.some_field)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -469,7 +469,7 @@ LL + let _: Result = res.or(Ok(ext_str.some_field)); | error: unnecessary closure used to substitute value for `Result::Err` - --> tests/ui/unnecessary_lazy_eval.rs:228:35 + --> tests/ui/unnecessary_lazy_eval.rs:222:35 | LL | let _: Result = res. | ___________________________________^ @@ -484,7 +484,7 @@ LL + or(Ok(ext_str.some_field)); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:259:14 + --> tests/ui/unnecessary_lazy_eval.rs:252:14 | LL | let _x = false.then(|| i32::MAX + 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -496,7 +496,7 @@ LL + let _x = false.then_some(i32::MAX + 1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:261:14 + --> tests/ui/unnecessary_lazy_eval.rs:254:14 | LL | let _x = false.then(|| i32::MAX * 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -508,7 +508,7 @@ LL + let _x = false.then_some(i32::MAX * 2); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:263:14 + --> tests/ui/unnecessary_lazy_eval.rs:256:14 | LL | let _x = false.then(|| i32::MAX - 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -520,7 +520,7 @@ LL + let _x = false.then_some(i32::MAX - 1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:265:14 + --> tests/ui/unnecessary_lazy_eval.rs:258:14 | LL | let _x = false.then(|| i32::MIN - 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -532,7 +532,7 @@ LL + let _x = false.then_some(i32::MIN - 1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:267:14 + --> tests/ui/unnecessary_lazy_eval.rs:260:14 | LL | let _x = false.then(|| (1 + 2 * 3 - 2 / 3 + 9) << 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -544,7 +544,7 @@ LL + let _x = false.then_some((1 + 2 * 3 - 2 / 3 + 9) << 2); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:269:14 + --> tests/ui/unnecessary_lazy_eval.rs:262:14 | LL | let _x = false.then(|| 255u8 << 7); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -556,7 +556,7 @@ LL + let _x = false.then_some(255u8 << 7); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:271:14 + --> tests/ui/unnecessary_lazy_eval.rs:264:14 | LL | let _x = false.then(|| 255u8 << 8); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -568,7 +568,7 @@ LL + let _x = false.then_some(255u8 << 8); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:273:14 + --> tests/ui/unnecessary_lazy_eval.rs:266:14 | LL | let _x = false.then(|| 255u8 >> 8); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -580,7 +580,7 @@ LL + let _x = false.then_some(255u8 >> 8); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:276:14 + --> tests/ui/unnecessary_lazy_eval.rs:269:14 | LL | let _x = false.then(|| i32::MAX + -1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -592,7 +592,7 @@ LL + let _x = false.then_some(i32::MAX + -1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:278:14 + --> tests/ui/unnecessary_lazy_eval.rs:271:14 | LL | let _x = false.then(|| -i32::MAX); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -604,7 +604,7 @@ LL + let _x = false.then_some(-i32::MAX); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:280:14 + --> tests/ui/unnecessary_lazy_eval.rs:273:14 | LL | let _x = false.then(|| -i32::MIN); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -616,7 +616,7 @@ LL + let _x = false.then_some(-i32::MIN); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:283:14 + --> tests/ui/unnecessary_lazy_eval.rs:276:14 | LL | let _x = false.then(|| 255 >> -7); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -628,7 +628,7 @@ LL + let _x = false.then_some(255 >> -7); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:285:14 + --> tests/ui/unnecessary_lazy_eval.rs:278:14 | LL | let _x = false.then(|| 255 << -1); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -640,7 +640,7 @@ LL + let _x = false.then_some(255 << -1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:287:14 + --> tests/ui/unnecessary_lazy_eval.rs:280:14 | LL | let _x = false.then(|| 1 / 0); | ^^^^^^^^^^^^^^^^^^^^ @@ -652,7 +652,7 @@ LL + let _x = false.then_some(1 / 0); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:289:14 + --> tests/ui/unnecessary_lazy_eval.rs:282:14 | LL | let _x = false.then(|| x << -1); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -664,7 +664,7 @@ LL + let _x = false.then_some(x << -1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:291:14 + --> tests/ui/unnecessary_lazy_eval.rs:284:14 | LL | let _x = false.then(|| x << 2); | ^^^^^^^^^^^^^^^^^^^^^ @@ -676,7 +676,7 @@ LL + let _x = false.then_some(x << 2); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:301:14 + --> tests/ui/unnecessary_lazy_eval.rs:294:14 | LL | let _x = false.then(|| x / 0); | ^^^^^^^^^^^^^^^^^^^^ @@ -688,7 +688,7 @@ LL + let _x = false.then_some(x / 0); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:303:14 + --> tests/ui/unnecessary_lazy_eval.rs:296:14 | LL | let _x = false.then(|| x % 0); | ^^^^^^^^^^^^^^^^^^^^ @@ -700,7 +700,7 @@ LL + let _x = false.then_some(x % 0); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:306:14 + --> tests/ui/unnecessary_lazy_eval.rs:299:14 | LL | let _x = false.then(|| 1 / -1); | ^^^^^^^^^^^^^^^^^^^^^ @@ -712,7 +712,7 @@ LL + let _x = false.then_some(1 / -1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:308:14 + --> tests/ui/unnecessary_lazy_eval.rs:301:14 | LL | let _x = false.then(|| i32::MIN / -1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -724,7 +724,7 @@ LL + let _x = false.then_some(i32::MIN / -1); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:311:14 + --> tests/ui/unnecessary_lazy_eval.rs:304:14 | LL | let _x = false.then(|| i32::MIN / 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -736,7 +736,7 @@ LL + let _x = false.then_some(i32::MIN / 0); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:313:14 + --> tests/ui/unnecessary_lazy_eval.rs:306:14 | LL | let _x = false.then(|| 4 / 2); | ^^^^^^^^^^^^^^^^^^^^ @@ -748,7 +748,7 @@ LL + let _x = false.then_some(4 / 2); | error: unnecessary closure used with `bool::then` - --> tests/ui/unnecessary_lazy_eval.rs:321:14 + --> tests/ui/unnecessary_lazy_eval.rs:314:14 | LL | let _x = false.then(|| f1 + f2); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_lazy_eval_unfixable.rs b/tests/ui/unnecessary_lazy_eval_unfixable.rs index 6d28d544dfe0..e1c05076088b 100644 --- a/tests/ui/unnecessary_lazy_eval_unfixable.rs +++ b/tests/ui/unnecessary_lazy_eval_unfixable.rs @@ -1,5 +1,5 @@ #![warn(clippy::unnecessary_lazy_evaluations)] -#![allow(clippy::unnecessary_literal_unwrap)] +#![expect(clippy::unnecessary_literal_unwrap)] //@no-rustfix struct Deep(Option); diff --git a/tests/ui/unnecessary_literal_unwrap.fixed b/tests/ui/unnecessary_literal_unwrap.fixed index 05ffdeb1dcc5..96242b9a5ec2 100644 --- a/tests/ui/unnecessary_literal_unwrap.fixed +++ b/tests/ui/unnecessary_literal_unwrap.fixed @@ -1,10 +1,9 @@ #![warn(clippy::unnecessary_literal_unwrap)] -#![allow(unreachable_code)] #![allow( - clippy::unnecessary_lazy_evaluations, clippy::diverging_sub_expression, clippy::let_unit_value, - clippy::no_effect + clippy::no_effect, + clippy::unnecessary_lazy_evaluations )] fn unwrap_option_some() { diff --git a/tests/ui/unnecessary_literal_unwrap.rs b/tests/ui/unnecessary_literal_unwrap.rs index 5efefb24530b..a901f82c03d6 100644 --- a/tests/ui/unnecessary_literal_unwrap.rs +++ b/tests/ui/unnecessary_literal_unwrap.rs @@ -1,10 +1,9 @@ #![warn(clippy::unnecessary_literal_unwrap)] -#![allow(unreachable_code)] #![allow( - clippy::unnecessary_lazy_evaluations, clippy::diverging_sub_expression, clippy::let_unit_value, - clippy::no_effect + clippy::no_effect, + clippy::unnecessary_lazy_evaluations )] fn unwrap_option_some() { diff --git a/tests/ui/unnecessary_literal_unwrap.stderr b/tests/ui/unnecessary_literal_unwrap.stderr index 9c93f5a09bb0..fdad1ee060b9 100644 --- a/tests/ui/unnecessary_literal_unwrap.stderr +++ b/tests/ui/unnecessary_literal_unwrap.stderr @@ -1,5 +1,5 @@ error: used `unwrap()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:11:16 + --> tests/ui/unnecessary_literal_unwrap.rs:10:16 | LL | let _val = Some(1).unwrap(); | ^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _val = 1; | error: used `expect()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:13:16 + --> tests/ui/unnecessary_literal_unwrap.rs:12:16 | LL | let _val = Some(1).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _val = 1; | error: used `unwrap()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:16:5 + --> tests/ui/unnecessary_literal_unwrap.rs:15:5 | LL | Some(1).unwrap(); | ^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + 1; | error: used `expect()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:18:5 + --> tests/ui/unnecessary_literal_unwrap.rs:17:5 | LL | Some(1).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + 1; | error: used `unwrap()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:24:16 + --> tests/ui/unnecessary_literal_unwrap.rs:23:16 | LL | let _val = None::<()>.unwrap(); | ^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + let _val = panic!(); | error: used `expect()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:26:16 + --> tests/ui/unnecessary_literal_unwrap.rs:25:16 | LL | let _val = None::<()>.expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + let _val = panic!("this always happens"); | error: used `unwrap_or_default()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:28:24 + --> tests/ui/unnecessary_literal_unwrap.rs:27:24 | LL | let _val: String = None.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + let _val: String = String::default(); | error: used `unwrap_or()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:30:21 + --> tests/ui/unnecessary_literal_unwrap.rs:29:21 | LL | let _val: u16 = None.unwrap_or(234); | ^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + let _val: u16 = 234; | error: used `unwrap_or_else()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:32:21 + --> tests/ui/unnecessary_literal_unwrap.rs:31:21 | LL | let _val: u16 = None.unwrap_or_else(|| 234); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + let _val: u16 = 234; | error: used `unwrap_or_else()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:34:21 + --> tests/ui/unnecessary_literal_unwrap.rs:33:21 | LL | let _val: u16 = None.unwrap_or_else(|| { 234 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + let _val: u16 = { 234 }; | error: used `unwrap_or_else()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:36:21 + --> tests/ui/unnecessary_literal_unwrap.rs:35:21 | LL | let _val: u16 = None.unwrap_or_else(|| -> u16 { 234 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + let _val: u16 = { 234 }; | error: used `unwrap()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:39:5 + --> tests/ui/unnecessary_literal_unwrap.rs:38:5 | LL | None::<()>.unwrap(); | ^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + panic!(); | error: used `expect()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:41:5 + --> tests/ui/unnecessary_literal_unwrap.rs:40:5 | LL | None::<()>.expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL + panic!("this always happens"); | error: used `unwrap_or_default()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:43:5 + --> tests/ui/unnecessary_literal_unwrap.rs:42:5 | LL | None::.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + String::default(); | error: used `unwrap_or()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:45:5 + --> tests/ui/unnecessary_literal_unwrap.rs:44:5 | LL | None::.unwrap_or(234); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + 234; | error: used `unwrap_or_else()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:47:5 + --> tests/ui/unnecessary_literal_unwrap.rs:46:5 | LL | None::.unwrap_or_else(|| 234); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + 234; | error: used `unwrap_or_else()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:49:5 + --> tests/ui/unnecessary_literal_unwrap.rs:48:5 | LL | None::.unwrap_or_else(|| { 234 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL + { 234 }; | error: used `unwrap_or_else()` on `None` value - --> tests/ui/unnecessary_literal_unwrap.rs:51:5 + --> tests/ui/unnecessary_literal_unwrap.rs:50:5 | LL | None::.unwrap_or_else(|| -> u16 { 234 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -217,7 +217,7 @@ LL + { 234 }; | error: used `unwrap()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:56:16 + --> tests/ui/unnecessary_literal_unwrap.rs:55:16 | LL | let _val = Ok::<_, ()>(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL + let _val = 1; | error: used `expect()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:58:16 + --> tests/ui/unnecessary_literal_unwrap.rs:57:16 | LL | let _val = Ok::<_, ()>(1).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -241,7 +241,7 @@ LL + let _val = 1; | error: used `unwrap_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:60:16 + --> tests/ui/unnecessary_literal_unwrap.rs:59:16 | LL | let _val = Ok::<_, ()>(1).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL + let _val = panic!("{:?}", 1); | error: used `expect_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:62:16 + --> tests/ui/unnecessary_literal_unwrap.rs:61:16 | LL | let _val = Ok::<_, ()>(1).expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -265,7 +265,7 @@ LL + let _val = panic!("{1}: {:?}", 1, "this always happens"); | error: used `unwrap()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:65:5 + --> tests/ui/unnecessary_literal_unwrap.rs:64:5 | LL | Ok::<_, ()>(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -277,7 +277,7 @@ LL + 1; | error: used `expect()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:67:5 + --> tests/ui/unnecessary_literal_unwrap.rs:66:5 | LL | Ok::<_, ()>(1).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -289,7 +289,7 @@ LL + 1; | error: used `unwrap_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:69:5 + --> tests/ui/unnecessary_literal_unwrap.rs:68:5 | LL | Ok::<_, ()>(1).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -301,7 +301,7 @@ LL + panic!("{:?}", 1); | error: used `expect_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:71:5 + --> tests/ui/unnecessary_literal_unwrap.rs:70:5 | LL | Ok::<_, ()>(1).expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -313,7 +313,7 @@ LL + panic!("{1}: {:?}", 1, "this always happens"); | error: used `unwrap_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:76:16 + --> tests/ui/unnecessary_literal_unwrap.rs:75:16 | LL | let _val = Err::<(), _>(1).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL + let _val = 1; | error: used `expect_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:78:16 + --> tests/ui/unnecessary_literal_unwrap.rs:77:16 | LL | let _val = Err::<(), _>(1).expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -337,7 +337,7 @@ LL + let _val = 1; | error: used `unwrap()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:80:16 + --> tests/ui/unnecessary_literal_unwrap.rs:79:16 | LL | let _val = Err::<(), _>(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -349,7 +349,7 @@ LL + let _val = panic!("{:?}", 1); | error: used `expect()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:82:16 + --> tests/ui/unnecessary_literal_unwrap.rs:81:16 | LL | let _val = Err::<(), _>(1).expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -361,7 +361,7 @@ LL + let _val = panic!("{1}: {:?}", 1, "this always happens"); | error: used `unwrap_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:85:5 + --> tests/ui/unnecessary_literal_unwrap.rs:84:5 | LL | Err::<(), _>(1).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -373,7 +373,7 @@ LL + 1; | error: used `expect_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:87:5 + --> tests/ui/unnecessary_literal_unwrap.rs:86:5 | LL | Err::<(), _>(1).expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -385,7 +385,7 @@ LL + 1; | error: used `unwrap()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:89:5 + --> tests/ui/unnecessary_literal_unwrap.rs:88:5 | LL | Err::<(), _>(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -397,7 +397,7 @@ LL + panic!("{:?}", 1); | error: used `expect()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:91:5 + --> tests/ui/unnecessary_literal_unwrap.rs:90:5 | LL | Err::<(), _>(1).expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -409,7 +409,7 @@ LL + panic!("{1}: {:?}", 1, "this always happens"); | error: used `unwrap_or()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:96:16 + --> tests/ui/unnecessary_literal_unwrap.rs:95:16 | LL | let _val = Some(1).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^ @@ -421,7 +421,7 @@ LL + let _val = 1; | error: used `unwrap_or_default()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:98:16 + --> tests/ui/unnecessary_literal_unwrap.rs:97:16 | LL | let _val = Some(1).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -433,7 +433,7 @@ LL + let _val = 1; | error: used `unwrap_or_else()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:100:16 + --> tests/ui/unnecessary_literal_unwrap.rs:99:16 | LL | let _val = Some(1).unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -445,7 +445,7 @@ LL + let _val = 1; | error: used `unwrap_or()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:103:5 + --> tests/ui/unnecessary_literal_unwrap.rs:102:5 | LL | Some(1).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^ @@ -457,7 +457,7 @@ LL + 1; | error: used `unwrap_or_default()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:105:5 + --> tests/ui/unnecessary_literal_unwrap.rs:104:5 | LL | Some(1).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -469,7 +469,7 @@ LL + 1; | error: used `unwrap_or_else()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:107:5 + --> tests/ui/unnecessary_literal_unwrap.rs:106:5 | LL | Some(1).unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -481,7 +481,7 @@ LL + 1; | error: used `unwrap_or()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:112:16 + --> tests/ui/unnecessary_literal_unwrap.rs:111:16 | LL | let _val = Ok::<_, ()>(1).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -493,7 +493,7 @@ LL + let _val = 1; | error: used `unwrap_or_default()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:114:16 + --> tests/ui/unnecessary_literal_unwrap.rs:113:16 | LL | let _val = Ok::<_, ()>(1).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -505,7 +505,7 @@ LL + let _val = 1; | error: used `unwrap_or_else()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:116:16 + --> tests/ui/unnecessary_literal_unwrap.rs:115:16 | LL | let _val = Ok::<_, ()>(1).unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -517,7 +517,7 @@ LL + let _val = 1; | error: used `unwrap_or()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:119:5 + --> tests/ui/unnecessary_literal_unwrap.rs:118:5 | LL | Ok::<_, ()>(1).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -529,7 +529,7 @@ LL + 1; | error: used `unwrap_or_default()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:121:5 + --> tests/ui/unnecessary_literal_unwrap.rs:120:5 | LL | Ok::<_, ()>(1).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -541,7 +541,7 @@ LL + 1; | error: used `unwrap_or_else()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:123:5 + --> tests/ui/unnecessary_literal_unwrap.rs:122:5 | LL | Ok::<_, ()>(1).unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -553,7 +553,7 @@ LL + 1; | error: used `unwrap_unchecked()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:138:22 + --> tests/ui/unnecessary_literal_unwrap.rs:137:22 | LL | let _ = unsafe { Some(1).unwrap_unchecked() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -565,7 +565,7 @@ LL + let _ = 1; | error: used `unwrap_unchecked()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:140:22 + --> tests/ui/unnecessary_literal_unwrap.rs:139:22 | LL | let _ = unsafe { Some(1).unwrap_unchecked() + *(&1 as *const i32) }; // needs to keep the unsafe block | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -577,7 +577,7 @@ LL + let _ = unsafe { 1 + *(&1 as *const i32) }; // needs to keep the unsafe | error: used `unwrap_unchecked()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap.rs:143:22 + --> tests/ui/unnecessary_literal_unwrap.rs:142:22 | LL | let _ = unsafe { Some(1).unwrap_unchecked() } + 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -589,7 +589,7 @@ LL + let _ = 1 + 1; | error: used `unwrap_unchecked()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:145:22 + --> tests/ui/unnecessary_literal_unwrap.rs:144:22 | LL | let _ = unsafe { Ok::<_, ()>(1).unwrap_unchecked() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -601,7 +601,7 @@ LL + let _ = 1; | error: used `unwrap_unchecked()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:147:22 + --> tests/ui/unnecessary_literal_unwrap.rs:146:22 | LL | let _ = unsafe { Ok::<_, ()>(1).unwrap_unchecked() + *(&1 as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -613,7 +613,7 @@ LL + let _ = unsafe { 1 + *(&1 as *const i32) }; | error: used `unwrap_unchecked()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap.rs:149:22 + --> tests/ui/unnecessary_literal_unwrap.rs:148:22 | LL | let _ = unsafe { Ok::<_, ()>(1).unwrap_unchecked() } + 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -625,7 +625,7 @@ LL + let _ = 1 + 1; | error: used `unwrap_err_unchecked()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap.rs:151:22 + --> tests/ui/unnecessary_literal_unwrap.rs:150:22 | LL | let _ = unsafe { Err::<(), i32>(123).unwrap_err_unchecked() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_literal_unwrap_unfixable.rs b/tests/ui/unnecessary_literal_unwrap_unfixable.rs index 2680d0a6697b..cd47d96f1c1e 100644 --- a/tests/ui/unnecessary_literal_unwrap_unfixable.rs +++ b/tests/ui/unnecessary_literal_unwrap_unfixable.rs @@ -1,6 +1,5 @@ #![warn(clippy::unnecessary_literal_unwrap)] -#![allow(unreachable_code)] -#![allow(clippy::unnecessary_lazy_evaluations, clippy::let_unit_value)] +#![expect(clippy::let_unit_value, clippy::unnecessary_lazy_evaluations)] //@no-rustfix fn unwrap_option_some() { let val = Some(1); diff --git a/tests/ui/unnecessary_literal_unwrap_unfixable.stderr b/tests/ui/unnecessary_literal_unwrap_unfixable.stderr index 39418d0e3a96..278bbefd678d 100644 --- a/tests/ui/unnecessary_literal_unwrap_unfixable.stderr +++ b/tests/ui/unnecessary_literal_unwrap_unfixable.stderr @@ -1,11 +1,11 @@ error: used `unwrap()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:7:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:6:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `Some` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:6:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:5:15 | LL | let val = Some(1); | ^^^^^^^ @@ -13,91 +13,91 @@ LL | let val = Some(1); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_literal_unwrap)]` error: used `expect()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:10:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:9:17 | LL | let _val2 = val.expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:6:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:5:15 | LL | let val = Some(1); | ^^^^^^^ error: used `unwrap()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:15:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:14:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:15:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:14:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:18:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:17:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:18:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:17:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:22:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:21:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `Some` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:21:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:20:15 | LL | let val = Some::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:25:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:24:17 | LL | let _val2 = val.expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:21:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:20:15 | LL | let val = Some::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap()` on `None` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:31:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:30:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `None` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:30:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:29:15 | LL | let val = None::<()>; | ^^^^^^^^^^ error: used `expect()` on `None` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:34:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:33:17 | LL | let _val2 = val.expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `None` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:30:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:29:15 | LL | let val = None::<()>; | ^^^^^^^^^^ error: used `unwrap_or_default()` on `None` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:37:21 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:36:21 | LL | let _val3: u8 = None.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + let _val3: u8 = Default::default(); | error: used `unwrap_or_default()` on `None` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:40:5 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:39:5 | LL | None::<()>.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,505 +121,505 @@ LL + Default::default(); | error: used `unwrap()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:46:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:45:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:45:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:44:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `expect()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:49:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:48:17 | LL | let _val2 = val.expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:45:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:44:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `unwrap_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:52:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:51:17 | LL | let _val2 = val.unwrap_err(); | ^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:45:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:44:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `expect_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:55:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:54:17 | LL | let _val2 = val.expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:45:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:44:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `unwrap()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:60:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:59:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:60:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:59:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:63:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:62:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:63:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:62:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:66:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:65:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:66:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:65:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:69:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:68:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:69:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:68:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:73:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:72:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:72:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:71:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:76:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:75:17 | LL | let _val2 = val.expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:72:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:71:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:79:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:78:17 | LL | let _val2 = val.unwrap_err(); | ^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:72:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:71:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect_err()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:82:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:81:17 | LL | let _val2 = val.expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:72:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:71:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:88:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:87:17 | LL | let _val2 = val.unwrap_err(); | ^^^^^^^^^^^^^^^^ | help: remove the `Err` and `unwrap_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:87:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:86:15 | LL | let val = Err::<(), _>(1); | ^^^^^^^^^^^^^^^ error: used `expect_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:91:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:90:17 | LL | let _val2 = val.expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:87:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:86:15 | LL | let val = Err::<(), _>(1); | ^^^^^^^^^^^^^^^ error: used `unwrap()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:94:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:93:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `Err` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:87:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:86:15 | LL | let val = Err::<(), _>(1); | ^^^^^^^^^^^^^^^ error: used `expect()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:97:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:96:17 | LL | let _val2 = val.expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:87:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:86:15 | LL | let val = Err::<(), _>(1); | ^^^^^^^^^^^^^^^ error: used `unwrap_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:102:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:101:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `unwrap_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:102:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:101:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:105:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:104:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:105:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:104:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:108:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:107:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:108:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:107:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:111:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:110:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:111:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:110:16 | LL | let _val = Err::<(), usize>([1, 2, 3].iter().sum()).expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:115:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:114:17 | LL | let _val2 = val.unwrap_err(); | ^^^^^^^^^^^^^^^^ | help: remove the `Err` and `unwrap_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:114:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:113:15 | LL | let val = Err::<(), usize>([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect_err()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:118:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:117:17 | LL | let _val2 = val.expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect_err()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:114:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:113:15 | LL | let val = Err::<(), usize>([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:121:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:120:17 | LL | let _val2 = val.unwrap(); | ^^^^^^^^^^^^ | help: remove the `Err` and `unwrap()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:114:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:113:15 | LL | let val = Err::<(), usize>([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `expect()` on `Err` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:124:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:123:17 | LL | let _val2 = val.expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:114:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:113:15 | LL | let val = Err::<(), usize>([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:130:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:129:17 | LL | let _val2 = val.unwrap_or(2); | ^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:129:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:128:15 | LL | let val = Some(1); | ^^^^^^^ error: used `unwrap_or_default()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:133:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:132:17 | LL | let _val2 = val.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_default()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:129:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:128:15 | LL | let val = Some(1); | ^^^^^^^ error: used `unwrap_or_else()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:136:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:135:17 | LL | let _val2 = val.unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_else()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:129:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:128:15 | LL | let val = Some(1); | ^^^^^^^ error: used `unwrap_or()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:141:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:140:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:141:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:140:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_default()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:144:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:143:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_default()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:144:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:143:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_else()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:147:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:146:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_else()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:147:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:146:16 | LL | let _val = Some::([1, 2, 3].iter().sum()).unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:151:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:150:17 | LL | let _val2 = val.unwrap_or(2); | ^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:150:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:149:15 | LL | let val = Some::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_default()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:154:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:153:17 | LL | let _val2 = val.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_default()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:150:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:149:15 | LL | let val = Some::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_else()` on `Some` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:157:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:156:17 | LL | let _val2 = val.unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_else()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:150:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:149:15 | LL | let val = Some::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:163:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:162:17 | LL | let _val2 = val.unwrap_or(2); | ^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:162:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:161:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `unwrap_or_default()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:166:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:165:17 | LL | let _val2 = val.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_default()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:162:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:161:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `unwrap_or_else()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:169:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:168:17 | LL | let _val2 = val.unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_else()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:162:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:161:15 | LL | let val = Ok::<_, ()>(1); | ^^^^^^^^^^^^^^ error: used `unwrap_or()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:174:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:173:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:174:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:173:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_default()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:177:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:176:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_default()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:177:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:176:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_else()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:180:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:179:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_else()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:180:16 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:179:16 | LL | let _val = Ok::([1, 2, 3].iter().sum()).unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:184:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:183:17 | LL | let _val2 = val.unwrap_or(2); | ^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:183:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:182:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_default()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:187:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:186:17 | LL | let _val2 = val.unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_default()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:183:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:182:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: used `unwrap_or_else()` on `Ok` value - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:190:17 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:189:17 | LL | let _val2 = val.unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_else()` - --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:183:15 + --> tests/ui/unnecessary_literal_unwrap_unfixable.rs:182:15 | LL | let val = Ok::([1, 2, 3].iter().sum()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_map_on_constructor.fixed b/tests/ui/unnecessary_map_on_constructor.fixed index 4452fda38c40..9e6059808d3c 100644 --- a/tests/ui/unnecessary_map_on_constructor.fixed +++ b/tests/ui/unnecessary_map_on_constructor.fixed @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::unnecessary_map_on_constructor)] use std::ffi::OsStr; diff --git a/tests/ui/unnecessary_map_on_constructor.rs b/tests/ui/unnecessary_map_on_constructor.rs index 0cd41f2b363a..d731fc13e291 100644 --- a/tests/ui/unnecessary_map_on_constructor.rs +++ b/tests/ui/unnecessary_map_on_constructor.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::unnecessary_map_on_constructor)] use std::ffi::OsStr; diff --git a/tests/ui/unnecessary_map_on_constructor.stderr b/tests/ui/unnecessary_map_on_constructor.stderr index a19116820808..4e31d4f6bc8d 100644 --- a/tests/ui/unnecessary_map_on_constructor.stderr +++ b/tests/ui/unnecessary_map_on_constructor.stderr @@ -1,5 +1,5 @@ error: unnecessary `map` on constructor `Some(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:32:13 + --> tests/ui/unnecessary_map_on_constructor.rs:31:13 | LL | let a = Some(x).map(fun); | ^^^^^^^^^^^^^^^^ help: try: `Some(fun(x))` @@ -8,43 +8,43 @@ LL | let a = Some(x).map(fun); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_on_constructor)]` error: unnecessary `map` on constructor `Ok(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:34:27 + --> tests/ui/unnecessary_map_on_constructor.rs:33:27 | LL | let b: SimpleResult = Ok(x).map(fun); | ^^^^^^^^^^^^^^ help: try: `Ok(fun(x))` error: unnecessary `map_err` on constructor `Err(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:36:27 + --> tests/ui/unnecessary_map_on_constructor.rs:35:27 | LL | let c: SimpleResult = Err(err).map_err(notfun); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Err(notfun(err))` error: unnecessary `map` on constructor `Option::Some(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:39:13 + --> tests/ui/unnecessary_map_on_constructor.rs:38:13 | LL | let a = Option::Some(x).map(fun); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option::Some(fun(x))` error: unnecessary `map` on constructor `SimpleResult::Ok(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:41:27 + --> tests/ui/unnecessary_map_on_constructor.rs:40:27 | LL | let b: SimpleResult = SimpleResult::Ok(x).map(fun); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `SimpleResult::Ok(fun(x))` error: unnecessary `map_err` on constructor `SimpleResult::Err(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:43:27 + --> tests/ui/unnecessary_map_on_constructor.rs:42:27 | LL | let c: SimpleResult = SimpleResult::Err(err).map_err(notfun); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `SimpleResult::Err(notfun(err))` error: unnecessary `map` on constructor `Ok(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:45:52 + --> tests/ui/unnecessary_map_on_constructor.rs:44:52 | LL | let b: std::result::Result = Ok(x).map(fun); | ^^^^^^^^^^^^^^ help: try: `Ok(fun(x))` error: unnecessary `map_err` on constructor `Err(_)` - --> tests/ui/unnecessary_map_on_constructor.rs:47:52 + --> tests/ui/unnecessary_map_on_constructor.rs:46:52 | LL | let c: std::result::Result = Err(err).map_err(notfun); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Err(notfun(err))` diff --git a/tests/ui/unnecessary_map_or.fixed b/tests/ui/unnecessary_map_or.fixed index b1f991b9b26c..bc62bb560044 100644 --- a/tests/ui/unnecessary_map_or.fixed +++ b/tests/ui/unnecessary_map_or.fixed @@ -1,12 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::unnecessary_map_or)] -#![allow( - clippy::no_effect, - clippy::eq_op, - clippy::unnecessary_lazy_evaluations, - clippy::nonminimal_bool, - clippy::manual_assert_eq -)] +#![expect(clippy::eq_op, clippy::unnecessary_lazy_evaluations)] #[clippy::msrv = "1.70.0"] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unnecessary_map_or.rs b/tests/ui/unnecessary_map_or.rs index edd5ea9d878f..bb4b116b6aff 100644 --- a/tests/ui/unnecessary_map_or.rs +++ b/tests/ui/unnecessary_map_or.rs @@ -1,12 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::unnecessary_map_or)] -#![allow( - clippy::no_effect, - clippy::eq_op, - clippy::unnecessary_lazy_evaluations, - clippy::nonminimal_bool, - clippy::manual_assert_eq -)] +#![expect(clippy::eq_op, clippy::unnecessary_lazy_evaluations)] #[clippy::msrv = "1.70.0"] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unnecessary_map_or.stderr b/tests/ui/unnecessary_map_or.stderr index 12a973c84213..355b5c6a7b5f 100644 --- a/tests/ui/unnecessary_map_or.stderr +++ b/tests/ui/unnecessary_map_or.stderr @@ -1,5 +1,5 @@ error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:16:13 + --> tests/ui/unnecessary_map_or.rs:10:13 | LL | let _ = Some(5).map_or(false, |n| n == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _ = Some(5) == Some(5); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:18:13 + --> tests/ui/unnecessary_map_or.rs:12:13 | LL | let _ = Some(5).map_or(true, |n| n != 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = Some(5) != Some(5); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:20:13 + --> tests/ui/unnecessary_map_or.rs:14:13 | LL | let _ = Some(5).map_or(false, |n| { | _____________^ @@ -46,7 +46,7 @@ LL + let _ = Some(5) == Some(5); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:25:13 + --> tests/ui/unnecessary_map_or.rs:19:13 | LL | let _ = Some(5).map_or(false, |n| { | _____________^ @@ -63,7 +63,7 @@ LL + let _ = Some(5).is_some_and(|n| { | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:30:13 + --> tests/ui/unnecessary_map_or.rs:24:13 | LL | let _ = Some(vec![5]).map_or(false, |n| n == [5]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +75,7 @@ LL + let _ = Some(vec![5]).is_some_and(|n| n == [5]); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:32:13 + --> tests/ui/unnecessary_map_or.rs:26:13 | LL | let _ = Some(vec![1]).map_or(false, |n| vec![2] == n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL + let _ = Some(vec![1]).is_some_and(|n| vec![2] == n); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:34:13 + --> tests/ui/unnecessary_map_or.rs:28:13 | LL | let _ = Some(5).map_or(false, |n| n == n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL + let _ = Some(5).is_some_and(|n| n == n); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:36:13 + --> tests/ui/unnecessary_map_or.rs:30:13 | LL | let _ = Some(5).map_or(false, |n| n == if 2 > 1 { n } else { 0 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL + let _ = Some(5).is_some_and(|n| n == if 2 > 1 { n } else { 0 }); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:38:13 + --> tests/ui/unnecessary_map_or.rs:32:13 | LL | let _ = Ok::, i32>(vec![5]).map_or(false, |n| n == [5]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL + let _ = Ok::, i32>(vec![5]).is_ok_and(|n| n == [5]); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:40:13 + --> tests/ui/unnecessary_map_or.rs:34:13 | LL | let _ = Ok::(5).map_or(false, |n| n == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ LL + let _ = Ok::(5) == Ok(5); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:42:13 + --> tests/ui/unnecessary_map_or.rs:36:13 | LL | let _ = Some(5).map_or(false, |n| n == 5).then(|| 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -147,7 +147,7 @@ LL + let _ = (Some(5) == Some(5)).then(|| 1); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:44:13 + --> tests/ui/unnecessary_map_or.rs:38:13 | LL | let _ = Some(5).map_or(true, |n| n == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ LL + let _ = Some(5).is_none_or(|n| n == 5); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:46:13 + --> tests/ui/unnecessary_map_or.rs:40:13 | LL | let _ = Some(5).map_or(true, |n| 5 == n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,7 +171,7 @@ LL + let _ = Some(5).is_none_or(|n| 5 == n); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:48:14 + --> tests/ui/unnecessary_map_or.rs:42:14 | LL | let _ = !Some(5).map_or(false, |n| n == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ LL + let _ = !(Some(5) == Some(5)); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:50:13 + --> tests/ui/unnecessary_map_or.rs:44:13 | LL | let _ = Some(5).map_or(false, |n| n == 5) || false; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -195,7 +195,7 @@ LL + let _ = (Some(5) == Some(5)) || false; | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:52:13 + --> tests/ui/unnecessary_map_or.rs:46:13 | LL | let _ = Some(5).map_or(false, |n| n == 5) as usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -207,7 +207,7 @@ LL + let _ = (Some(5) == Some(5)) as usize; | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:77:13 + --> tests/ui/unnecessary_map_or.rs:71:13 | LL | let _ = r.map_or(false, |x| x == 7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -219,7 +219,7 @@ LL + let _ = r.is_ok_and(|x| x == 7); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:83:13 + --> tests/ui/unnecessary_map_or.rs:77:13 | LL | let _ = r.map_or(false, func); | ^^^^^^^^^^^^^^^^^^^^^ @@ -231,7 +231,7 @@ LL + let _ = r.is_ok_and(func); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:85:13 + --> tests/ui/unnecessary_map_or.rs:79:13 | LL | let _ = Some(5).map_or(false, func); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -243,7 +243,7 @@ LL + let _ = Some(5).is_some_and(func); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:87:13 + --> tests/ui/unnecessary_map_or.rs:81:13 | LL | let _ = Some(5).map_or(true, func); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -255,7 +255,7 @@ LL + let _ = Some(5).is_none_or(func); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:93:13 + --> tests/ui/unnecessary_map_or.rs:87:13 | LL | let _ = r.map_or(false, |x| x == 8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -267,7 +267,7 @@ LL + let _ = r == Ok(8); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:114:5 + --> tests/ui/unnecessary_map_or.rs:108:5 | LL | o.map_or(true, |n| n > 5) || (o as &Option).map_or(true, |n| n < 5) | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -279,7 +279,7 @@ LL + o.is_none_or(|n| n > 5) || (o as &Option).map_or(true, |n| n < 5) | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:114:34 + --> tests/ui/unnecessary_map_or.rs:108:34 | LL | o.map_or(true, |n| n > 5) || (o as &Option).map_or(true, |n| n < 5) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -291,7 +291,7 @@ LL + o.map_or(true, |n| n > 5) || (o as &Option).is_none_or(|n| n < 5) | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:129:5 + --> tests/ui/unnecessary_map_or.rs:123:5 | LL | o.map_or(true, |n| n > 5) | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -303,7 +303,7 @@ LL + o.is_none_or(|n| n > 5) | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:134:13 + --> tests/ui/unnecessary_map_or.rs:128:13 | LL | let x = a.map_or(false, |a| a == *s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -315,7 +315,7 @@ LL + let x = a.is_some_and(|a| a == *s); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:136:13 + --> tests/ui/unnecessary_map_or.rs:130:13 | LL | let y = b.map_or(true, |b| b == *s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ LL + let y = b.is_none_or(|b| b == *s); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:142:13 + --> tests/ui/unnecessary_map_or.rs:136:13 | LL | assert!(Some("test").map_or(false, |x| x == "test")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -339,7 +339,7 @@ LL + assert!(Some("test") == Some("test")); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:146:13 + --> tests/ui/unnecessary_map_or.rs:140:13 | LL | assert!(Some("test").map_or(false, |x| x == "test").then(|| 1).is_some()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -351,7 +351,7 @@ LL + assert!((Some("test") == Some("test")).then(|| 1).is_some()); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:163:9 + --> tests/ui/unnecessary_map_or.rs:157:9 | LL | _ = s.lock().unwrap().map_or(false, |s| s == "foo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -363,7 +363,7 @@ LL + _ = s.lock().unwrap().is_some_and(|s| s == "foo"); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:167:9 + --> tests/ui/unnecessary_map_or.rs:161:9 | LL | _ = s.map_or(false, |s| s == "foo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_min_or_max.fixed b/tests/ui/unnecessary_min_or_max.fixed index e2e1700e28b9..fd6f136e99e5 100644 --- a/tests/ui/unnecessary_min_or_max.fixed +++ b/tests/ui/unnecessary_min_or_max.fixed @@ -1,8 +1,7 @@ //@aux-build:external_consts.rs -#![allow(unused)] #![warn(clippy::unnecessary_min_or_max)] -#![allow(clippy::identity_op)] +#![expect(clippy::identity_op)] extern crate external_consts; diff --git a/tests/ui/unnecessary_min_or_max.rs b/tests/ui/unnecessary_min_or_max.rs index dd71ee208030..a1aede84cd93 100644 --- a/tests/ui/unnecessary_min_or_max.rs +++ b/tests/ui/unnecessary_min_or_max.rs @@ -1,8 +1,7 @@ //@aux-build:external_consts.rs -#![allow(unused)] #![warn(clippy::unnecessary_min_or_max)] -#![allow(clippy::identity_op)] +#![expect(clippy::identity_op)] extern crate external_consts; diff --git a/tests/ui/unnecessary_min_or_max.stderr b/tests/ui/unnecessary_min_or_max.stderr index b391d21d3bf4..e23450ec2a68 100644 --- a/tests/ui/unnecessary_min_or_max.stderr +++ b/tests/ui/unnecessary_min_or_max.stderr @@ -1,5 +1,5 @@ error: `(-6_i32)` is never greater than `9` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:13:13 + --> tests/ui/unnecessary_min_or_max.rs:12:13 | LL | let _ = (-6_i32).min(9); | ^^^^^^^^^^^^^^^ help: try: `(-6_i32)` @@ -8,145 +8,145 @@ LL | let _ = (-6_i32).min(9); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_min_or_max)]` error: `(-6_i32)` is never greater than `9` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:15:13 + --> tests/ui/unnecessary_min_or_max.rs:14:13 | LL | let _ = (-6_i32).max(9); | ^^^^^^^^^^^^^^^ help: try: `9` error: `9_u32` is never smaller than `6` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:17:13 + --> tests/ui/unnecessary_min_or_max.rs:16:13 | LL | let _ = 9_u32.min(6); | ^^^^^^^^^^^^ help: try: `6` error: `9_u32` is never smaller than `6` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:19:13 + --> tests/ui/unnecessary_min_or_max.rs:18:13 | LL | let _ = 9_u32.max(6); | ^^^^^^^^^^^^ help: try: `9_u32` error: `6` is never greater than `7_u8` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:21:13 + --> tests/ui/unnecessary_min_or_max.rs:20:13 | LL | let _ = 6.min(7_u8); | ^^^^^^^^^^^ help: try: `6` error: `6` is never greater than `7_u8` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:23:13 + --> tests/ui/unnecessary_min_or_max.rs:22:13 | LL | let _ = 6.max(7_u8); | ^^^^^^^^^^^ help: try: `7_u8` error: `0` is never greater than `x` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:28:13 + --> tests/ui/unnecessary_min_or_max.rs:27:13 | LL | let _ = 0.min(x); | ^^^^^^^^ help: try: `0` error: `0` is never greater than `x` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:30:13 + --> tests/ui/unnecessary_min_or_max.rs:29:13 | LL | let _ = 0.max(x); | ^^^^^^^^ help: try: `x` error: `x` is never smaller than `0_u32` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:32:13 + --> tests/ui/unnecessary_min_or_max.rs:31:13 | LL | let _ = x.min(0_u32); | ^^^^^^^^^^^^ help: try: `0_u32` error: `x` is never smaller than `0_u32` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:34:13 + --> tests/ui/unnecessary_min_or_max.rs:33:13 | LL | let _ = x.max(0_u32); | ^^^^^^^^^^^^ help: try: `x` error: `i32::MIN` is never greater than `x` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:39:13 + --> tests/ui/unnecessary_min_or_max.rs:38:13 | LL | let _ = i32::MIN.min(x); | ^^^^^^^^^^^^^^^ help: try: `i32::MIN` error: `i32::MIN` is never greater than `x` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:41:13 + --> tests/ui/unnecessary_min_or_max.rs:40:13 | LL | let _ = i32::MIN.max(x); | ^^^^^^^^^^^^^^^ help: try: `x` error: `x` is never smaller than `i32::MIN` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:43:13 + --> tests/ui/unnecessary_min_or_max.rs:42:13 | LL | let _ = x.min(i32::MIN); | ^^^^^^^^^^^^^^^ help: try: `i32::MIN` error: `x` is never smaller than `i32::MIN` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:45:13 + --> tests/ui/unnecessary_min_or_max.rs:44:13 | LL | let _ = x.max(i32::MIN); | ^^^^^^^^^^^^^^^ help: try: `x` error: `x` is never smaller than `i32::MIN - 0` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:48:13 + --> tests/ui/unnecessary_min_or_max.rs:47:13 | LL | let _ = x.min(i32::MIN - 0); | ^^^^^^^^^^^^^^^^^^^ help: try: `i32::MIN - 0` error: `x` is never smaller than `i32::MIN` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:50:13 + --> tests/ui/unnecessary_min_or_max.rs:49:13 | LL | let _ = x.max(i32::MIN); | ^^^^^^^^^^^^^^^ help: try: `x` error: `x` is never smaller than `i32::MIN - 0` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:53:13 + --> tests/ui/unnecessary_min_or_max.rs:52:13 | LL | let _ = x.min(i32::MIN - 0); | ^^^^^^^^^^^^^^^^^^^ help: try: `i32::MIN - 0` error: `n` is never smaller than `0` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:83:13 + --> tests/ui/unnecessary_min_or_max.rs:82:13 | LL | let _ = n.min(0); | ^^^^^^^^ help: try: `0` error: `n` is never smaller than `0usize` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:86:13 + --> tests/ui/unnecessary_min_or_max.rs:85:13 | LL | let _ = n.min(0usize); | ^^^^^^^^^^^^^ help: try: `0usize` error: `(0usize)` is never greater than `n` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:89:13 + --> tests/ui/unnecessary_min_or_max.rs:88:13 | LL | let _ = (0usize).min(n); | ^^^^^^^^^^^^^^^ help: try: `(0usize)` error: `n` is never smaller than `usize::MIN` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:92:13 + --> tests/ui/unnecessary_min_or_max.rs:91:13 | LL | let _ = n.min(usize::MIN); | ^^^^^^^^^^^^^^^^^ help: try: `usize::MIN` error: `n` is never greater than `usize::MAX` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:95:13 + --> tests/ui/unnecessary_min_or_max.rs:94:13 | LL | let _ = n.max(usize::MAX); | ^^^^^^^^^^^^^^^^^ help: try: `usize::MAX` error: `(usize::MAX)` is never smaller than `n` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:98:13 + --> tests/ui/unnecessary_min_or_max.rs:97:13 | LL | let _ = (usize::MAX).max(n); | ^^^^^^^^^^^^^^^^^^^ help: try: `(usize::MAX)` error: `n` is never greater than `!0usize` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:101:13 + --> tests/ui/unnecessary_min_or_max.rs:100:13 | LL | let _ = n.max(!0usize); | ^^^^^^^^^^^^^^ help: try: `!0usize` error: `n` is never smaller than `0` and has therefore no effect - --> tests/ui/unnecessary_min_or_max.rs:104:13 + --> tests/ui/unnecessary_min_or_max.rs:103:13 | LL | let _ = n.max(0); | ^^^^^^^^ help: try: `n` diff --git a/tests/ui/unnecessary_mut_passed.fixed b/tests/ui/unnecessary_mut_passed.fixed index 876b61d29519..7fff62b9e938 100644 --- a/tests/ui/unnecessary_mut_passed.fixed +++ b/tests/ui/unnecessary_mut_passed.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::mut_mut)] +#![warn(clippy::unnecessary_mut_passed)] +#![expect(clippy::mut_mut)] fn takes_ref(a: &i32) {} fn takes_refmut(a: &mut i32) {} diff --git a/tests/ui/unnecessary_mut_passed.rs b/tests/ui/unnecessary_mut_passed.rs index e92368bfffeb..9beb4851db61 100644 --- a/tests/ui/unnecessary_mut_passed.rs +++ b/tests/ui/unnecessary_mut_passed.rs @@ -1,4 +1,5 @@ -#![allow(clippy::mut_mut)] +#![warn(clippy::unnecessary_mut_passed)] +#![expect(clippy::mut_mut)] fn takes_ref(a: &i32) {} fn takes_refmut(a: &mut i32) {} diff --git a/tests/ui/unnecessary_mut_passed.stderr b/tests/ui/unnecessary_mut_passed.stderr index ace11027e3e2..ff379d2132cf 100644 --- a/tests/ui/unnecessary_mut_passed.stderr +++ b/tests/ui/unnecessary_mut_passed.stderr @@ -1,5 +1,5 @@ error: the function `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:57:15 + --> tests/ui/unnecessary_mut_passed.rs:58:15 | LL | takes_ref(&mut 42); | ^^^^^^^ @@ -13,7 +13,7 @@ LL + takes_ref(&42); | error: the function `takes_ref_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:59:19 + --> tests/ui/unnecessary_mut_passed.rs:60:19 | LL | takes_ref_ref(&mut &42); | ^^^^^^^^ @@ -25,7 +25,7 @@ LL + takes_ref_ref(&&42); | error: the function `takes_ref_refmut` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:61:22 + --> tests/ui/unnecessary_mut_passed.rs:62:22 | LL | takes_ref_refmut(&mut &mut 42); | ^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + takes_ref_refmut(&&mut 42); | error: the function `takes_raw_const` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:63:21 + --> tests/ui/unnecessary_mut_passed.rs:64:21 | LL | takes_raw_const(&mut 42); | ^^^^^^^ @@ -49,7 +49,7 @@ LL + takes_raw_const(&42); | error: the function `as_ptr` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:67:12 + --> tests/ui/unnecessary_mut_passed.rs:68:12 | LL | as_ptr(&mut 42); | ^^^^^^^ @@ -61,7 +61,7 @@ LL + as_ptr(&42); | error: the function `as_ptr` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:70:12 + --> tests/ui/unnecessary_mut_passed.rs:71:12 | LL | as_ptr(&mut &42); | ^^^^^^^^ @@ -73,7 +73,7 @@ LL + as_ptr(&&42); | error: the function `as_ptr` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:73:12 + --> tests/ui/unnecessary_mut_passed.rs:74:12 | LL | as_ptr(&mut &mut 42); | ^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + as_ptr(&&mut 42); | error: the function `as_ptr` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:76:12 + --> tests/ui/unnecessary_mut_passed.rs:77:12 | LL | as_ptr(&mut 42); | ^^^^^^^ @@ -97,7 +97,7 @@ LL + as_ptr(&42); | error: the method `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:81:25 + --> tests/ui/unnecessary_mut_passed.rs:82:25 | LL | my_struct.takes_ref(&mut 42); | ^^^^^^^ @@ -109,7 +109,7 @@ LL + my_struct.takes_ref(&42); | error: the method `takes_ref_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:83:29 + --> tests/ui/unnecessary_mut_passed.rs:84:29 | LL | my_struct.takes_ref_ref(&mut &42); | ^^^^^^^^ @@ -121,7 +121,7 @@ LL + my_struct.takes_ref_ref(&&42); | error: the method `takes_ref_refmut` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:85:32 + --> tests/ui/unnecessary_mut_passed.rs:86:32 | LL | my_struct.takes_ref_refmut(&mut &mut 42); | ^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + my_struct.takes_ref_refmut(&&mut 42); | error: the method `takes_raw_const` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:87:31 + --> tests/ui/unnecessary_mut_passed.rs:88:31 | LL | my_struct.takes_raw_const(&mut 42); | ^^^^^^^ @@ -145,7 +145,7 @@ LL + my_struct.takes_raw_const(&42); | error: the method `takes_nothing` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:175:5 + --> tests/ui/unnecessary_mut_passed.rs:176:5 | LL | (&mut my_struct).takes_nothing(); | ^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL + (&my_struct).takes_nothing(); | error: the method `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:180:5 + --> tests/ui/unnecessary_mut_passed.rs:181:5 | LL | (&mut my_struct).takes_ref(&mut 42); | ^^^^^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + (&my_struct).takes_ref(&mut 42); | error: the method `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:180:32 + --> tests/ui/unnecessary_mut_passed.rs:181:32 | LL | (&mut my_struct).takes_ref(&mut 42); | ^^^^^^^ @@ -181,7 +181,7 @@ LL + (&mut my_struct).takes_ref(&42); | error: the method `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:184:5 + --> tests/ui/unnecessary_mut_passed.rs:185:5 | LL | (&mut my_struct).takes_ref((&mut 42)); | ^^^^^^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + (&my_struct).takes_ref((&mut 42)); | error: the method `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:184:32 + --> tests/ui/unnecessary_mut_passed.rs:185:32 | LL | (&mut my_struct).takes_ref((&mut 42)); | ^^^^^^^^^ @@ -205,7 +205,7 @@ LL + (&mut my_struct).takes_ref((&42)); | error: the method `takes_ref` doesn't need a mutable reference - --> tests/ui/unnecessary_mut_passed.rs:188:25 + --> tests/ui/unnecessary_mut_passed.rs:189:25 | LL | my_struct.takes_ref((&mut 42)); | ^^^^^^^^^ diff --git a/tests/ui/unnecessary_operation.fixed b/tests/ui/unnecessary_operation.fixed index db5409bc491e..960a208ded97 100644 --- a/tests/ui/unnecessary_operation.fixed +++ b/tests/ui/unnecessary_operation.fixed @@ -1,12 +1,5 @@ -#![allow( - clippy::deref_addrof, - clippy::no_effect, - clippy::uninlined_format_args, - clippy::unnecessary_struct_initialization, - dead_code, - unused -)] #![warn(clippy::unnecessary_operation)] +#![allow(clippy::deref_addrof, clippy::no_effect)] use std::fmt::Display; use std::ops::Shl; diff --git a/tests/ui/unnecessary_operation.rs b/tests/ui/unnecessary_operation.rs index a3e6c6288ada..c9150a80a9da 100644 --- a/tests/ui/unnecessary_operation.rs +++ b/tests/ui/unnecessary_operation.rs @@ -1,12 +1,5 @@ -#![allow( - clippy::deref_addrof, - clippy::no_effect, - clippy::uninlined_format_args, - clippy::unnecessary_struct_initialization, - dead_code, - unused -)] #![warn(clippy::unnecessary_operation)] +#![allow(clippy::deref_addrof, clippy::no_effect)] use std::fmt::Display; use std::ops::Shl; diff --git a/tests/ui/unnecessary_operation.stderr b/tests/ui/unnecessary_operation.stderr index 3439ba2e33e5..f814b7e8af5d 100644 --- a/tests/ui/unnecessary_operation.stderr +++ b/tests/ui/unnecessary_operation.stderr @@ -1,5 +1,5 @@ error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:71:5 + --> tests/ui/unnecessary_operation.rs:64:5 | LL | Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` @@ -8,103 +8,103 @@ LL | Tuple(get_number()); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_operation)]` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:73:5 + --> tests/ui/unnecessary_operation.rs:66:5 | LL | Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:75:5 + --> tests/ui/unnecessary_operation.rs:68:5 | LL | Struct { ..get_struct() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_struct();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:77:5 + --> tests/ui/unnecessary_operation.rs:70:5 | LL | Enum::Tuple(get_number()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:79:5 + --> tests/ui/unnecessary_operation.rs:72:5 | LL | Enum::Struct { field: get_number() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:81:5 + --> tests/ui/unnecessary_operation.rs:74:5 | LL | 5 + get_number(); | ^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5; get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:83:5 + --> tests/ui/unnecessary_operation.rs:76:5 | LL | *&get_number(); | ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:85:5 + --> tests/ui/unnecessary_operation.rs:78:5 | LL | &get_number(); | ^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:87:5 + --> tests/ui/unnecessary_operation.rs:80:5 | LL | (5, 6, get_number()); | ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5; 6; get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:89:5 + --> tests/ui/unnecessary_operation.rs:82:5 | LL | get_number()..; | ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:91:5 + --> tests/ui/unnecessary_operation.rs:84:5 | LL | ..get_number(); | ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:93:5 + --> tests/ui/unnecessary_operation.rs:86:5 | LL | 5..get_number(); | ^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5; get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:95:5 + --> tests/ui/unnecessary_operation.rs:88:5 | LL | [42, get_number()]; | ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42; get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:97:5 + --> tests/ui/unnecessary_operation.rs:90:5 | LL | [42, 55][get_usize()]; | ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:99:5 + --> tests/ui/unnecessary_operation.rs:92:5 | LL | (42, get_number()).1; | ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42; get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:101:5 + --> tests/ui/unnecessary_operation.rs:94:5 | LL | [get_number(); 55]; | ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:103:5 + --> tests/ui/unnecessary_operation.rs:96:5 | LL | [42; 55][get_usize()]; | ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42; 55].len() > get_usize());` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:105:5 + --> tests/ui/unnecessary_operation.rs:98:5 | LL | / { LL | | @@ -113,7 +113,7 @@ LL | | }; | |______^ help: statement can be reduced to: `get_number();` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:109:5 + --> tests/ui/unnecessary_operation.rs:102:5 | LL | / FooString { LL | | @@ -122,7 +122,7 @@ LL | | }; | |______^ help: statement can be reduced to: `String::from("blah");` error: unnecessary operation - --> tests/ui/unnecessary_operation.rs:150:5 + --> tests/ui/unnecessary_operation.rs:143:5 | LL | [42, 55][get_usize()]; | ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());` diff --git a/tests/ui/unnecessary_option_map_or_else.fixed b/tests/ui/unnecessary_option_map_or_else.fixed index 8d25efbeea00..867528dd7e44 100644 --- a/tests/ui/unnecessary_option_map_or_else.fixed +++ b/tests/ui/unnecessary_option_map_or_else.fixed @@ -1,11 +1,11 @@ #![warn(clippy::unnecessary_option_map_or_else)] #![allow( - clippy::let_and_return, clippy::let_unit_value, + clippy::needless_return, clippy::unnecessary_lazy_evaluations, - clippy::unnecessary_literal_unwrap, - clippy::needless_return + clippy::unnecessary_literal_unwrap )] +#![expect(clippy::let_and_return)] const fn double_it(x: i32) -> i32 { x * 2 diff --git a/tests/ui/unnecessary_option_map_or_else.rs b/tests/ui/unnecessary_option_map_or_else.rs index 42d4ad6ac1f8..325e63879ba2 100644 --- a/tests/ui/unnecessary_option_map_or_else.rs +++ b/tests/ui/unnecessary_option_map_or_else.rs @@ -1,11 +1,11 @@ #![warn(clippy::unnecessary_option_map_or_else)] #![allow( - clippy::let_and_return, clippy::let_unit_value, + clippy::needless_return, clippy::unnecessary_lazy_evaluations, - clippy::unnecessary_literal_unwrap, - clippy::needless_return + clippy::unnecessary_literal_unwrap )] +#![expect(clippy::let_and_return)] const fn double_it(x: i32) -> i32 { x * 2 diff --git a/tests/ui/unnecessary_os_str_debug_formatting.rs b/tests/ui/unnecessary_os_str_debug_formatting.rs index 66590be3d054..c5b279ea2ae1 100644 --- a/tests/ui/unnecessary_os_str_debug_formatting.rs +++ b/tests/ui/unnecessary_os_str_debug_formatting.rs @@ -1,5 +1,5 @@ #![warn(clippy::unnecessary_debug_formatting)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] use std::ffi::{OsStr, OsString}; diff --git a/tests/ui/unnecessary_path_debug_formatting.rs b/tests/ui/unnecessary_path_debug_formatting.rs index 215e0d5d7802..303cded91307 100644 --- a/tests/ui/unnecessary_path_debug_formatting.rs +++ b/tests/ui/unnecessary_path_debug_formatting.rs @@ -1,5 +1,5 @@ #![warn(clippy::unnecessary_debug_formatting)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] use std::ffi::{OsStr, OsString}; use std::ops::Deref; diff --git a/tests/ui/unnecessary_result_map_or_else.fixed b/tests/ui/unnecessary_result_map_or_else.fixed index 55542519bdb7..2bb8e22a0bb9 100644 --- a/tests/ui/unnecessary_result_map_or_else.fixed +++ b/tests/ui/unnecessary_result_map_or_else.fixed @@ -1,10 +1,6 @@ #![warn(clippy::unnecessary_result_map_or_else)] -#![allow( - clippy::unnecessary_literal_unwrap, - clippy::let_and_return, - clippy::let_unit_value, - clippy::needless_return -)] +#![allow(clippy::needless_return, clippy::unnecessary_literal_unwrap)] +#![expect(clippy::let_and_return, clippy::let_unit_value)] fn main() { let x: Result<(), ()> = Ok(()); diff --git a/tests/ui/unnecessary_result_map_or_else.rs b/tests/ui/unnecessary_result_map_or_else.rs index 21a4826911e5..829dd035adc3 100644 --- a/tests/ui/unnecessary_result_map_or_else.rs +++ b/tests/ui/unnecessary_result_map_or_else.rs @@ -1,10 +1,6 @@ #![warn(clippy::unnecessary_result_map_or_else)] -#![allow( - clippy::unnecessary_literal_unwrap, - clippy::let_and_return, - clippy::let_unit_value, - clippy::needless_return -)] +#![allow(clippy::needless_return, clippy::unnecessary_literal_unwrap)] +#![expect(clippy::let_and_return, clippy::let_unit_value)] fn main() { let x: Result<(), ()> = Ok(()); diff --git a/tests/ui/unnecessary_result_map_or_else.stderr b/tests/ui/unnecessary_result_map_or_else.stderr index f76999127c64..2443083d4390 100644 --- a/tests/ui/unnecessary_result_map_or_else.stderr +++ b/tests/ui/unnecessary_result_map_or_else.stderr @@ -1,5 +1,5 @@ error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:11:5 + --> tests/ui/unnecessary_result_map_or_else.rs:7:5 | LL | x.map_or_else(|err| err, |n| n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + x.unwrap_or_else(|err| err); | error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:16:5 + --> tests/ui/unnecessary_result_map_or_else.rs:12:5 | LL | x.map_or_else(|err: ()| err, |n: ()| n); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + x.unwrap_or_else(|err: ()| err); | error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:27:5 + --> tests/ui/unnecessary_result_map_or_else.rs:23:5 | LL | / x.map_or_else( LL | | @@ -51,7 +51,7 @@ LL + x.unwrap_or_else(|err| err); | error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:39:5 + --> tests/ui/unnecessary_result_map_or_else.rs:35:5 | LL | / x.map_or_else( LL | | @@ -77,7 +77,7 @@ LL + x.unwrap_or_else(|err| err); | error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:91:5 + --> tests/ui/unnecessary_result_map_or_else.rs:87:5 | LL | x.map_or_else(|err| err, |(a, b)| (a, b)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL + x.unwrap_or_else(|err| err); | error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:96:5 + --> tests/ui/unnecessary_result_map_or_else.rs:92:5 | LL | / x.map_or_else( LL | | @@ -115,7 +115,7 @@ LL + x.unwrap_or_else(|err| err); | error: unused "map closure" when calling `Result::map_or_else` value - --> tests/ui/unnecessary_result_map_or_else.rs:108:5 + --> tests/ui/unnecessary_result_map_or_else.rs:104:5 | LL | / x.map_or_else( LL | | diff --git a/tests/ui/unnecessary_safety_comment.rs b/tests/ui/unnecessary_safety_comment.rs index 75e8315343d3..80e065c64fe5 100644 --- a/tests/ui/unnecessary_safety_comment.rs +++ b/tests/ui/unnecessary_safety_comment.rs @@ -1,5 +1,5 @@ #![warn(clippy::undocumented_unsafe_blocks, clippy::unnecessary_safety_comment)] -#![allow(clippy::let_unit_value, clippy::missing_safety_doc, clippy::needless_ifs)] +#![expect(clippy::needless_ifs)] mod unsafe_items_invalid_comment { // SAFETY: diff --git a/tests/ui/unnecessary_self_imports.fixed b/tests/ui/unnecessary_self_imports.fixed index 0fd74705bde0..f3405f486b2d 100644 --- a/tests/ui/unnecessary_self_imports.fixed +++ b/tests/ui/unnecessary_self_imports.fixed @@ -1,5 +1,4 @@ #![warn(clippy::unnecessary_self_imports)] -#![allow(unused_imports, dead_code)] use std::collections::hash_map::{self, *}; use std::fs as alias; diff --git a/tests/ui/unnecessary_self_imports.rs b/tests/ui/unnecessary_self_imports.rs index d09c5fcb8caa..c15efb274f46 100644 --- a/tests/ui/unnecessary_self_imports.rs +++ b/tests/ui/unnecessary_self_imports.rs @@ -1,5 +1,4 @@ #![warn(clippy::unnecessary_self_imports)] -#![allow(unused_imports, dead_code)] use std::collections::hash_map::{self, *}; use std::fs::{self as alias}; diff --git a/tests/ui/unnecessary_self_imports.stderr b/tests/ui/unnecessary_self_imports.stderr index 1bb22c46a6c1..8e7add731cd6 100644 --- a/tests/ui/unnecessary_self_imports.stderr +++ b/tests/ui/unnecessary_self_imports.stderr @@ -1,5 +1,5 @@ error: import ending with `::{self}` - --> tests/ui/unnecessary_self_imports.rs:5:1 + --> tests/ui/unnecessary_self_imports.rs:4:1 | LL | use std::fs::{self as alias}; | ^^^^^^^^^-------------------- @@ -11,7 +11,7 @@ LL | use std::fs::{self as alias}; = help: to override `-D warnings` add `#[allow(clippy::unnecessary_self_imports)]` error: import ending with `::{self}` - --> tests/ui/unnecessary_self_imports.rs:8:1 + --> tests/ui/unnecessary_self_imports.rs:7:1 | LL | use std::rc::{self}; | ^^^^^^^^^----------- diff --git a/tests/ui/unnecessary_semicolon.edition2021.fixed b/tests/ui/unnecessary_semicolon.edition2021.fixed index 797f1505f499..624aefe08719 100644 --- a/tests/ui/unnecessary_semicolon.edition2021.fixed +++ b/tests/ui/unnecessary_semicolon.edition2021.fixed @@ -4,7 +4,7 @@ #![warn(clippy::unnecessary_semicolon)] #![feature(postfix_match)] -#![allow(clippy::single_match)] +#![expect(clippy::single_match)] fn no_lint(mut x: u32) -> Option { Some(())?; diff --git a/tests/ui/unnecessary_semicolon.edition2024.fixed b/tests/ui/unnecessary_semicolon.edition2024.fixed index d2609cea0002..87cda0f34ed9 100644 --- a/tests/ui/unnecessary_semicolon.edition2024.fixed +++ b/tests/ui/unnecessary_semicolon.edition2024.fixed @@ -4,7 +4,7 @@ #![warn(clippy::unnecessary_semicolon)] #![feature(postfix_match)] -#![allow(clippy::single_match)] +#![expect(clippy::single_match)] fn no_lint(mut x: u32) -> Option { Some(())?; diff --git a/tests/ui/unnecessary_semicolon.rs b/tests/ui/unnecessary_semicolon.rs index 55f1ec84cb0e..d2badb556255 100644 --- a/tests/ui/unnecessary_semicolon.rs +++ b/tests/ui/unnecessary_semicolon.rs @@ -4,7 +4,7 @@ #![warn(clippy::unnecessary_semicolon)] #![feature(postfix_match)] -#![allow(clippy::single_match)] +#![expect(clippy::single_match)] fn no_lint(mut x: u32) -> Option { Some(())?; diff --git a/tests/ui/unnecessary_sort_by.fixed b/tests/ui/unnecessary_sort_by.fixed index 317140eacc78..324a84cf5169 100644 --- a/tests/ui/unnecessary_sort_by.fixed +++ b/tests/ui/unnecessary_sort_by.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::stable_sort_primitive, clippy::useless_vec)] +#![warn(clippy::unnecessary_sort_by)] +#![expect(clippy::useless_vec)] use std::cell::Ref; diff --git a/tests/ui/unnecessary_sort_by.rs b/tests/ui/unnecessary_sort_by.rs index a31cf2967999..bcf2e1ca694b 100644 --- a/tests/ui/unnecessary_sort_by.rs +++ b/tests/ui/unnecessary_sort_by.rs @@ -1,4 +1,5 @@ -#![allow(clippy::stable_sort_primitive, clippy::useless_vec)] +#![warn(clippy::unnecessary_sort_by)] +#![expect(clippy::useless_vec)] use std::cell::Ref; diff --git a/tests/ui/unnecessary_sort_by.stderr b/tests/ui/unnecessary_sort_by.stderr index 56d4831eb70a..61655a8c8ed5 100644 --- a/tests/ui/unnecessary_sort_by.stderr +++ b/tests/ui/unnecessary_sort_by.stderr @@ -1,5 +1,5 @@ error: consider using `sort` - --> tests/ui/unnecessary_sort_by.rs:12:5 + --> tests/ui/unnecessary_sort_by.rs:13:5 | LL | vec.sort_by(|a, b| a.cmp(b)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + vec.sort(); | error: consider using `sort_unstable` - --> tests/ui/unnecessary_sort_by.rs:14:5 + --> tests/ui/unnecessary_sort_by.rs:15:5 | LL | vec.sort_unstable_by(|a, b| a.cmp(b)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + vec.sort_unstable(); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:16:5 + --> tests/ui/unnecessary_sort_by.rs:17:5 | LL | vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + vec.sort_by_key(|a| (a + 5).abs()); | error: consider using `sort_unstable_by_key` - --> tests/ui/unnecessary_sort_by.rs:18:5 + --> tests/ui/unnecessary_sort_by.rs:19:5 | LL | vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + vec.sort_unstable_by_key(|a| id(-a)); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:22:5 + --> tests/ui/unnecessary_sort_by.rs:23:5 | LL | vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + vec.sort_by_key(|b| std::cmp::Reverse((b + 5).abs())); | error: consider using `sort_unstable_by_key` - --> tests/ui/unnecessary_sort_by.rs:24:5 + --> tests/ui/unnecessary_sort_by.rs:25:5 | LL | vec.sort_unstable_by(|a, b| id(-b).cmp(&id(-a))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + vec.sort_unstable_by_key(|b| std::cmp::Reverse(id(-b))); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:35:5 + --> tests/ui/unnecessary_sort_by.rs:36:5 | LL | vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + vec.sort_by_key(|a| (***a).abs()); | error: consider using `sort_unstable_by_key` - --> tests/ui/unnecessary_sort_by.rs:37:5 + --> tests/ui/unnecessary_sort_by.rs:38:5 | LL | vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + vec.sort_unstable_by_key(|a| (***a).abs()); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:97:9 + --> tests/ui/unnecessary_sort_by.rs:98:9 | LL | args.sort_by(|a, b| a.name().cmp(&b.name())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + args.sort_by_key(|a| a.name()); | error: consider using `sort_unstable_by_key` - --> tests/ui/unnecessary_sort_by.rs:99:9 + --> tests/ui/unnecessary_sort_by.rs:100:9 | LL | args.sort_unstable_by(|a, b| a.name().cmp(&b.name())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + args.sort_unstable_by_key(|a| a.name()); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:102:9 + --> tests/ui/unnecessary_sort_by.rs:103:9 | LL | args.sort_by(|a, b| b.name().cmp(&a.name())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + args.sort_by_key(|b| std::cmp::Reverse(b.name())); | error: consider using `sort_unstable_by_key` - --> tests/ui/unnecessary_sort_by.rs:104:9 + --> tests/ui/unnecessary_sort_by.rs:105:9 | LL | args.sort_unstable_by(|a, b| b.name().cmp(&a.name())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + args.sort_unstable_by_key(|b| std::cmp::Reverse(b.name())); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:114:5 + --> tests/ui/unnecessary_sort_by.rs:115:5 | LL | v.sort_by(|a, b| a.0.cmp(&b.0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL + v.sort_by_key(|a| a.0); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:132:5 + --> tests/ui/unnecessary_sort_by.rs:133:5 | LL | items.sort_by(|item1, item2| item1.key.cmp(&item2.key)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + items.sort_by_key(|item1| item1.key); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:137:5 + --> tests/ui/unnecessary_sort_by.rs:138:5 | LL | items.sort_by(|item1, item2| item1.value.clone().cmp(&item2.value.clone())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + items.sort_by_key(|item1| item1.value.clone()); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:143:5 + --> tests/ui/unnecessary_sort_by.rs:144:5 | LL | v.sort_by(|(_, s1), (_, s2)| s1.cmp(s2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + v.sort_by_key(|(_, s1)| *s1); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:150:5 + --> tests/ui/unnecessary_sort_by.rs:151:5 | LL | v.sort_by(|Foo { bar: b1 }, Foo { bar: b2 }| b1.cmp(b2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL + v.sort_by_key(|Foo { bar: b1 }| *b1); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:155:5 + --> tests/ui/unnecessary_sort_by.rs:156:5 | LL | v.sort_by(|Baz(b1), Baz(b2)| b1.cmp(b2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -217,7 +217,7 @@ LL + v.sort_by_key(|Baz(b1)| *b1); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:158:5 + --> tests/ui/unnecessary_sort_by.rs:159:5 | LL | v.sort_by(|&Baz(b1), &Baz(b2)| b1.cmp(&b2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL + v.sort_by_key(|&Baz(b1)| b1); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:162:5 + --> tests/ui/unnecessary_sort_by.rs:163:5 | LL | v.sort_by(|&&b1, &&b2| b1.cmp(&b2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -241,7 +241,7 @@ LL + v.sort_by_key(|&&b1| b1); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:166:5 + --> tests/ui/unnecessary_sort_by.rs:167:5 | LL | v.sort_by(|[a1, b1], [a2, b2]| a1.cmp(a2)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL + v.sort_by_key(|[a1, b1]| *a1); | error: consider using `sort_by_key` - --> tests/ui/unnecessary_sort_by.rs:169:5 + --> tests/ui/unnecessary_sort_by.rs:170:5 | LL | v.sort_by(|[a1, b1], [a2, b2]| (a1 - b1).cmp(&(a2 - b2))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_struct_initialization.fixed b/tests/ui/unnecessary_struct_initialization.fixed index 07dc90acfa30..c39a336674fd 100644 --- a/tests/ui/unnecessary_struct_initialization.fixed +++ b/tests/ui/unnecessary_struct_initialization.fixed @@ -1,5 +1,5 @@ -#![allow(clippy::non_canonical_clone_impl, unused)] #![warn(clippy::unnecessary_struct_initialization)] +#![allow(clippy::non_canonical_clone_impl)] struct S { f: String, diff --git a/tests/ui/unnecessary_struct_initialization.rs b/tests/ui/unnecessary_struct_initialization.rs index 12a444fc878b..28bb450d219c 100644 --- a/tests/ui/unnecessary_struct_initialization.rs +++ b/tests/ui/unnecessary_struct_initialization.rs @@ -1,5 +1,5 @@ -#![allow(clippy::non_canonical_clone_impl, unused)] #![warn(clippy::unnecessary_struct_initialization)] +#![allow(clippy::non_canonical_clone_impl)] struct S { f: String, diff --git a/tests/ui/unnecessary_to_owned.fixed b/tests/ui/unnecessary_to_owned.fixed index 590359bc1ad2..dbcb32bd4823 100644 --- a/tests/ui/unnecessary_to_owned.fixed +++ b/tests/ui/unnecessary_to_owned.fixed @@ -1,13 +1,11 @@ -#![allow( +#![warn(clippy::redundant_clone, clippy::unnecessary_to_owned)] +#![expect( clippy::manual_async_fn, clippy::needless_borrow, clippy::needless_borrows_for_generic_args, - clippy::needless_lifetimes, clippy::owned_cow, - clippy::ptr_arg, - clippy::uninlined_format_args + clippy::ptr_arg )] -#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)] use std::borrow::Cow; use std::ffi::{CStr, CString, OsStr, OsString}; @@ -44,7 +42,6 @@ impl X { } } -#[allow(dead_code)] #[derive(Clone)] enum FileType { Account, @@ -312,7 +309,6 @@ fn require_string(_: &String) {} // https://github.com/rust-lang/rust-clippy/issues/8507 mod issue_8507 { - #![allow(dead_code)] struct Opaque

(P); @@ -362,7 +358,6 @@ mod issue_8507 { // https://github.com/rust-lang/rust-clippy/issues/8759 mod issue_8759 { - #![allow(dead_code)] #[derive(Default)] struct View {} @@ -393,7 +388,6 @@ mod issue_8759 { } mod issue_8759_variant { - #![allow(dead_code)] #[derive(Clone, Default)] struct View {} @@ -417,7 +411,6 @@ mod issue_8759_variant { } mod issue_9317 { - #![allow(dead_code)] struct Bytes {} @@ -446,7 +439,6 @@ mod issue_9317 { } mod issue_9351 { - #![allow(dead_code)] use std::ops::Deref; use std::path::{Path, PathBuf}; @@ -507,7 +499,6 @@ mod issue_9351 { } mod issue_9504 { - #![allow(dead_code)] async fn foo>(_: S) {} async fn bar() { @@ -516,7 +507,6 @@ mod issue_9504 { } mod issue_9771a { - #![allow(dead_code)] use std::marker::PhantomData; @@ -534,7 +524,6 @@ mod issue_9771a { } mod issue_9771b { - #![allow(dead_code)] pub struct Key>(K); @@ -548,7 +537,6 @@ mod issue_9771b { // The ICE is triggered by the call to `to_owned` on this line: // https://github.com/oxigraph/rio/blob/66635b9ff8e5423e58932353fa40d6e64e4820f7/testsuite/src/parser_evaluator.rs#L116 mod issue_10021 { - #![allow(unused)] pub struct Iri(T); @@ -565,7 +553,6 @@ mod issue_10021 { } mod issue_10033 { - #![allow(dead_code)] use std::fmt::Display; use std::ops::Deref; diff --git a/tests/ui/unnecessary_to_owned.rs b/tests/ui/unnecessary_to_owned.rs index d1e3e6497c0a..1f8cb7681a88 100644 --- a/tests/ui/unnecessary_to_owned.rs +++ b/tests/ui/unnecessary_to_owned.rs @@ -1,13 +1,11 @@ -#![allow( +#![warn(clippy::redundant_clone, clippy::unnecessary_to_owned)] +#![expect( clippy::manual_async_fn, clippy::needless_borrow, clippy::needless_borrows_for_generic_args, - clippy::needless_lifetimes, clippy::owned_cow, - clippy::ptr_arg, - clippy::uninlined_format_args + clippy::ptr_arg )] -#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)] use std::borrow::Cow; use std::ffi::{CStr, CString, OsStr, OsString}; @@ -44,7 +42,6 @@ impl X { } } -#[allow(dead_code)] #[derive(Clone)] enum FileType { Account, @@ -312,7 +309,6 @@ fn require_string(_: &String) {} // https://github.com/rust-lang/rust-clippy/issues/8507 mod issue_8507 { - #![allow(dead_code)] struct Opaque

(P); @@ -362,7 +358,6 @@ mod issue_8507 { // https://github.com/rust-lang/rust-clippy/issues/8759 mod issue_8759 { - #![allow(dead_code)] #[derive(Default)] struct View {} @@ -393,7 +388,6 @@ mod issue_8759 { } mod issue_8759_variant { - #![allow(dead_code)] #[derive(Clone, Default)] struct View {} @@ -417,7 +411,6 @@ mod issue_8759_variant { } mod issue_9317 { - #![allow(dead_code)] struct Bytes {} @@ -446,7 +439,6 @@ mod issue_9317 { } mod issue_9351 { - #![allow(dead_code)] use std::ops::Deref; use std::path::{Path, PathBuf}; @@ -507,7 +499,6 @@ mod issue_9351 { } mod issue_9504 { - #![allow(dead_code)] async fn foo>(_: S) {} async fn bar() { @@ -516,7 +507,6 @@ mod issue_9504 { } mod issue_9771a { - #![allow(dead_code)] use std::marker::PhantomData; @@ -534,7 +524,6 @@ mod issue_9771a { } mod issue_9771b { - #![allow(dead_code)] pub struct Key>(K); @@ -548,7 +537,6 @@ mod issue_9771b { // The ICE is triggered by the call to `to_owned` on this line: // https://github.com/oxigraph/rio/blob/66635b9ff8e5423e58932353fa40d6e64e4820f7/testsuite/src/parser_evaluator.rs#L116 mod issue_10021 { - #![allow(unused)] pub struct Iri(T); @@ -565,7 +553,6 @@ mod issue_10021 { } mod issue_10033 { - #![allow(dead_code)] use std::fmt::Display; use std::ops::Deref; diff --git a/tests/ui/unnecessary_to_owned.stderr b/tests/ui/unnecessary_to_owned.stderr index 50e3d5eb2195..158adffe0f7f 100644 --- a/tests/ui/unnecessary_to_owned.stderr +++ b/tests/ui/unnecessary_to_owned.stderr @@ -1,11 +1,11 @@ error: redundant clone - --> tests/ui/unnecessary_to_owned.rs:218:64 + --> tests/ui/unnecessary_to_owned.rs:215:64 | LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned()); | ^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> tests/ui/unnecessary_to_owned.rs:218:20 + --> tests/ui/unnecessary_to_owned.rs:215:20 | LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,55 +13,55 @@ LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned()) = help: to override `-D warnings` add `#[allow(clippy::redundant_clone)]` error: redundant clone - --> tests/ui/unnecessary_to_owned.rs:220:40 + --> tests/ui/unnecessary_to_owned.rs:217:40 | LL | require_os_str(&OsString::from("x").to_os_string()); | ^^^^^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> tests/ui/unnecessary_to_owned.rs:220:21 + --> tests/ui/unnecessary_to_owned.rs:217:21 | LL | require_os_str(&OsString::from("x").to_os_string()); | ^^^^^^^^^^^^^^^^^^^ error: redundant clone - --> tests/ui/unnecessary_to_owned.rs:222:48 + --> tests/ui/unnecessary_to_owned.rs:219:48 | LL | require_path(&std::path::PathBuf::from("x").to_path_buf()); | ^^^^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> tests/ui/unnecessary_to_owned.rs:222:19 + --> tests/ui/unnecessary_to_owned.rs:219:19 | LL | require_path(&std::path::PathBuf::from("x").to_path_buf()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant clone - --> tests/ui/unnecessary_to_owned.rs:224:35 + --> tests/ui/unnecessary_to_owned.rs:221:35 | LL | require_str(&String::from("x").to_string()); | ^^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> tests/ui/unnecessary_to_owned.rs:224:18 + --> tests/ui/unnecessary_to_owned.rs:221:18 | LL | require_str(&String::from("x").to_string()); | ^^^^^^^^^^^^^^^^^ error: redundant clone - --> tests/ui/unnecessary_to_owned.rs:226:39 + --> tests/ui/unnecessary_to_owned.rs:223:39 | LL | require_slice(&[String::from("x")].to_owned()); | ^^^^^^^^^^^ help: remove this | note: this value is dropped without further use - --> tests/ui/unnecessary_to_owned.rs:226:20 + --> tests/ui/unnecessary_to_owned.rs:223:20 | LL | require_slice(&[String::from("x")].to_owned()); | ^^^^^^^^^^^^^^^^^^^ error: unnecessary use of `into_owned` - --> tests/ui/unnecessary_to_owned.rs:66:36 + --> tests/ui/unnecessary_to_owned.rs:63:36 | LL | require_c_str(&Cow::from(c_str).into_owned()); | ^^^^^^^^^^^^^ help: remove this @@ -70,391 +70,391 @@ LL | require_c_str(&Cow::from(c_str).into_owned()); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:68:19 + --> tests/ui/unnecessary_to_owned.rs:65:19 | LL | require_c_str(&c_str.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `c_str` error: unnecessary use of `to_os_string` - --> tests/ui/unnecessary_to_owned.rs:71:20 + --> tests/ui/unnecessary_to_owned.rs:68:20 | LL | require_os_str(&os_str.to_os_string()); | ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str` error: unnecessary use of `into_owned` - --> tests/ui/unnecessary_to_owned.rs:73:38 + --> tests/ui/unnecessary_to_owned.rs:70:38 | LL | require_os_str(&Cow::from(os_str).into_owned()); | ^^^^^^^^^^^^^ help: remove this error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:75:20 + --> tests/ui/unnecessary_to_owned.rs:72:20 | LL | require_os_str(&os_str.to_owned()); | ^^^^^^^^^^^^^^^^^^ help: use: `os_str` error: unnecessary use of `to_path_buf` - --> tests/ui/unnecessary_to_owned.rs:78:18 + --> tests/ui/unnecessary_to_owned.rs:75:18 | LL | require_path(&path.to_path_buf()); | ^^^^^^^^^^^^^^^^^^^ help: use: `path` error: unnecessary use of `into_owned` - --> tests/ui/unnecessary_to_owned.rs:80:34 + --> tests/ui/unnecessary_to_owned.rs:77:34 | LL | require_path(&Cow::from(path).into_owned()); | ^^^^^^^^^^^^^ help: remove this error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:82:18 + --> tests/ui/unnecessary_to_owned.rs:79:18 | LL | require_path(&path.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `path` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:85:17 + --> tests/ui/unnecessary_to_owned.rs:82:17 | LL | require_str(&s.to_string()); | ^^^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `into_owned` - --> tests/ui/unnecessary_to_owned.rs:87:30 + --> tests/ui/unnecessary_to_owned.rs:84:30 | LL | require_str(&Cow::from(s).into_owned()); | ^^^^^^^^^^^^^ help: remove this error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:89:17 + --> tests/ui/unnecessary_to_owned.rs:86:17 | LL | require_str(&s.to_owned()); | ^^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:91:17 + --> tests/ui/unnecessary_to_owned.rs:88:17 | LL | require_str(&x_ref.to_string()); | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:94:19 + --> tests/ui/unnecessary_to_owned.rs:91:19 | LL | require_slice(&slice.to_vec()); | ^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `into_owned` - --> tests/ui/unnecessary_to_owned.rs:96:36 + --> tests/ui/unnecessary_to_owned.rs:93:36 | LL | require_slice(&Cow::from(slice).into_owned()); | ^^^^^^^^^^^^^ help: remove this error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:98:19 + --> tests/ui/unnecessary_to_owned.rs:95:19 | LL | require_slice(&array.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:100:19 + --> tests/ui/unnecessary_to_owned.rs:97:19 | LL | require_slice(&array_ref.to_owned()); | ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:102:19 + --> tests/ui/unnecessary_to_owned.rs:99:19 | LL | require_slice(&slice.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `into_owned` - --> tests/ui/unnecessary_to_owned.rs:106:42 + --> tests/ui/unnecessary_to_owned.rs:103:42 | LL | require_x(&Cow::::Owned(x.clone()).into_owned()); | ^^^^^^^^^^^^^ help: remove this error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:110:25 + --> tests/ui/unnecessary_to_owned.rs:107:25 | LL | require_deref_c_str(c_str.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `c_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:112:26 + --> tests/ui/unnecessary_to_owned.rs:109:26 | LL | require_deref_os_str(os_str.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `os_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:114:24 + --> tests/ui/unnecessary_to_owned.rs:111:24 | LL | require_deref_path(path.to_owned()); | ^^^^^^^^^^^^^^^ help: use: `path` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:116:23 + --> tests/ui/unnecessary_to_owned.rs:113:23 | LL | require_deref_str(s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:118:25 + --> tests/ui/unnecessary_to_owned.rs:115:25 | LL | require_deref_slice(slice.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:121:30 + --> tests/ui/unnecessary_to_owned.rs:118:30 | LL | require_impl_deref_c_str(c_str.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `c_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:123:31 + --> tests/ui/unnecessary_to_owned.rs:120:31 | LL | require_impl_deref_os_str(os_str.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `os_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:125:29 + --> tests/ui/unnecessary_to_owned.rs:122:29 | LL | require_impl_deref_path(path.to_owned()); | ^^^^^^^^^^^^^^^ help: use: `path` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:127:28 + --> tests/ui/unnecessary_to_owned.rs:124:28 | LL | require_impl_deref_str(s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:129:30 + --> tests/ui/unnecessary_to_owned.rs:126:30 | LL | require_impl_deref_slice(slice.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:132:29 + --> tests/ui/unnecessary_to_owned.rs:129:29 | LL | require_deref_str_slice(s.to_owned(), slice.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:132:43 + --> tests/ui/unnecessary_to_owned.rs:129:43 | LL | require_deref_str_slice(s.to_owned(), slice.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:135:29 + --> tests/ui/unnecessary_to_owned.rs:132:29 | LL | require_deref_slice_str(slice.to_owned(), s.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:135:47 + --> tests/ui/unnecessary_to_owned.rs:132:47 | LL | require_deref_slice_str(slice.to_owned(), s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:139:26 + --> tests/ui/unnecessary_to_owned.rs:136:26 | LL | require_as_ref_c_str(c_str.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `c_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:141:27 + --> tests/ui/unnecessary_to_owned.rs:138:27 | LL | require_as_ref_os_str(os_str.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `os_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:143:25 + --> tests/ui/unnecessary_to_owned.rs:140:25 | LL | require_as_ref_path(path.to_owned()); | ^^^^^^^^^^^^^^^ help: use: `path` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:145:24 + --> tests/ui/unnecessary_to_owned.rs:142:24 | LL | require_as_ref_str(s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:147:24 + --> tests/ui/unnecessary_to_owned.rs:144:24 | LL | require_as_ref_str(x.to_owned()); | ^^^^^^^^^^^^ help: use: `&x` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:149:26 + --> tests/ui/unnecessary_to_owned.rs:146:26 | LL | require_as_ref_slice(array.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `array` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:151:26 + --> tests/ui/unnecessary_to_owned.rs:148:26 | LL | require_as_ref_slice(array_ref.to_owned()); | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:153:26 + --> tests/ui/unnecessary_to_owned.rs:150:26 | LL | require_as_ref_slice(slice.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:156:31 + --> tests/ui/unnecessary_to_owned.rs:153:31 | LL | require_impl_as_ref_c_str(c_str.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `c_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:158:32 + --> tests/ui/unnecessary_to_owned.rs:155:32 | LL | require_impl_as_ref_os_str(os_str.to_owned()); | ^^^^^^^^^^^^^^^^^ help: use: `os_str` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:160:30 + --> tests/ui/unnecessary_to_owned.rs:157:30 | LL | require_impl_as_ref_path(path.to_owned()); | ^^^^^^^^^^^^^^^ help: use: `path` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:162:29 + --> tests/ui/unnecessary_to_owned.rs:159:29 | LL | require_impl_as_ref_str(s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:164:29 + --> tests/ui/unnecessary_to_owned.rs:161:29 | LL | require_impl_as_ref_str(x.to_owned()); | ^^^^^^^^^^^^ help: use: `&x` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:166:31 + --> tests/ui/unnecessary_to_owned.rs:163:31 | LL | require_impl_as_ref_slice(array.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `array` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:168:31 + --> tests/ui/unnecessary_to_owned.rs:165:31 | LL | require_impl_as_ref_slice(array_ref.to_owned()); | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:170:31 + --> tests/ui/unnecessary_to_owned.rs:167:31 | LL | require_impl_as_ref_slice(slice.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:173:30 + --> tests/ui/unnecessary_to_owned.rs:170:30 | LL | require_as_ref_str_slice(s.to_owned(), array.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:173:44 + --> tests/ui/unnecessary_to_owned.rs:170:44 | LL | require_as_ref_str_slice(s.to_owned(), array.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `array` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:176:30 + --> tests/ui/unnecessary_to_owned.rs:173:30 | LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:176:44 + --> tests/ui/unnecessary_to_owned.rs:173:44 | LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned()); | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:179:30 + --> tests/ui/unnecessary_to_owned.rs:176:30 | LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:179:44 + --> tests/ui/unnecessary_to_owned.rs:176:44 | LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:182:30 + --> tests/ui/unnecessary_to_owned.rs:179:30 | LL | require_as_ref_slice_str(array.to_owned(), s.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `array` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:182:48 + --> tests/ui/unnecessary_to_owned.rs:179:48 | LL | require_as_ref_slice_str(array.to_owned(), s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:185:30 + --> tests/ui/unnecessary_to_owned.rs:182:30 | LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned()); | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:185:52 + --> tests/ui/unnecessary_to_owned.rs:182:52 | LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:188:30 + --> tests/ui/unnecessary_to_owned.rs:185:30 | LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned()); | ^^^^^^^^^^^^^^^^ help: use: `slice` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:188:48 + --> tests/ui/unnecessary_to_owned.rs:185:48 | LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned()); | ^^^^^^^^^^^^ help: use: `s` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:192:20 + --> tests/ui/unnecessary_to_owned.rs:189:20 | LL | let _ = x.join(&x_ref.to_string()); | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:195:13 + --> tests/ui/unnecessary_to_owned.rs:192:13 | LL | let _ = slice.to_vec().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:197:13 + --> tests/ui/unnecessary_to_owned.rs:194:13 | LL | let _ = slice.to_owned().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:200:13 + --> tests/ui/unnecessary_to_owned.rs:197:13 | LL | let _ = IntoIterator::into_iter(slice.to_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:202:13 + --> tests/ui/unnecessary_to_owned.rs:199:13 | LL | let _ = IntoIterator::into_iter(slice.to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()` error: allocating a new `String` only to create a temporary `&str` from it - --> tests/ui/unnecessary_to_owned.rs:230:26 + --> tests/ui/unnecessary_to_owned.rs:227:26 | LL | let _ref_str: &str = &String::from_utf8(slice.to_vec()).expect("not UTF-8"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -466,7 +466,7 @@ LL + let _ref_str: &str = core::str::from_utf8(&slice).expect("not UTF-8"); | error: allocating a new `String` only to create a temporary `&str` from it - --> tests/ui/unnecessary_to_owned.rs:232:26 + --> tests/ui/unnecessary_to_owned.rs:229:26 | LL | let _ref_str: &str = &String::from_utf8(b"foo".to_vec()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -478,7 +478,7 @@ LL + let _ref_str: &str = core::str::from_utf8(b"foo").unwrap(); | error: allocating a new `String` only to create a temporary `&str` from it - --> tests/ui/unnecessary_to_owned.rs:234:26 + --> tests/ui/unnecessary_to_owned.rs:231:26 | LL | let _ref_str: &str = &String::from_utf8(b"foo".as_slice().to_owned()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -490,7 +490,7 @@ LL + let _ref_str: &str = core::str::from_utf8(b"foo".as_slice()).unwrap(); | error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:292:14 + --> tests/ui/unnecessary_to_owned.rs:289:14 | LL | for t in file_types.to_vec() { | ^^^^^^^^^^^^^^^^^^^ @@ -503,55 +503,55 @@ LL ~ let path = match get_file_path(t) { | error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:358:24 + --> tests/ui/unnecessary_to_owned.rs:354:24 | LL | Box::new(build(y.to_string())) | ^^^^^^^^^^^^^ help: use: `y` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:468:12 + --> tests/ui/unnecessary_to_owned.rs:460:12 | LL | id("abc".to_string()) | ^^^^^^^^^^^^^^^^^ help: use: `"abc"` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:612:37 + --> tests/ui/unnecessary_to_owned.rs:599:37 | LL | IntoFuture::into_future(foo([].to_vec(), &0)); | ^^^^^^^^^^^ help: use: `[]` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:623:18 + --> tests/ui/unnecessary_to_owned.rs:610:18 | LL | s.remove(&a.to_vec()); | ^^^^^^^^^^^ help: replace it with: `a` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned.rs:628:14 + --> tests/ui/unnecessary_to_owned.rs:615:14 | LL | s.remove(&"b".to_owned()); | ^^^^^^^^^^^^^^^ help: replace it with: `"b"` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:630:14 + --> tests/ui/unnecessary_to_owned.rs:617:14 | LL | s.remove(&"b".to_string()); | ^^^^^^^^^^^^^^^^ help: replace it with: `"b"` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:636:14 + --> tests/ui/unnecessary_to_owned.rs:623:14 | LL | s.remove(&["b"].to_vec()); | ^^^^^^^^^^^^^^^ help: replace it with: `["b"].as_slice()` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned.rs:638:14 + --> tests/ui/unnecessary_to_owned.rs:625:14 | LL | s.remove(&(&["b"]).to_vec()); | ^^^^^^^^^^^^^^^^^^ help: replace it with: `(&["b"]).as_slice()` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned.rs:690:10 + --> tests/ui/unnecessary_to_owned.rs:677:10 | LL | take(format!("ouch{dot}").to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `&format!("ouch{dot}")` diff --git a/tests/ui/unnecessary_to_owned_on_split.fixed b/tests/ui/unnecessary_to_owned_on_split.fixed index f43d92a2d9ba..7ee1f539c204 100644 --- a/tests/ui/unnecessary_to_owned_on_split.fixed +++ b/tests/ui/unnecessary_to_owned_on_split.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::single_char_pattern)] +#![warn(clippy::unnecessary_to_owned)] +#![expect(clippy::single_char_pattern)] struct Issue12068; diff --git a/tests/ui/unnecessary_to_owned_on_split.rs b/tests/ui/unnecessary_to_owned_on_split.rs index bdf5f98bf61e..a716ac965175 100644 --- a/tests/ui/unnecessary_to_owned_on_split.rs +++ b/tests/ui/unnecessary_to_owned_on_split.rs @@ -1,4 +1,5 @@ -#![allow(clippy::single_char_pattern)] +#![warn(clippy::unnecessary_to_owned)] +#![expect(clippy::single_char_pattern)] struct Issue12068; diff --git a/tests/ui/unnecessary_to_owned_on_split.stderr b/tests/ui/unnecessary_to_owned_on_split.stderr index 5e4fbb1035d6..a9e913de89b1 100644 --- a/tests/ui/unnecessary_to_owned_on_split.stderr +++ b/tests/ui/unnecessary_to_owned_on_split.stderr @@ -1,5 +1,5 @@ error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned_on_split.rs:19:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:20:13 | LL | let _ = "a".to_string().split('a').next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split('a')` @@ -8,49 +8,49 @@ LL | let _ = "a".to_string().split('a').next().unwrap(); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned_on_split.rs:22:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:23:13 | LL | let _ = "a".to_string().split("a").next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split("a")` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned_on_split.rs:25:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:26:13 | LL | let _ = "a".to_owned().split('a').next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split('a')` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned_on_split.rs:28:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:29:13 | LL | let _ = "a".to_owned().split("a").next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split("a")` error: unnecessary use of `to_string` - --> tests/ui/unnecessary_to_owned_on_split.rs:31:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:32:13 | LL | let _ = Issue12068.to_string().split('a').next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `Issue12068.as_ref().split('a')` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned_on_split.rs:34:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:35:13 | LL | let _ = [1].to_vec().split(|x| *x == 2).next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` error: unnecessary use of `to_vec` - --> tests/ui/unnecessary_to_owned_on_split.rs:37:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:38:13 | LL | let _ = [1].to_vec().split(|x| *x == 2).next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned_on_split.rs:40:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:41:13 | LL | let _ = [1].to_owned().split(|x| *x == 2).next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` error: unnecessary use of `to_owned` - --> tests/ui/unnecessary_to_owned_on_split.rs:43:13 + --> tests/ui/unnecessary_to_owned_on_split.rs:44:13 | LL | let _ = [1].to_owned().split(|x| *x == 2).next().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)` diff --git a/tests/ui/unnecessary_unsafety_doc.rs b/tests/ui/unnecessary_unsafety_doc.rs index 7a847d2e3b50..1fcad44e8380 100644 --- a/tests/ui/unnecessary_unsafety_doc.rs +++ b/tests/ui/unnecessary_unsafety_doc.rs @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs -#![allow(clippy::let_unit_value, clippy::needless_pass_by_ref_mut)] #![warn(clippy::unnecessary_safety_doc)] extern crate proc_macros; diff --git a/tests/ui/unnecessary_unsafety_doc.stderr b/tests/ui/unnecessary_unsafety_doc.stderr index dd9d8b65f75e..cb2fb3119e86 100644 --- a/tests/ui/unnecessary_unsafety_doc.stderr +++ b/tests/ui/unnecessary_unsafety_doc.stderr @@ -1,5 +1,5 @@ error: safe function's docs have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:19:1 + --> tests/ui/unnecessary_unsafety_doc.rs:18:1 | LL | pub fn apocalypse(universe: &mut ()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,31 +8,31 @@ LL | pub fn apocalypse(universe: &mut ()) { = help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_doc)]` error: safe function's docs have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:46:5 + --> tests/ui/unnecessary_unsafety_doc.rs:45:5 | LL | pub fn republished() { | ^^^^^^^^^^^^^^^^^^^^ error: safe function's docs have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:60:5 + --> tests/ui/unnecessary_unsafety_doc.rs:59:5 | LL | fn documented(self); | ^^^^^^^^^^^^^^^^^^^^ error: docs for safe trait have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:71:1 + --> tests/ui/unnecessary_unsafety_doc.rs:70:1 | LL | pub trait DocumentedSafeTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: safe function's docs have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:100:5 + --> tests/ui/unnecessary_unsafety_doc.rs:99:5 | LL | pub fn documented() -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: safe function's docs have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:128:9 + --> tests/ui/unnecessary_unsafety_doc.rs:127:9 | LL | pub fn drive() { | ^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | very_safe!(); = note: this error originates in the macro `very_safe` (in Nightly builds, run with -Z macro-backtrace for more info) error: docs for safe trait have unnecessary `# Safety` section - --> tests/ui/unnecessary_unsafety_doc.rs:157:1 + --> tests/ui/unnecessary_unsafety_doc.rs:156:1 | LL | pub trait DocumentedSafeTraitWithImplementationHeader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnecessary_wraps.rs b/tests/ui/unnecessary_wraps.rs index 4770ef3b4830..5803eff6a4ff 100644 --- a/tests/ui/unnecessary_wraps.rs +++ b/tests/ui/unnecessary_wraps.rs @@ -1,9 +1,7 @@ //@no-rustfix: overlapping suggestions #![warn(clippy::unnecessary_wraps)] -#![allow(clippy::no_effect)] +#![expect(clippy::if_same_then_else, clippy::no_effect)] #![allow(clippy::needless_return)] -#![allow(clippy::if_same_then_else)] -#![allow(dead_code)] // should be linted fn func1(a: bool, b: bool) -> Option { diff --git a/tests/ui/unnecessary_wraps.stderr b/tests/ui/unnecessary_wraps.stderr index 13d71271e211..1fd421c201c9 100644 --- a/tests/ui/unnecessary_wraps.stderr +++ b/tests/ui/unnecessary_wraps.stderr @@ -1,5 +1,5 @@ error: this function's return value is unnecessarily wrapped by `Option` - --> tests/ui/unnecessary_wraps.rs:9:1 + --> tests/ui/unnecessary_wraps.rs:7:1 | LL | fn func1(a: bool, b: bool) -> Option { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL ~ return 1337; | error: this function's return value is unnecessarily wrapped by `Option` - --> tests/ui/unnecessary_wraps.rs:24:1 + --> tests/ui/unnecessary_wraps.rs:22:1 | LL | fn func2(a: bool, b: bool) -> Option { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL ~ if a { 20 } else { 30 } | error: this function's return value is unnecessarily wrapped by `Option` - --> tests/ui/unnecessary_wraps.rs:44:1 + --> tests/ui/unnecessary_wraps.rs:42:1 | LL | fn func5() -> Option { | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ LL + 1 | error: this function's return value is unnecessarily wrapped by `Result` - --> tests/ui/unnecessary_wraps.rs:56:1 + --> tests/ui/unnecessary_wraps.rs:54:1 | LL | fn func7() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +75,7 @@ LL + 1 | error: this function's return value is unnecessarily wrapped by `Option` - --> tests/ui/unnecessary_wraps.rs:86:5 + --> tests/ui/unnecessary_wraps.rs:84:5 | LL | fn func12() -> Option { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ LL + 1 | error: this function's return value is unnecessary - --> tests/ui/unnecessary_wraps.rs:115:1 + --> tests/ui/unnecessary_wraps.rs:113:1 | LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL ~ return ; | error: this function's return value is unnecessary - --> tests/ui/unnecessary_wraps.rs:130:1 + --> tests/ui/unnecessary_wraps.rs:128:1 | LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unneeded_field_pattern.rs b/tests/ui/unneeded_field_pattern.rs index 327b64e7c4aa..b048789cf1aa 100644 --- a/tests/ui/unneeded_field_pattern.rs +++ b/tests/ui/unneeded_field_pattern.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::unneeded_field_pattern)] -#![allow(dead_code, unused, clippy::single_match)] +#![expect(clippy::single_match)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unneeded_struct_pattern.fixed b/tests/ui/unneeded_struct_pattern.fixed index 665ab98913be..a51f6ad34fec 100644 --- a/tests/ui/unneeded_struct_pattern.fixed +++ b/tests/ui/unneeded_struct_pattern.fixed @@ -1,10 +1,7 @@ //@aux-build:non-exhaustive-enum.rs -#![allow( - clippy::manual_unwrap_or_default, - clippy::manual_unwrap_or, - clippy::redundant_pattern_matching -)] #![warn(clippy::unneeded_struct_pattern)] +#![allow(clippy::redundant_pattern_matching)] +#![expect(clippy::manual_unwrap_or_default)] extern crate non_exhaustive_enum; use non_exhaustive_enum::*; diff --git a/tests/ui/unneeded_struct_pattern.rs b/tests/ui/unneeded_struct_pattern.rs index 7cadb6c7fbb5..4039f72c5316 100644 --- a/tests/ui/unneeded_struct_pattern.rs +++ b/tests/ui/unneeded_struct_pattern.rs @@ -1,10 +1,7 @@ //@aux-build:non-exhaustive-enum.rs -#![allow( - clippy::manual_unwrap_or_default, - clippy::manual_unwrap_or, - clippy::redundant_pattern_matching -)] #![warn(clippy::unneeded_struct_pattern)] +#![allow(clippy::redundant_pattern_matching)] +#![expect(clippy::manual_unwrap_or_default)] extern crate non_exhaustive_enum; use non_exhaustive_enum::*; diff --git a/tests/ui/unneeded_struct_pattern.stderr b/tests/ui/unneeded_struct_pattern.stderr index 7c0c3c9e4462..2e66fb40881c 100644 --- a/tests/ui/unneeded_struct_pattern.stderr +++ b/tests/ui/unneeded_struct_pattern.stderr @@ -1,5 +1,5 @@ error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:17:13 + --> tests/ui/unneeded_struct_pattern.rs:14:13 | LL | None {} => 0, | ^^^ help: remove the struct pattern @@ -8,193 +8,193 @@ LL | None {} => 0, = help: to override `-D warnings` add `#[allow(clippy::unneeded_struct_pattern)]` error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:23:13 + --> tests/ui/unneeded_struct_pattern.rs:20:13 | LL | None { .. } => 0, | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:34:18 + --> tests/ui/unneeded_struct_pattern.rs:31:18 | LL | Some(None {}) => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:36:13 + --> tests/ui/unneeded_struct_pattern.rs:33:13 | LL | None {} => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:40:16 + --> tests/ui/unneeded_struct_pattern.rs:37:16 | LL | if let None {} = Some(0) {} | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:42:16 + --> tests/ui/unneeded_struct_pattern.rs:39:16 | LL | if let None { .. } = Some(0) {} | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:44:21 + --> tests/ui/unneeded_struct_pattern.rs:41:21 | LL | if let Some(None {}) = Some(Some(0)) {} | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:46:13 + --> tests/ui/unneeded_struct_pattern.rs:43:13 | LL | let None {} = Some(0) else { panic!() }; | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:48:13 + --> tests/ui/unneeded_struct_pattern.rs:45:13 | LL | let None { .. } = Some(0) else { panic!() }; | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:50:18 + --> tests/ui/unneeded_struct_pattern.rs:47:18 | LL | let Some(None {}) = Some(Some(0)) else { panic!() }; | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:67:27 + --> tests/ui/unneeded_struct_pattern.rs:64:27 | LL | Custom::NoBrackets {} => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:68:40 + --> tests/ui/unneeded_struct_pattern.rs:65:40 | LL | Custom::NoBracketsNonExhaustive {} => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:75:27 + --> tests/ui/unneeded_struct_pattern.rs:72:27 | LL | Custom::NoBrackets { .. } => 0, | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:76:40 + --> tests/ui/unneeded_struct_pattern.rs:73:40 | LL | Custom::NoBracketsNonExhaustive { .. } => 0, | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:81:27 + --> tests/ui/unneeded_struct_pattern.rs:78:27 | LL | Custom::NoBrackets {} if true => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:86:27 + --> tests/ui/unneeded_struct_pattern.rs:83:27 | LL | Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:86:64 + --> tests/ui/unneeded_struct_pattern.rs:83:64 | LL | Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} => 0, | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:101:30 + --> tests/ui/unneeded_struct_pattern.rs:98:30 | LL | if let Custom::NoBrackets {} = Custom::Init { | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:105:30 + --> tests/ui/unneeded_struct_pattern.rs:102:30 | LL | if let Custom::NoBrackets { .. } = Custom::Init { | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:109:30 + --> tests/ui/unneeded_struct_pattern.rs:106:30 | LL | if let Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} = Custom::Init { | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:109:67 + --> tests/ui/unneeded_struct_pattern.rs:106:67 | LL | if let Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} = Custom::Init { | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:114:43 + --> tests/ui/unneeded_struct_pattern.rs:111:43 | LL | if let Custom::NoBracketsNonExhaustive {} = Custom::Init { | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:118:43 + --> tests/ui/unneeded_struct_pattern.rs:115:43 | LL | if let Custom::NoBracketsNonExhaustive { .. } = Custom::Init { | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:134:27 + --> tests/ui/unneeded_struct_pattern.rs:131:27 | LL | let Custom::NoBrackets {} = Custom::Init else { panic!() }; | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:136:27 + --> tests/ui/unneeded_struct_pattern.rs:133:27 | LL | let Custom::NoBrackets { .. } = Custom::Init else { | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:140:40 + --> tests/ui/unneeded_struct_pattern.rs:137:40 | LL | let Custom::NoBracketsNonExhaustive {} = Custom::Init else { | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:144:40 + --> tests/ui/unneeded_struct_pattern.rs:141:40 | LL | let Custom::NoBracketsNonExhaustive { .. } = Custom::Init else { | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:153:44 + --> tests/ui/unneeded_struct_pattern.rs:150:44 | LL | fn pat_in_fn_param_1(Refutable::Variant {}: Refutable) {} | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:154:44 + --> tests/ui/unneeded_struct_pattern.rs:151:44 | LL | fn pat_in_fn_param_2(Refutable::Variant { .. }: Refutable) {} | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:156:27 + --> tests/ui/unneeded_struct_pattern.rs:153:27 | LL | for Refutable::Variant {} in [] {} | ^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:157:27 + --> tests/ui/unneeded_struct_pattern.rs:154:27 | LL | for Refutable::Variant { .. } in [] {} | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:171:23 + --> tests/ui/unneeded_struct_pattern.rs:168:23 | LL | ExhaustiveUnit { .. } => 0, | ^^^^^^^ help: remove the struct pattern error: struct pattern is not needed for a unit variant - --> tests/ui/unneeded_struct_pattern.rs:177:23 + --> tests/ui/unneeded_struct_pattern.rs:174:23 | LL | ExhaustiveUnit {} => 0, | ^^^ help: remove the struct pattern diff --git a/tests/ui/unneeded_wildcard_pattern.fixed b/tests/ui/unneeded_wildcard_pattern.fixed index ff99e436c661..1c987d0a9aec 100644 --- a/tests/ui/unneeded_wildcard_pattern.fixed +++ b/tests/ui/unneeded_wildcard_pattern.fixed @@ -1,7 +1,6 @@ //@aux-build:proc_macros.rs #![feature(stmt_expr_attributes)] -#![deny(clippy::unneeded_wildcard_pattern)] -#![allow(clippy::needless_ifs)] +#![warn(clippy::unneeded_wildcard_pattern)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unneeded_wildcard_pattern.rs b/tests/ui/unneeded_wildcard_pattern.rs index 5913735d3b4b..30c11c2f5e7e 100644 --- a/tests/ui/unneeded_wildcard_pattern.rs +++ b/tests/ui/unneeded_wildcard_pattern.rs @@ -1,7 +1,6 @@ //@aux-build:proc_macros.rs #![feature(stmt_expr_attributes)] -#![deny(clippy::unneeded_wildcard_pattern)] -#![allow(clippy::needless_ifs)] +#![warn(clippy::unneeded_wildcard_pattern)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unneeded_wildcard_pattern.stderr b/tests/ui/unneeded_wildcard_pattern.stderr index bfdceb53f7d4..6559aa42b36f 100644 --- a/tests/ui/unneeded_wildcard_pattern.stderr +++ b/tests/ui/unneeded_wildcard_pattern.stderr @@ -1,113 +1,110 @@ error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:12:18 + --> tests/ui/unneeded_wildcard_pattern.rs:11:18 | LL | if let (0, .., _) = t {}; | ^^^ help: remove it | -note: the lint level is defined here - --> tests/ui/unneeded_wildcard_pattern.rs:3:9 - | -LL | #![deny(clippy::unneeded_wildcard_pattern)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::unneeded-wildcard-pattern` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::unneeded_wildcard_pattern)]` error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:14:16 + --> tests/ui/unneeded_wildcard_pattern.rs:13:16 | LL | if let (0, _, ..) = t {}; | ^^^ help: remove it error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:16:13 + --> tests/ui/unneeded_wildcard_pattern.rs:15:13 | LL | if let (_, .., 0) = t {}; | ^^^ help: remove it error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:18:15 + --> tests/ui/unneeded_wildcard_pattern.rs:17:15 | LL | if let (.., _, 0) = t {}; | ^^^ help: remove it error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:20:16 + --> tests/ui/unneeded_wildcard_pattern.rs:19:16 | LL | if let (0, _, _, ..) = t {}; | ^^^^^^ help: remove them error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:22:18 + --> tests/ui/unneeded_wildcard_pattern.rs:21:18 | LL | if let (0, .., _, _) = t {}; | ^^^^^^ help: remove them error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:32:22 + --> tests/ui/unneeded_wildcard_pattern.rs:31:22 | LL | if let (0, .., _, _,) = t {}; | ^^^^^^ help: remove them error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:40:19 + --> tests/ui/unneeded_wildcard_pattern.rs:39:19 | LL | if let S(0, .., _) = s {}; | ^^^ help: remove it error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:42:17 + --> tests/ui/unneeded_wildcard_pattern.rs:41:17 | LL | if let S(0, _, ..) = s {}; | ^^^ help: remove it error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:44:14 + --> tests/ui/unneeded_wildcard_pattern.rs:43:14 | LL | if let S(_, .., 0) = s {}; | ^^^ help: remove it error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:46:16 + --> tests/ui/unneeded_wildcard_pattern.rs:45:16 | LL | if let S(.., _, 0) = s {}; | ^^^ help: remove it error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:48:17 + --> tests/ui/unneeded_wildcard_pattern.rs:47:17 | LL | if let S(0, _, _, ..) = s {}; | ^^^^^^ help: remove them error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:50:19 + --> tests/ui/unneeded_wildcard_pattern.rs:49:19 | LL | if let S(0, .., _, _) = s {}; | ^^^^^^ help: remove them error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:60:23 + --> tests/ui/unneeded_wildcard_pattern.rs:59:23 | LL | if let S(0, .., _, _,) = s {}; | ^^^^^^ help: remove them error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:83:33 + --> tests/ui/unneeded_wildcard_pattern.rs:82:33 | LL | let Struct4 { mut a, mut b, c: _, .. } = fourval; | ^^^^^^ help: remove it error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:85:26 + --> tests/ui/unneeded_wildcard_pattern.rs:84:26 | LL | let Struct4 { mut b, c: _, d: _, .. } = fourval; | ^^^^^^^^^^^^ help: remove them error: these patterns are unneeded as the `..` pattern can match those elements - --> tests/ui/unneeded_wildcard_pattern.rs:89:19 + --> tests/ui/unneeded_wildcard_pattern.rs:88:19 | LL | let Struct4 { b: _, c: _, .. } = fourval; | ^^^^^^^^^^^^ help: remove them error: this pattern is unneeded as the `..` pattern can match that element - --> tests/ui/unneeded_wildcard_pattern.rs:91:19 + --> tests/ui/unneeded_wildcard_pattern.rs:90:19 | LL | let Struct4 { c: _, .. } = fourval; | ^^^^^^ help: remove it diff --git a/tests/ui/unnested_or_patterns.fixed b/tests/ui/unnested_or_patterns.fixed index 0391fb19b1f6..f96088bd39a6 100644 --- a/tests/ui/unnested_or_patterns.fixed +++ b/tests/ui/unnested_or_patterns.fixed @@ -1,13 +1,7 @@ #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] -#![allow( - clippy::cognitive_complexity, - clippy::match_ref_pats, - clippy::upper_case_acronyms, - clippy::needless_ifs, - clippy::manual_range_patterns -)] -#![allow(unreachable_patterns, irrefutable_let_patterns, unused)] +#![allow(clippy::manual_range_patterns)] +#![expect(irrefutable_let_patterns)] struct S { x: u8, diff --git a/tests/ui/unnested_or_patterns.rs b/tests/ui/unnested_or_patterns.rs index f0702668fa91..6f4ef615e9d1 100644 --- a/tests/ui/unnested_or_patterns.rs +++ b/tests/ui/unnested_or_patterns.rs @@ -1,13 +1,7 @@ #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] -#![allow( - clippy::cognitive_complexity, - clippy::match_ref_pats, - clippy::upper_case_acronyms, - clippy::needless_ifs, - clippy::manual_range_patterns -)] -#![allow(unreachable_patterns, irrefutable_let_patterns, unused)] +#![allow(clippy::manual_range_patterns)] +#![expect(irrefutable_let_patterns)] struct S { x: u8, diff --git a/tests/ui/unnested_or_patterns.stderr b/tests/ui/unnested_or_patterns.stderr index d2b617c322c4..7298eabaa03e 100644 --- a/tests/ui/unnested_or_patterns.stderr +++ b/tests/ui/unnested_or_patterns.stderr @@ -1,5 +1,5 @@ error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:21:12 + --> tests/ui/unnested_or_patterns.rs:15:12 | LL | if let box 0 | box 2 = Box::new(0) {} | ^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + if let box (0 | 2) = Box::new(0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:23:12 + --> tests/ui/unnested_or_patterns.rs:17:12 | LL | if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:26:12 + --> tests/ui/unnested_or_patterns.rs:20:12 | LL | if let Some(1) | C0 | Some(2) = None {} | ^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + if let Some(1 | 2) | C0 = None {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:28:12 + --> tests/ui/unnested_or_patterns.rs:22:12 | LL | if let &mut 0 | &mut 2 = &mut 0 {} | ^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + if let &mut (0 | 2) = &mut 0 {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:30:12 + --> tests/ui/unnested_or_patterns.rs:24:12 | LL | if let x @ 0 | x @ 2 = 0 {} | ^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + if let x @ (0 | 2) = 0 {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:32:12 + --> tests/ui/unnested_or_patterns.rs:26:12 | LL | if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + if let (0, 1 | 2 | 3) = (0, 0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:34:12 + --> tests/ui/unnested_or_patterns.rs:28:12 | LL | if let (1, 0) | (2, 0) | (3, 0) = (0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + if let (1 | 2 | 3, 0) = (0, 0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:36:12 + --> tests/ui/unnested_or_patterns.rs:30:12 | LL | if let (x, ..) | (x, 1) | (x, 2) = (0, 1) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + if let (x, ..) | (x, 1 | 2) = (0, 1) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:38:12 + --> tests/ui/unnested_or_patterns.rs:32:12 | LL | if let [0] | [1] = [0] {} | ^^^^^^^^^ @@ -109,7 +109,7 @@ LL + if let [0 | 1] = [0] {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:40:12 + --> tests/ui/unnested_or_patterns.rs:34:12 | LL | if let [x, 0] | [x, 1] = [0, 1] {} | ^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + if let [x, 0 | 1] = [0, 1] {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:42:12 + --> tests/ui/unnested_or_patterns.rs:36:12 | LL | if let [x, 0] | [x, 1] | [x, 2] = [0, 1] {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + if let [x, 0 | 1 | 2] = [0, 1] {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:44:12 + --> tests/ui/unnested_or_patterns.rs:38:12 | LL | if let [x, ..] | [x, 1] | [x, 2] = [0, 1] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + if let [x, ..] | [x, 1 | 2] = [0, 1] {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:47:12 + --> tests/ui/unnested_or_patterns.rs:41:12 | LL | if let TS(0, x) | TS(1, x) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL + if let TS(0 | 1, x) = TS(0, 0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:49:12 + --> tests/ui/unnested_or_patterns.rs:43:12 | LL | if let TS(1, 0) | TS(2, 0) | TS(3, 0) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +169,7 @@ LL + if let TS(1 | 2 | 3, 0) = TS(0, 0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:51:12 + --> tests/ui/unnested_or_patterns.rs:45:12 | LL | if let TS(x, ..) | TS(x, 1) | TS(x, 2) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + if let TS(x, ..) | TS(x, 1 | 2) = TS(0, 0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:53:12 + --> tests/ui/unnested_or_patterns.rs:47:12 | LL | if let S { x: 0, y } | S { y, x: 1 } = (S { x: 0, y: 1 }) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + if let S { x: 0 | 1, y } = (S { x: 0, y: 1 }) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:65:12 + --> tests/ui/unnested_or_patterns.rs:59:12 | LL | if let [1] | [53] = [0] {} | ^^^^^^^^^^ @@ -205,7 +205,7 @@ LL + if let [1 | 53] = [0] {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:71:13 + --> tests/ui/unnested_or_patterns.rs:65:13 | LL | let (0 | (1 | _)) = 0; | ^^^^^^^^^^^^^ @@ -217,7 +217,7 @@ LL + let (0 | 1 | _) = 0; | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:74:16 + --> tests/ui/unnested_or_patterns.rs:68:16 | LL | if let (0 | (1 | _)) = 0 {} | ^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL + if let (0 | 1 | _) = 0 {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:78:20 + --> tests/ui/unnested_or_patterns.rs:72:20 | LL | fn or_in_param((x | (x | x)): i32) {} | ^^^^^^^^^^^^^ @@ -241,7 +241,7 @@ LL + fn or_in_param((x | x | x): i32) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns.rs:94:12 + --> tests/ui/unnested_or_patterns.rs:88:12 | LL | if let S { y, x: 0 } | S { y, x: 1 } = (S { x: 0, y: 1 }) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unnested_or_patterns2.fixed b/tests/ui/unnested_or_patterns2.fixed index 852c4ddcfd71..d9625e78c246 100644 --- a/tests/ui/unnested_or_patterns2.fixed +++ b/tests/ui/unnested_or_patterns2.fixed @@ -1,12 +1,6 @@ #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] -#![allow( - clippy::cognitive_complexity, - clippy::match_ref_pats, - clippy::needless_ifs, - clippy::manual_range_patterns -)] -#![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)] +#![allow(clippy::manual_range_patterns)] fn main() { if let Some(Some(0 | 1)) = None {} diff --git a/tests/ui/unnested_or_patterns2.rs b/tests/ui/unnested_or_patterns2.rs index 12f3d3fca464..d5215966fcb1 100644 --- a/tests/ui/unnested_or_patterns2.rs +++ b/tests/ui/unnested_or_patterns2.rs @@ -1,12 +1,6 @@ #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] -#![allow( - clippy::cognitive_complexity, - clippy::match_ref_pats, - clippy::needless_ifs, - clippy::manual_range_patterns -)] -#![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)] +#![allow(clippy::manual_range_patterns)] fn main() { if let Some(Some(0)) | Some(Some(1)) = None {} diff --git a/tests/ui/unnested_or_patterns2.stderr b/tests/ui/unnested_or_patterns2.stderr index 3deef33cf258..776589e294ba 100644 --- a/tests/ui/unnested_or_patterns2.stderr +++ b/tests/ui/unnested_or_patterns2.stderr @@ -1,5 +1,5 @@ error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:12:12 + --> tests/ui/unnested_or_patterns2.rs:6:12 | LL | if let Some(Some(0)) | Some(Some(1)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + if let Some(Some(0 | 1)) = None {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:14:12 + --> tests/ui/unnested_or_patterns2.rs:8:12 | LL | if let Some(Some(0)) | Some(Some(1) | Some(2)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + if let Some(Some(0 | 1 | 2)) = None {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:16:12 + --> tests/ui/unnested_or_patterns2.rs:10:12 | LL | if let Some(Some(0 | 1) | Some(2)) | Some(Some(3) | Some(4)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + if let Some(Some(0 | 1 | 2 | 3 | 4)) = None {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:18:12 + --> tests/ui/unnested_or_patterns2.rs:12:12 | LL | if let Some(Some(0) | Some(1 | 2)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + if let Some(Some(0 | 1 | 2)) = None {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:20:12 + --> tests/ui/unnested_or_patterns2.rs:14:12 | LL | if let ((0,),) | ((1,) | (2,),) = ((0,),) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + if let ((0 | 1 | 2,),) = ((0,),) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:22:12 + --> tests/ui/unnested_or_patterns2.rs:16:12 | LL | if let 0 | (1 | 2) = 0 {} | ^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + if let 0 | 1 | 2 = 0 {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:24:12 + --> tests/ui/unnested_or_patterns2.rs:18:12 | LL | if let box (0 | 1) | (box 2 | box (3 | 4)) = Box::new(0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {} | error: unnested or-patterns - --> tests/ui/unnested_or_patterns2.rs:26:12 + --> tests/ui/unnested_or_patterns2.rs:20:12 | LL | if let box box 0 | box (box 2 | box 4) = Box::new(Box::new(0)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unsafe_derive_deserialize.rs b/tests/ui/unsafe_derive_deserialize.rs index d0022f3b6d93..2d3cddc2d6e1 100644 --- a/tests/ui/unsafe_derive_deserialize.rs +++ b/tests/ui/unsafe_derive_deserialize.rs @@ -1,5 +1,5 @@ #![warn(clippy::unsafe_derive_deserialize)] -#![allow(unused, clippy::missing_safety_doc)] +#![expect(clippy::missing_safety_doc)] extern crate serde; diff --git a/tests/ui/unsafe_removed_from_name.rs b/tests/ui/unsafe_removed_from_name.rs index f3d318815c10..fe2b495611cc 100644 --- a/tests/ui/unsafe_removed_from_name.rs +++ b/tests/ui/unsafe_removed_from_name.rs @@ -1,5 +1,3 @@ -#![allow(unused_imports)] -#![allow(dead_code)] #![warn(clippy::unsafe_removed_from_name)] use std::cell::UnsafeCell as TotallySafeCell; diff --git a/tests/ui/unsafe_removed_from_name.stderr b/tests/ui/unsafe_removed_from_name.stderr index cd3c1f80a300..0010ce5d6e5b 100644 --- a/tests/ui/unsafe_removed_from_name.stderr +++ b/tests/ui/unsafe_removed_from_name.stderr @@ -1,5 +1,5 @@ error: removed `unsafe` from the name of `UnsafeCell` in use as `TotallySafeCell` - --> tests/ui/unsafe_removed_from_name.rs:5:1 + --> tests/ui/unsafe_removed_from_name.rs:3:1 | LL | use std::cell::UnsafeCell as TotallySafeCell; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,31 +8,31 @@ LL | use std::cell::UnsafeCell as TotallySafeCell; = help: to override `-D warnings` add `#[allow(clippy::unsafe_removed_from_name)]` error: removed `unsafe` from the name of `UnsafeCell` in use as `TotallySafeCellAgain` - --> tests/ui/unsafe_removed_from_name.rs:8:1 + --> tests/ui/unsafe_removed_from_name.rs:6:1 | LL | use std::cell::UnsafeCell as TotallySafeCellAgain; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: removed `unsafe` from the name of `Unsafe` in use as `LieAboutModSafety` - --> tests/ui/unsafe_removed_from_name.rs:28:1 + --> tests/ui/unsafe_removed_from_name.rs:26:1 | LL | use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: removed `unsafe` from the name of `Unsafe` in use as `A` - --> tests/ui/unsafe_removed_from_name.rs:32:1 + --> tests/ui/unsafe_removed_from_name.rs:30:1 | LL | use mod_with_some_unsafe_things::{Unsafe as A, Unsafe as B}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: removed `unsafe` from the name of `Unsafe` in use as `B` - --> tests/ui/unsafe_removed_from_name.rs:32:1 + --> tests/ui/unsafe_removed_from_name.rs:30:1 | LL | use mod_with_some_unsafe_things::{Unsafe as A, Unsafe as B}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: removed `unsafe` from the name of `UnsafeTrait` in use as `FakeSafeTrait` - --> tests/ui/unsafe_removed_from_name.rs:47:1 + --> tests/ui/unsafe_removed_from_name.rs:45:1 | LL | use mod_with_some_unsafe_things::UnsafeTrait as FakeSafeTrait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unseparated_prefix_literals.fixed b/tests/ui/unseparated_prefix_literals.fixed index e13dd561d627..e90a7319263d 100644 --- a/tests/ui/unseparated_prefix_literals.fixed +++ b/tests/ui/unseparated_prefix_literals.fixed @@ -1,7 +1,6 @@ //@aux-build:proc_macro_derive.rs #![warn(clippy::unseparated_literal_suffix)] -#![allow(dead_code)] #[macro_use] extern crate proc_macro_derive; diff --git a/tests/ui/unseparated_prefix_literals.rs b/tests/ui/unseparated_prefix_literals.rs index 6f7b16ccba54..8988ae7b879a 100644 --- a/tests/ui/unseparated_prefix_literals.rs +++ b/tests/ui/unseparated_prefix_literals.rs @@ -1,7 +1,6 @@ //@aux-build:proc_macro_derive.rs #![warn(clippy::unseparated_literal_suffix)] -#![allow(dead_code)] #[macro_use] extern crate proc_macro_derive; diff --git a/tests/ui/unseparated_prefix_literals.stderr b/tests/ui/unseparated_prefix_literals.stderr index 4cfbf5e4b74e..67e47865108e 100644 --- a/tests/ui/unseparated_prefix_literals.stderr +++ b/tests/ui/unseparated_prefix_literals.stderr @@ -1,5 +1,5 @@ error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:24:18 + --> tests/ui/unseparated_prefix_literals.rs:23:18 | LL | let _fail1 = 1234i32; | ^^^^^^^ help: add an underscore: `1234_i32` @@ -8,43 +8,43 @@ LL | let _fail1 = 1234i32; = help: to override `-D warnings` add `#[allow(clippy::unseparated_literal_suffix)]` error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:26:18 + --> tests/ui/unseparated_prefix_literals.rs:25:18 | LL | let _fail2 = 1234u32; | ^^^^^^^ help: add an underscore: `1234_u32` error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:28:18 + --> tests/ui/unseparated_prefix_literals.rs:27:18 | LL | let _fail3 = 1234isize; | ^^^^^^^^^ help: add an underscore: `1234_isize` error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:30:18 + --> tests/ui/unseparated_prefix_literals.rs:29:18 | LL | let _fail4 = 1234usize; | ^^^^^^^^^ help: add an underscore: `1234_usize` error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:32:18 + --> tests/ui/unseparated_prefix_literals.rs:31:18 | LL | let _fail5 = 0x123isize; | ^^^^^^^^^^ help: add an underscore: `0x123_isize` error: float type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:37:19 + --> tests/ui/unseparated_prefix_literals.rs:36:19 | LL | let _failf1 = 1.5f32; | ^^^^^^ help: add an underscore: `1.5_f32` error: float type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:39:19 + --> tests/ui/unseparated_prefix_literals.rs:38:19 | LL | let _failf2 = 1f32; | ^^^^ help: add an underscore: `1_f32` error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:15:9 + --> tests/ui/unseparated_prefix_literals.rs:14:9 | LL | 42usize | ^^^^^^^ help: add an underscore: `42_usize` @@ -55,7 +55,7 @@ LL | let _ = lit_from_macro!(); = note: this error originates in the macro `lit_from_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: integer type suffix should be separated by an underscore - --> tests/ui/unseparated_prefix_literals.rs:48:16 + --> tests/ui/unseparated_prefix_literals.rs:47:16 | LL | assert_eq!(4897u32, 32223); | ^^^^^^^ help: add an underscore: `4897_u32` diff --git a/tests/ui/unused_async.rs b/tests/ui/unused_async.rs index b6780d240b17..6fcb55cb434f 100644 --- a/tests/ui/unused_async.rs +++ b/tests/ui/unused_async.rs @@ -1,11 +1,10 @@ #![warn(clippy::unused_async)] -#![allow(incomplete_features)] use std::future::Future; use std::pin::Pin; mod issue10800 { - #![allow(dead_code, unused_must_use, clippy::no_effect)] + #![allow(clippy::no_effect)] use std::future::ready; diff --git a/tests/ui/unused_async.stderr b/tests/ui/unused_async.stderr index f95fdd865300..513e0bb9b9ed 100644 --- a/tests/ui/unused_async.stderr +++ b/tests/ui/unused_async.stderr @@ -1,5 +1,5 @@ error: unused `async` for function with no await statements - --> tests/ui/unused_async.rs:12:5 + --> tests/ui/unused_async.rs:11:5 | LL | / async fn async_block_await() { LL | | @@ -12,7 +12,7 @@ LL | | } | = help: consider removing the `async` from this function note: `await` used in an async block, which does not require the enclosing function to be `async` - --> tests/ui/unused_async.rs:16:23 + --> tests/ui/unused_async.rs:15:23 | LL | ready(()).await; | ^^^^^ @@ -20,7 +20,7 @@ LL | ready(()).await; = help: to override `-D warnings` add `#[allow(clippy::unused_async)]` error: unused `async` for function with no await statements - --> tests/ui/unused_async.rs:46:5 + --> tests/ui/unused_async.rs:45:5 | LL | async fn f3() {} | ^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | async fn f3() {} = help: consider removing the `async` from this function error: unused `async` for function with no await statements - --> tests/ui/unused_async.rs:75:1 + --> tests/ui/unused_async.rs:74:1 | LL | / async fn foo() -> i32 { LL | | @@ -40,7 +40,7 @@ LL | | } = help: consider removing the `async` from this function error: unused `async` for function with no await statements - --> tests/ui/unused_async.rs:88:5 + --> tests/ui/unused_async.rs:87:5 | LL | / async fn unused(&self) -> i32 { LL | | diff --git a/tests/ui/unused_enumerate_index.fixed b/tests/ui/unused_enumerate_index.fixed index 258e52971cea..4e7a50825a3e 100644 --- a/tests/ui/unused_enumerate_index.fixed +++ b/tests/ui/unused_enumerate_index.fixed @@ -1,5 +1,5 @@ -#![allow(unused, clippy::map_identity)] #![warn(clippy::unused_enumerate_index)] +#![allow(clippy::map_identity)] use std::iter::Enumerate; diff --git a/tests/ui/unused_enumerate_index.rs b/tests/ui/unused_enumerate_index.rs index a17e3259a9b0..13115e6ab322 100644 --- a/tests/ui/unused_enumerate_index.rs +++ b/tests/ui/unused_enumerate_index.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::map_identity)] #![warn(clippy::unused_enumerate_index)] +#![allow(clippy::map_identity)] use std::iter::Enumerate; diff --git a/tests/ui/unused_format_specs_width.rs b/tests/ui/unused_format_specs_width.rs index 3f0bfc0963a8..ea9f62e1e95e 100644 --- a/tests/ui/unused_format_specs_width.rs +++ b/tests/ui/unused_format_specs_width.rs @@ -2,7 +2,7 @@ // Format width has no effect for certain traits (issue #15039) #![warn(clippy::unused_format_specs)] -#![allow(clippy::zero_ptr, clippy::manual_dangling_ptr)] +#![expect(clippy::manual_dangling_ptr, clippy::zero_ptr)] fn main() { // Integer formats with # (alternate): 0x/0o/0b prefix makes min width 4 diff --git a/tests/ui/unused_io_amount.rs b/tests/ui/unused_io_amount.rs index 32a50375806a..5859dc20f642 100644 --- a/tests/ui/unused_io_amount.rs +++ b/tests/ui/unused_io_amount.rs @@ -1,6 +1,5 @@ -#![allow(dead_code, clippy::needless_pass_by_ref_mut)] -#![allow(clippy::redundant_pattern_matching)] #![warn(clippy::unused_io_amount)] +#![expect(clippy::redundant_pattern_matching)] extern crate futures; use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; diff --git a/tests/ui/unused_io_amount.stderr b/tests/ui/unused_io_amount.stderr index 71bb4c40de84..466487de894a 100644 --- a/tests/ui/unused_io_amount.stderr +++ b/tests/ui/unused_io_amount.stderr @@ -1,5 +1,5 @@ error: written amount is not handled - --> tests/ui/unused_io_amount.rs:10:5 + --> tests/ui/unused_io_amount.rs:9:5 | LL | s.write(b"test")?; | ^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | s.write(b"test")?; = help: to override `-D warnings` add `#[allow(clippy::unused_io_amount)]` error: read amount is not handled - --> tests/ui/unused_io_amount.rs:13:5 + --> tests/ui/unused_io_amount.rs:12:5 | LL | s.read(&mut buf)?; | ^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | s.read(&mut buf)?; = help: use `Read::read_exact` instead, or handle partial reads error: written amount is not handled - --> tests/ui/unused_io_amount.rs:19:5 + --> tests/ui/unused_io_amount.rs:18:5 | LL | s.write(b"test").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | s.write(b"test").unwrap(); = help: use `Write::write_all` instead, or handle partial writes error: read amount is not handled - --> tests/ui/unused_io_amount.rs:22:5 + --> tests/ui/unused_io_amount.rs:21:5 | LL | s.read(&mut buf).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,19 +33,19 @@ LL | s.read(&mut buf).unwrap(); = help: use `Read::read_exact` instead, or handle partial reads error: read amount is not handled - --> tests/ui/unused_io_amount.rs:27:5 + --> tests/ui/unused_io_amount.rs:26:5 | LL | s.read_vectored(&mut [io::IoSliceMut::new(&mut [])])?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: written amount is not handled - --> tests/ui/unused_io_amount.rs:29:5 + --> tests/ui/unused_io_amount.rs:28:5 | LL | s.write_vectored(&[io::IoSlice::new(&[])])?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: read amount is not handled - --> tests/ui/unused_io_amount.rs:37:5 + --> tests/ui/unused_io_amount.rs:36:5 | LL | reader.read(&mut result).ok()?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | reader.read(&mut result).ok()?; = help: use `Read::read_exact` instead, or handle partial reads error: read amount is not handled - --> tests/ui/unused_io_amount.rs:47:5 + --> tests/ui/unused_io_amount.rs:46:5 | LL | reader.read(&mut result).or_else(|err| Err(err))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | reader.read(&mut result).or_else(|err| Err(err))?; = help: use `Read::read_exact` instead, or handle partial reads error: read amount is not handled - --> tests/ui/unused_io_amount.rs:60:5 + --> tests/ui/unused_io_amount.rs:59:5 | LL | reader.read(&mut result).or(Err(Error::Kind))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | reader.read(&mut result).or(Err(Error::Kind))?; = help: use `Read::read_exact` instead, or handle partial reads error: read amount is not handled - --> tests/ui/unused_io_amount.rs:68:5 + --> tests/ui/unused_io_amount.rs:67:5 | LL | / reader LL | | @@ -82,7 +82,7 @@ LL | | .expect("error"); = help: use `Read::read_exact` instead, or handle partial reads error: written amount is not handled - --> tests/ui/unused_io_amount.rs:78:5 + --> tests/ui/unused_io_amount.rs:77:5 | LL | s.write(b"ok").is_ok(); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | s.write(b"ok").is_ok(); = help: use `Write::write_all` instead, or handle partial writes error: written amount is not handled - --> tests/ui/unused_io_amount.rs:80:5 + --> tests/ui/unused_io_amount.rs:79:5 | LL | s.write(b"err").is_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -98,7 +98,7 @@ LL | s.write(b"err").is_err(); = help: use `Write::write_all` instead, or handle partial writes error: read amount is not handled - --> tests/ui/unused_io_amount.rs:83:5 + --> tests/ui/unused_io_amount.rs:82:5 | LL | s.read(&mut buf).is_ok(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -106,7 +106,7 @@ LL | s.read(&mut buf).is_ok(); = help: use `Read::read_exact` instead, or handle partial reads error: read amount is not handled - --> tests/ui/unused_io_amount.rs:85:5 + --> tests/ui/unused_io_amount.rs:84:5 | LL | s.read(&mut buf).is_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | s.read(&mut buf).is_err(); = help: use `Read::read_exact` instead, or handle partial reads error: written amount is not handled - --> tests/ui/unused_io_amount.rs:90:5 + --> tests/ui/unused_io_amount.rs:89:5 | LL | w.write(b"hello world").await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -122,7 +122,7 @@ LL | w.write(b"hello world").await.unwrap(); = help: use `AsyncWriteExt::write_all` instead, or handle partial writes error: read amount is not handled - --> tests/ui/unused_io_amount.rs:96:5 + --> tests/ui/unused_io_amount.rs:95:5 | LL | r.read(&mut buf[..]).await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL | r.read(&mut buf[..]).await.unwrap(); = help: use `AsyncReadExt::read_exact` instead, or handle partial reads error: written amount is not handled - --> tests/ui/unused_io_amount.rs:104:5 + --> tests/ui/unused_io_amount.rs:103:5 | LL | w.write(b"hello world"); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,7 +138,7 @@ LL | w.write(b"hello world"); = help: use `AsyncWriteExt::write_all` instead, or handle partial writes error: written amount is not handled - --> tests/ui/unused_io_amount.rs:111:9 + --> tests/ui/unused_io_amount.rs:110:9 | LL | w.write(b"hello world").await?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -146,7 +146,7 @@ LL | w.write(b"hello world").await?; = help: use `AsyncWriteExt::write_all` instead, or handle partial writes error: read amount is not handled - --> tests/ui/unused_io_amount.rs:120:9 + --> tests/ui/unused_io_amount.rs:119:9 | LL | r.read(&mut buf[..]).await.or(Err(Error::Kind))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -154,7 +154,7 @@ LL | r.read(&mut buf[..]).await.or(Err(Error::Kind))?; = help: use `AsyncReadExt::read_exact` instead, or handle partial reads error: written amount is not handled - --> tests/ui/unused_io_amount.rs:129:5 + --> tests/ui/unused_io_amount.rs:128:5 | LL | w.write(b"hello world").await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -162,7 +162,7 @@ LL | w.write(b"hello world").await.unwrap(); = help: use `AsyncWriteExt::write_all` instead, or handle partial writes error: read amount is not handled - --> tests/ui/unused_io_amount.rs:135:5 + --> tests/ui/unused_io_amount.rs:134:5 | LL | r.read(&mut buf[..]).await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -170,92 +170,92 @@ LL | r.read(&mut buf[..]).await.unwrap(); = help: use `AsyncReadExt::read_exact` instead, or handle partial reads error: written amount is not handled - --> tests/ui/unused_io_amount.rs:148:11 + --> tests/ui/unused_io_amount.rs:147:11 | LL | match s.write(b"test") { | ^^^^^^^^^^^^^^^^ | = help: use `Write::write_all` instead, or handle partial writes note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:150:9 + --> tests/ui/unused_io_amount.rs:149:9 | LL | Ok(_) => todo!(), | ^^^^^ error: read amount is not handled - --> tests/ui/unused_io_amount.rs:155:11 + --> tests/ui/unused_io_amount.rs:154:11 | LL | match s.read(&mut buf) { | ^^^^^^^^^^^^^^^^ | = help: use `Read::read_exact` instead, or handle partial reads note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:157:9 + --> tests/ui/unused_io_amount.rs:156:9 | LL | Ok(_) => todo!(), | ^^^^^ error: read amount is not handled - --> tests/ui/unused_io_amount.rs:163:11 + --> tests/ui/unused_io_amount.rs:162:11 | LL | match s.read(&mut [0u8; 4]) { | ^^^^^^^^^^^^^^^^^^^^^ | = help: use `Read::read_exact` instead, or handle partial reads note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:165:9 + --> tests/ui/unused_io_amount.rs:164:9 | LL | Ok(_) => todo!(), | ^^^^^ error: written amount is not handled - --> tests/ui/unused_io_amount.rs:171:11 + --> tests/ui/unused_io_amount.rs:170:11 | LL | match s.write(b"test") { | ^^^^^^^^^^^^^^^^ | = help: use `Write::write_all` instead, or handle partial writes note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:173:9 + --> tests/ui/unused_io_amount.rs:172:9 | LL | Ok(_) => todo!(), | ^^^^^ error: read amount is not handled - --> tests/ui/unused_io_amount.rs:183:8 + --> tests/ui/unused_io_amount.rs:182:8 | LL | if let Ok(_) = s.read(&mut [0u8; 4]) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use `Read::read_exact` instead, or handle partial reads note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:183:12 + --> tests/ui/unused_io_amount.rs:182:12 | LL | if let Ok(_) = s.read(&mut [0u8; 4]) { | ^^^^^ error: written amount is not handled - --> tests/ui/unused_io_amount.rs:190:8 + --> tests/ui/unused_io_amount.rs:189:8 | LL | if let Ok(_) = s.write(b"test") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use `Write::write_all` instead, or handle partial writes note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:190:12 + --> tests/ui/unused_io_amount.rs:189:12 | LL | if let Ok(_) = s.write(b"test") { | ^^^^^ error: written amount is not handled - --> tests/ui/unused_io_amount.rs:197:8 + --> tests/ui/unused_io_amount.rs:196:8 | LL | if let Ok(..) = s.write(b"test") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use `Write::write_all` instead, or handle partial writes note: the result is consumed here, but the amount of I/O bytes remains unhandled - --> tests/ui/unused_io_amount.rs:197:12 + --> tests/ui/unused_io_amount.rs:196:12 | LL | if let Ok(..) = s.write(b"test") { | ^^^^^^ diff --git a/tests/ui/unused_peekable.rs b/tests/ui/unused_peekable.rs index 29e830fefb87..8c5a3c6fa9fa 100644 --- a/tests/ui/unused_peekable.rs +++ b/tests/ui/unused_peekable.rs @@ -1,5 +1,5 @@ #![warn(clippy::unused_peekable)] -#![allow(clippy::no_effect)] +#![expect(clippy::no_effect)] use std::iter::{Empty, Peekable}; diff --git a/tests/ui/unused_result_ok.fixed b/tests/ui/unused_result_ok.fixed index faedd96216c2..91db7574b0c3 100644 --- a/tests/ui/unused_result_ok.fixed +++ b/tests/ui/unused_result_ok.fixed @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs #![warn(clippy::unused_result_ok)] -#![allow(dead_code)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unused_result_ok.rs b/tests/ui/unused_result_ok.rs index 6ab974861b63..b02252db416c 100644 --- a/tests/ui/unused_result_ok.rs +++ b/tests/ui/unused_result_ok.rs @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs #![warn(clippy::unused_result_ok)] -#![allow(dead_code)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/unused_result_ok.stderr b/tests/ui/unused_result_ok.stderr index 0e134ba3ccba..e4560aa84dea 100644 --- a/tests/ui/unused_result_ok.stderr +++ b/tests/ui/unused_result_ok.stderr @@ -1,5 +1,5 @@ error: ignoring a result with `.ok()` is misleading - --> tests/ui/unused_result_ok.rs:9:5 + --> tests/ui/unused_result_ok.rs:8:5 | LL | x.parse::().ok(); | ^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _ = x.parse::(); | error: ignoring a result with `.ok()` is misleading - --> tests/ui/unused_result_ok.rs:19:5 + --> tests/ui/unused_result_ok.rs:18:5 | LL | x . parse::() . ok (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = x . parse::(); | error: ignoring a result with `.ok()` is misleading - --> tests/ui/unused_result_ok.rs:37:5 + --> tests/ui/unused_result_ok.rs:36:5 | LL | v!().ok(); | ^^^^^^^^^ @@ -37,7 +37,7 @@ LL + let _ = v!(); | error: ignoring a result with `.ok()` is misleading - --> tests/ui/unused_result_ok.rs:31:9 + --> tests/ui/unused_result_ok.rs:30:9 | LL | Ok::<(), ()>(()).ok(); | ^^^^^^^^^^^^^^^^^^^^^ From 368ead068b4c6338da4491e61caafe16f5dfe366 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 04/11] Attributes cleanup in tests [14/20] --- tests/ui/non_minimal_cfg2.rs | 1 - tests/ui/non_minimal_cfg2.stderr | 2 +- .../non_std_lazy_static_fixable.fixed | 2 +- .../non_std_lazy_static_fixable.rs | 2 +- .../non_std_lazy_static_unfixable.rs | 2 +- tests/ui/nonminimal_bool.rs | 5 +- tests/ui/nonminimal_bool.stderr | 62 ++++++------ tests/ui/nonminimal_bool_methods.fixed | 2 +- tests/ui/nonminimal_bool_methods.rs | 2 +- tests/ui/obfuscated_if_else.fixed | 2 +- tests/ui/obfuscated_if_else.rs | 2 +- tests/ui/ok_expect.fixed | 3 +- tests/ui/ok_expect.rs | 3 +- tests/ui/ok_expect.stderr | 16 +-- tests/ui/only_used_in_recursion.rs | 3 +- tests/ui/only_used_in_recursion.stderr | 64 ++++++------ tests/ui/op_ref.fixed | 2 +- tests/ui/op_ref.rs | 2 +- tests/ui/open_options.rs | 1 - tests/ui/open_options.stderr | 16 +-- tests/ui/option_as_ref_deref.fixed | 2 +- tests/ui/option_as_ref_deref.rs | 2 +- tests/ui/option_env_unwrap.rs | 1 - tests/ui/option_env_unwrap.stderr | 14 +-- tests/ui/option_filter_map.fixed | 3 +- tests/ui/option_filter_map.rs | 3 +- tests/ui/option_filter_map.stderr | 16 +-- tests/ui/option_if_let_else.fixed | 14 +-- tests/ui/option_if_let_else.rs | 14 +-- tests/ui/option_if_let_else.stderr | 58 +++++------ tests/ui/option_map_unit_fn_unfixable.rs | 2 +- tests/ui/or_fun_call.fixed | 11 +-- tests/ui/or_fun_call.rs | 11 +-- tests/ui/or_fun_call.stderr | 98 +++++++++---------- tests/ui/or_then_unwrap.fixed | 3 +- tests/ui/or_then_unwrap.rs | 3 +- tests/ui/or_then_unwrap.stderr | 8 +- tests/ui/out_of_bounds_indexing/issue-3102.rs | 2 +- tests/ui/out_of_bounds_indexing/simple.rs | 2 +- tests/ui/overly_complex_bool_expr.fixed | 2 +- tests/ui/overly_complex_bool_expr.rs | 2 +- tests/ui/panic_in_result_fn.rs | 2 +- tests/ui/panic_in_result_fn_assertions.rs | 2 +- .../ui/panic_in_result_fn_debug_assertions.rs | 2 +- tests/ui/panicking_macros.rs | 4 +- tests/ui/panicking_overflow_checks.rs | 2 +- tests/ui/partial_pub_fields.rs | 1 - tests/ui/partial_pub_fields.stderr | 8 +- tests/ui/partialeq_ne_impl.rs | 3 +- tests/ui/partialeq_ne_impl.stderr | 2 +- tests/ui/partialeq_to_none.fixed | 3 +- tests/ui/partialeq_to_none.rs | 3 +- tests/ui/partialeq_to_none.stderr | 30 +++--- tests/ui/pattern_type_mismatch/mutability.rs | 2 +- tests/ui/pattern_type_mismatch/syntax.rs | 2 +- tests/ui/patterns.fixed | 3 +- tests/ui/patterns.rs | 3 +- tests/ui/patterns.stderr | 6 +- tests/ui/permissions_set_readonly_false.rs | 1 - .../ui/permissions_set_readonly_false.stderr | 2 +- tests/ui/precedence.fixed | 9 +- tests/ui/precedence.rs | 9 +- tests/ui/precedence.stderr | 18 ++-- tests/ui/precedence_bits.fixed | 9 +- tests/ui/precedence_bits.rs | 9 +- tests/ui/precedence_bits.stderr | 8 +- tests/ui/print_in_format_impl.rs | 1 - tests/ui/print_in_format_impl.stderr | 14 +-- tests/ui/print_literal.fixed | 2 +- tests/ui/print_literal.rs | 2 +- tests/ui/print_with_newline.fixed | 2 +- tests/ui/print_with_newline.rs | 2 +- tests/ui/println_empty_string.fixed | 3 +- tests/ui/println_empty_string.rs | 3 +- tests/ui/println_empty_string.stderr | 28 +++--- tests/ui/println_empty_string_unfixable.rs | 3 +- .../ui/println_empty_string_unfixable.stderr | 24 ++--- tests/ui/ptr_arg.rs | 8 -- tests/ui/ptr_arg.stderr | 66 ++++++------- tests/ui/ptr_cast_constness.fixed | 7 +- tests/ui/ptr_cast_constness.rs | 7 +- tests/ui/ptr_cast_constness.stderr | 30 +++--- tests/ui/ptr_eq.fixed | 1 - tests/ui/ptr_eq.rs | 1 - tests/ui/ptr_eq.stderr | 12 +-- 85 files changed, 376 insertions(+), 448 deletions(-) diff --git a/tests/ui/non_minimal_cfg2.rs b/tests/ui/non_minimal_cfg2.rs index d073feedb1da..71c6645afc8e 100644 --- a/tests/ui/non_minimal_cfg2.rs +++ b/tests/ui/non_minimal_cfg2.rs @@ -1,5 +1,4 @@ //@require-annotations-for-level: WARN -#![allow(unused)] #[cfg(all())] //~^ ERROR: unneeded sub `cfg` when there is no condition diff --git a/tests/ui/non_minimal_cfg2.stderr b/tests/ui/non_minimal_cfg2.stderr index 169d2989aa13..6d86e931edce 100644 --- a/tests/ui/non_minimal_cfg2.stderr +++ b/tests/ui/non_minimal_cfg2.stderr @@ -1,5 +1,5 @@ error: unneeded sub `cfg` when there is no condition - --> tests/ui/non_minimal_cfg2.rs:4:7 + --> tests/ui/non_minimal_cfg2.rs:3:7 | LL | #[cfg(all())] | ^^^^^ diff --git a/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.fixed b/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.fixed index d6c35d8097c5..cb783e72dd2c 100644 --- a/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.fixed +++ b/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.fixed @@ -2,7 +2,7 @@ //@aux-build:lazy_static.rs #![warn(clippy::non_std_lazy_statics)] -#![allow(static_mut_refs)] +#![expect(static_mut_refs)] use once_cell::sync::Lazy; diff --git a/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs b/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs index 996ef050d691..5681af42fd92 100644 --- a/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs +++ b/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs @@ -2,7 +2,7 @@ //@aux-build:lazy_static.rs #![warn(clippy::non_std_lazy_statics)] -#![allow(static_mut_refs)] +#![expect(static_mut_refs)] use once_cell::sync::Lazy; diff --git a/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs b/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs index acc8c04678f5..e6532bd8057e 100644 --- a/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs +++ b/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs @@ -3,7 +3,7 @@ //@no-rustfix #![warn(clippy::non_std_lazy_statics)] -#![allow(static_mut_refs)] +#![expect(static_mut_refs)] mod once_cell_lazy { use once_cell::sync::Lazy; diff --git a/tests/ui/nonminimal_bool.rs b/tests/ui/nonminimal_bool.rs index d040ba6ee83c..85e74d74d7b9 100644 --- a/tests/ui/nonminimal_bool.rs +++ b/tests/ui/nonminimal_bool.rs @@ -1,11 +1,10 @@ //@no-rustfix: overlapping suggestions -#![allow( - unused, +#![warn(clippy::nonminimal_bool)] +#![expect( clippy::diverging_sub_expression, clippy::needless_ifs, clippy::redundant_pattern_matching )] -#![warn(clippy::nonminimal_bool)] #![allow(clippy::useless_vec)] fn main() { diff --git a/tests/ui/nonminimal_bool.stderr b/tests/ui/nonminimal_bool.stderr index 29387cf31ee8..5197f105da44 100644 --- a/tests/ui/nonminimal_bool.stderr +++ b/tests/ui/nonminimal_bool.stderr @@ -1,5 +1,5 @@ error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:17:13 + --> tests/ui/nonminimal_bool.rs:16:13 | LL | let _ = !true; | ^^^^^ @@ -13,7 +13,7 @@ LL + let _ = false; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:20:13 + --> tests/ui/nonminimal_bool.rs:19:13 | LL | let _ = !false; | ^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = true; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:23:13 + --> tests/ui/nonminimal_bool.rs:22:13 | LL | let _ = !!a; | ^^^ @@ -37,7 +37,7 @@ LL + let _ = a; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:26:13 + --> tests/ui/nonminimal_bool.rs:25:13 | LL | let _ = false || a; | ^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + let _ = a; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:32:13 + --> tests/ui/nonminimal_bool.rs:31:13 | LL | let _ = !(!a && b); | ^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + let _ = a || !b; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:35:13 + --> tests/ui/nonminimal_bool.rs:34:13 | LL | let _ = !(!a || b); | ^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + let _ = a && !b; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:38:13 + --> tests/ui/nonminimal_bool.rs:37:13 | LL | let _ = !a && !(b && c); | ^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + let _ = !(a || b && c); | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:47:13 + --> tests/ui/nonminimal_bool.rs:46:13 | LL | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL + let _ = a == b && c == 5; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:50:13 + --> tests/ui/nonminimal_bool.rs:49:13 | LL | let _ = a == b || c == 5 || a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ LL + let _ = a == b || c == 5; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:53:13 + --> tests/ui/nonminimal_bool.rs:52:13 | LL | let _ = a == b && c == 5 && b == a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL + let _ = a == b && c == 5; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:56:13 + --> tests/ui/nonminimal_bool.rs:55:13 | LL | let _ = a != b || !(a != b || c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL + let _ = a != b || c != d; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:59:13 + --> tests/ui/nonminimal_bool.rs:58:13 | LL | let _ = a != b && !(a != b && c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,7 +160,7 @@ LL + let _ = a != b && c != d; | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:90:8 + --> tests/ui/nonminimal_bool.rs:89:8 | LL | if matches!(true, true) && true { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -172,37 +172,37 @@ LL + if matches!(true, true) { | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:171:8 + --> tests/ui/nonminimal_bool.rs:170:8 | LL | if !(12 == a) {} | ^^^^^^^^^^ help: try: `(12 != a)` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:173:8 + --> tests/ui/nonminimal_bool.rs:172:8 | LL | if !(a == 12) {} | ^^^^^^^^^^ help: try: `(a != 12)` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:175:8 + --> tests/ui/nonminimal_bool.rs:174:8 | LL | if !(12 != a) {} | ^^^^^^^^^^ help: try: `(12 == a)` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:177:8 + --> tests/ui/nonminimal_bool.rs:176:8 | LL | if !(a != 12) {} | ^^^^^^^^^^ help: try: `(a == 12)` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:182:8 + --> tests/ui/nonminimal_bool.rs:181:8 | LL | if !b == true {} | ^^^^^^^^^^ help: try: `b != true` error: equality checks against true are unnecessary - --> tests/ui/nonminimal_bool.rs:182:8 + --> tests/ui/nonminimal_bool.rs:181:8 | LL | if !b == true {} | ^^^^^^^^^^ help: try: `!b` @@ -211,55 +211,55 @@ LL | if !b == true {} = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:185:8 + --> tests/ui/nonminimal_bool.rs:184:8 | LL | if !b != true {} | ^^^^^^^^^^ help: try: `b == true` error: inequality checks against true can be replaced by a negation - --> tests/ui/nonminimal_bool.rs:185:8 + --> tests/ui/nonminimal_bool.rs:184:8 | LL | if !b != true {} | ^^^^^^^^^^ help: try: `b` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:188:8 + --> tests/ui/nonminimal_bool.rs:187:8 | LL | if true == !b {} | ^^^^^^^^^^ help: try: `true != b` error: equality checks against true are unnecessary - --> tests/ui/nonminimal_bool.rs:188:8 + --> tests/ui/nonminimal_bool.rs:187:8 | LL | if true == !b {} | ^^^^^^^^^^ help: try: `!b` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:191:8 + --> tests/ui/nonminimal_bool.rs:190:8 | LL | if true != !b {} | ^^^^^^^^^^ help: try: `true == b` error: inequality checks against true can be replaced by a negation - --> tests/ui/nonminimal_bool.rs:191:8 + --> tests/ui/nonminimal_bool.rs:190:8 | LL | if true != !b {} | ^^^^^^^^^^ help: try: `b` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:194:8 + --> tests/ui/nonminimal_bool.rs:193:8 | LL | if !b == !c {} | ^^^^^^^^ help: try: `b == c` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:196:8 + --> tests/ui/nonminimal_bool.rs:195:8 | LL | if !b != !c {} | ^^^^^^^^ help: try: `b != c` error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:212:8 + --> tests/ui/nonminimal_bool.rs:211:8 | LL | if !(a < 2.0 && !b) { | ^^^^^^^^^^^^^^^^ @@ -271,7 +271,7 @@ LL + if a >= 2.0 || b { | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:231:12 + --> tests/ui/nonminimal_bool.rs:230:12 | LL | if !(matches!(ty, TyKind::Ref(_, _, _)) && !is_mutable(&expr)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -283,13 +283,13 @@ LL + if !matches!(ty, TyKind::Ref(_, _, _)) || is_mutable(&expr) { | error: this boolean expression can be simplified - --> tests/ui/nonminimal_bool.rs:251:8 + --> tests/ui/nonminimal_bool.rs:250:8 | LL | if !S != true {} | ^^^^^^^^^^ help: try: `S == true` error: inequality checks against true can be replaced by a negation - --> tests/ui/nonminimal_bool.rs:251:8 + --> tests/ui/nonminimal_bool.rs:250:8 | LL | if !S != true {} | ^^^^^^^^^^ help: try: `!!S` diff --git a/tests/ui/nonminimal_bool_methods.fixed b/tests/ui/nonminimal_bool_methods.fixed index 0de944f9edcf..9ce11b8afb86 100644 --- a/tests/ui/nonminimal_bool_methods.fixed +++ b/tests/ui/nonminimal_bool_methods.fixed @@ -1,5 +1,5 @@ -#![allow(unused, clippy::diverging_sub_expression, clippy::needless_ifs)] #![warn(clippy::nonminimal_bool)] +#![expect(clippy::diverging_sub_expression, clippy::needless_ifs)] fn methods_with_negation() { let a: Option = unimplemented!(); diff --git a/tests/ui/nonminimal_bool_methods.rs b/tests/ui/nonminimal_bool_methods.rs index ac0bd6d8a491..75ecafdc7c38 100644 --- a/tests/ui/nonminimal_bool_methods.rs +++ b/tests/ui/nonminimal_bool_methods.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::diverging_sub_expression, clippy::needless_ifs)] #![warn(clippy::nonminimal_bool)] +#![expect(clippy::diverging_sub_expression, clippy::needless_ifs)] fn methods_with_negation() { let a: Option = unimplemented!(); diff --git a/tests/ui/obfuscated_if_else.fixed b/tests/ui/obfuscated_if_else.fixed index 6bdb170a4aa9..df0fabbf5ae4 100644 --- a/tests/ui/obfuscated_if_else.fixed +++ b/tests/ui/obfuscated_if_else.fixed @@ -1,7 +1,7 @@ #![warn(clippy::obfuscated_if_else)] #![allow( - clippy::unnecessary_lazy_evaluations, clippy::unit_arg, + clippy::unnecessary_lazy_evaluations, clippy::unused_unit, clippy::unwrap_or_default )] diff --git a/tests/ui/obfuscated_if_else.rs b/tests/ui/obfuscated_if_else.rs index f7b5ea8c0135..24197c7b2ab3 100644 --- a/tests/ui/obfuscated_if_else.rs +++ b/tests/ui/obfuscated_if_else.rs @@ -1,7 +1,7 @@ #![warn(clippy::obfuscated_if_else)] #![allow( - clippy::unnecessary_lazy_evaluations, clippy::unit_arg, + clippy::unnecessary_lazy_evaluations, clippy::unused_unit, clippy::unwrap_or_default )] diff --git a/tests/ui/ok_expect.fixed b/tests/ui/ok_expect.fixed index 2a05b8805e4d..0101fd69d054 100644 --- a/tests/ui/ok_expect.fixed +++ b/tests/ui/ok_expect.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::unnecessary_literal_unwrap)] +#![warn(clippy::ok_expect)] +#![expect(clippy::unnecessary_literal_unwrap)] use std::io; diff --git a/tests/ui/ok_expect.rs b/tests/ui/ok_expect.rs index 3761aa26f6e8..98a74966062f 100644 --- a/tests/ui/ok_expect.rs +++ b/tests/ui/ok_expect.rs @@ -1,4 +1,5 @@ -#![allow(clippy::unnecessary_literal_unwrap)] +#![warn(clippy::ok_expect)] +#![expect(clippy::unnecessary_literal_unwrap)] use std::io; diff --git a/tests/ui/ok_expect.stderr b/tests/ui/ok_expect.stderr index 848a10e671db..2dc14f3db575 100644 --- a/tests/ui/ok_expect.stderr +++ b/tests/ui/ok_expect.stderr @@ -1,5 +1,5 @@ error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:16:5 + --> tests/ui/ok_expect.rs:17:5 | LL | res.ok().expect("disaster!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + res.expect("disaster!"); | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:19:5 + --> tests/ui/ok_expect.rs:20:5 | LL | / res.ok() LL | | .expect("longlonglonglonglonglonglonglonglonglonglonglonglonglong"); @@ -27,7 +27,7 @@ LL + res.expect("longlonglonglonglonglonglonglonglonglonglonglonglonglong"); | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:24:5 + --> tests/ui/ok_expect.rs:25:5 | LL | / resres LL | | .ok() @@ -43,7 +43,7 @@ LL + resres.expect("longlonglonglonglonglonglonglonglonglonglonglonglonglong | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:30:5 + --> tests/ui/ok_expect.rs:31:5 | LL | / std::process::Command::new("rustc") LL | | .arg("-vV") @@ -61,7 +61,7 @@ LL + .output().expect("failed to get rustc version"); | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:42:5 + --> tests/ui/ok_expect.rs:43:5 | LL | res3.ok().expect("whoof"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + res3.expect("whoof"); | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:46:5 + --> tests/ui/ok_expect.rs:47:5 | LL | res4.ok().expect("argh"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + res4.expect("argh"); | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:50:5 + --> tests/ui/ok_expect.rs:51:5 | LL | res5.ok().expect("oops"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + res5.expect("oops"); | error: called `ok().expect()` on a `Result` value - --> tests/ui/ok_expect.rs:54:5 + --> tests/ui/ok_expect.rs:55:5 | LL | res6.ok().expect("meh"); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/only_used_in_recursion.rs b/tests/ui/only_used_in_recursion.rs index d58635969238..0222ff1e899b 100644 --- a/tests/ui/only_used_in_recursion.rs +++ b/tests/ui/only_used_in_recursion.rs @@ -1,5 +1,4 @@ -#![warn(clippy::only_used_in_recursion)] -#![warn(clippy::self_only_used_in_recursion)] +#![warn(clippy::only_used_in_recursion, clippy::self_only_used_in_recursion)] //@no-rustfix fn _simple(x: u32) -> u32 { x diff --git a/tests/ui/only_used_in_recursion.stderr b/tests/ui/only_used_in_recursion.stderr index 5d1e3e9c50fd..fad939554162 100644 --- a/tests/ui/only_used_in_recursion.stderr +++ b/tests/ui/only_used_in_recursion.stderr @@ -1,11 +1,11 @@ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:12:27 + --> tests/ui/only_used_in_recursion.rs:11:27 | LL | fn _one_unused(flag: u32, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:15:53 + --> tests/ui/only_used_in_recursion.rs:14:53 | LL | if flag == 0 { 0 } else { _one_unused(flag - 1, a) } | ^ @@ -13,121 +13,121 @@ LL | if flag == 0 { 0 } else { _one_unused(flag - 1, a) } = help: to override `-D warnings` add `#[allow(clippy::only_used_in_recursion)]` error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:18:27 + --> tests/ui/only_used_in_recursion.rs:17:27 | LL | fn _two_unused(flag: u32, a: u32, b: i32) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:22:53 + --> tests/ui/only_used_in_recursion.rs:21:53 | LL | if flag == 0 { 0 } else { _two_unused(flag - 1, a, b) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:18:35 + --> tests/ui/only_used_in_recursion.rs:17:35 | LL | fn _two_unused(flag: u32, a: u32, b: i32) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_b` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:22:56 + --> tests/ui/only_used_in_recursion.rs:21:56 | LL | if flag == 0 { 0 } else { _two_unused(flag - 1, a, b) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:25:26 + --> tests/ui/only_used_in_recursion.rs:24:26 | LL | fn _with_calc(flag: u32, a: i64) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:31:32 + --> tests/ui/only_used_in_recursion.rs:30:32 | LL | _with_calc(flag - 1, (-a + 10) * 5) | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:40:33 + --> tests/ui/only_used_in_recursion.rs:39:33 | LL | fn _used_with_unused(flag: u32, a: i32, b: i32) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:47:38 + --> tests/ui/only_used_in_recursion.rs:46:38 | LL | _used_with_unused(flag - 1, -a, a + b) | ^ ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:40:41 + --> tests/ui/only_used_in_recursion.rs:39:41 | LL | fn _used_with_unused(flag: u32, a: i32, b: i32) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_b` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:47:45 + --> tests/ui/only_used_in_recursion.rs:46:45 | LL | _used_with_unused(flag - 1, -a, a + b) | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:51:35 + --> tests/ui/only_used_in_recursion.rs:50:35 | LL | fn _codependent_unused(flag: u32, a: i32, b: i32) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:58:39 + --> tests/ui/only_used_in_recursion.rs:57:39 | LL | _codependent_unused(flag - 1, a * b, a + b) | ^ ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:51:43 + --> tests/ui/only_used_in_recursion.rs:50:43 | LL | fn _codependent_unused(flag: u32, a: i32, b: i32) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_b` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:58:43 + --> tests/ui/only_used_in_recursion.rs:57:43 | LL | _codependent_unused(flag - 1, a * b, a + b) | ^ ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:62:30 + --> tests/ui/only_used_in_recursion.rs:61:30 | LL | fn _not_primitive(flag: u32, b: String) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_b` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:65:56 + --> tests/ui/only_used_in_recursion.rs:64:56 | LL | if flag == 0 { 0 } else { _not_primitive(flag - 1, b) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:71:29 + --> tests/ui/only_used_in_recursion.rs:70:29 | LL | fn _method(flag: usize, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:74:59 + --> tests/ui/only_used_in_recursion.rs:73:59 | LL | if flag == 0 { 0 } else { Self::_method(flag - 1, a) } | ^ error: `self` is only used in recursion - --> tests/ui/only_used_in_recursion.rs:77:22 + --> tests/ui/only_used_in_recursion.rs:76:22 | LL | fn _method_self(&self, flag: usize, a: usize) -> usize { | ^^^^ | note: `self` used here - --> tests/ui/only_used_in_recursion.rs:81:35 + --> tests/ui/only_used_in_recursion.rs:80:35 | LL | if flag == 0 { 0 } else { self._method_self(flag - 1, a) } | ^^^^ @@ -135,61 +135,61 @@ LL | if flag == 0 { 0 } else { self._method_self(flag - 1, a) } = help: to override `-D warnings` add `#[allow(clippy::self_only_used_in_recursion)]` error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:77:41 + --> tests/ui/only_used_in_recursion.rs:76:41 | LL | fn _method_self(&self, flag: usize, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:81:63 + --> tests/ui/only_used_in_recursion.rs:80:63 | LL | if flag == 0 { 0 } else { self._method_self(flag - 1, a) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:91:26 + --> tests/ui/only_used_in_recursion.rs:90:26 | LL | fn method(flag: u32, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:94:58 + --> tests/ui/only_used_in_recursion.rs:93:58 | LL | if flag == 0 { 0 } else { Self::method(flag - 1, a) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:97:38 + --> tests/ui/only_used_in_recursion.rs:96:38 | LL | fn method_self(&self, flag: u32, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:100:62 + --> tests/ui/only_used_in_recursion.rs:99:62 | LL | if flag == 0 { 0 } else { self.method_self(flag - 1, a) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:125:26 + --> tests/ui/only_used_in_recursion.rs:124:26 | LL | fn method(flag: u32, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:128:58 + --> tests/ui/only_used_in_recursion.rs:127:58 | LL | if flag == 0 { 0 } else { Self::method(flag - 1, a) } | ^ error: parameter is only used in recursion - --> tests/ui/only_used_in_recursion.rs:131:38 + --> tests/ui/only_used_in_recursion.rs:130:38 | LL | fn method_self(&self, flag: u32, a: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: parameter used here - --> tests/ui/only_used_in_recursion.rs:134:62 + --> tests/ui/only_used_in_recursion.rs:133:62 | LL | if flag == 0 { 0 } else { self.method_self(flag - 1, a) } | ^ diff --git a/tests/ui/op_ref.fixed b/tests/ui/op_ref.fixed index fe4a48989b0f..9c396e6ade50 100644 --- a/tests/ui/op_ref.fixed +++ b/tests/ui/op_ref.fixed @@ -1,5 +1,5 @@ -#![allow(unused_variables, clippy::disallowed_names)] #![warn(clippy::op_ref)] +#![expect(clippy::disallowed_names)] use std::collections::HashSet; use std::ops::{BitAnd, Mul}; diff --git a/tests/ui/op_ref.rs b/tests/ui/op_ref.rs index cd0d231497ab..b803a7cc09d9 100644 --- a/tests/ui/op_ref.rs +++ b/tests/ui/op_ref.rs @@ -1,5 +1,5 @@ -#![allow(unused_variables, clippy::disallowed_names)] #![warn(clippy::op_ref)] +#![expect(clippy::disallowed_names)] use std::collections::HashSet; use std::ops::{BitAnd, Mul}; diff --git a/tests/ui/open_options.rs b/tests/ui/open_options.rs index f2f6e6edb4de..ebde82fa8f6c 100644 --- a/tests/ui/open_options.rs +++ b/tests/ui/open_options.rs @@ -1,4 +1,3 @@ -#![allow(unused_must_use)] #![warn(clippy::nonsensical_open_options)] use std::fs::OpenOptions; diff --git a/tests/ui/open_options.stderr b/tests/ui/open_options.stderr index 11b2d55fa058..85b3e6a72fc4 100644 --- a/tests/ui/open_options.stderr +++ b/tests/ui/open_options.stderr @@ -1,5 +1,5 @@ error: file opened with `truncate` and `read` - --> tests/ui/open_options.rs:17:5 + --> tests/ui/open_options.rs:16:5 | LL | OpenOptions::new().read(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,43 +8,43 @@ LL | OpenOptions::new().read(true).truncate(true).open("foo.txt"); = help: to override `-D warnings` add `#[allow(clippy::nonsensical_open_options)]` error: file opened with `append` and `truncate` - --> tests/ui/open_options.rs:20:5 + --> tests/ui/open_options.rs:19:5 | LL | OpenOptions::new().append(true).truncate(true).open("foo.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the method `read` is called more than once - --> tests/ui/open_options.rs:23:35 + --> tests/ui/open_options.rs:22:35 | LL | OpenOptions::new().read(true).read(false).open("foo.txt"); | ^^^^^^^^^^^ error: the method `create` is called more than once - --> tests/ui/open_options.rs:29:10 + --> tests/ui/open_options.rs:28:10 | LL | .create(false) | ^^^^^^^^^^^^^ error: the method `write` is called more than once - --> tests/ui/open_options.rs:32:36 + --> tests/ui/open_options.rs:31:36 | LL | OpenOptions::new().write(true).write(false).open("foo.txt"); | ^^^^^^^^^^^^ error: the method `append` is called more than once - --> tests/ui/open_options.rs:35:37 + --> tests/ui/open_options.rs:34:37 | LL | OpenOptions::new().append(true).append(false).open("foo.txt"); | ^^^^^^^^^^^^^ error: the method `truncate` is called more than once - --> tests/ui/open_options.rs:38:39 + --> tests/ui/open_options.rs:37:39 | LL | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); | ^^^^^^^^^^^^^^^ error: the method `read` is called more than once - --> tests/ui/open_options.rs:41:41 + --> tests/ui/open_options.rs:40:41 | LL | std::fs::File::options().read(true).read(false).open("foo.txt"); | ^^^^^^^^^^^ diff --git a/tests/ui/option_as_ref_deref.fixed b/tests/ui/option_as_ref_deref.fixed index 9be89b5d484f..d2b9c907e6c1 100644 --- a/tests/ui/option_as_ref_deref.fixed +++ b/tests/ui/option_as_ref_deref.fixed @@ -1,5 +1,5 @@ -#![allow(unused, clippy::redundant_clone, clippy::useless_vec)] #![warn(clippy::option_as_ref_deref)] +#![expect(clippy::useless_vec)] use std::ffi::{CString, OsString}; use std::ops::{Deref, DerefMut}; diff --git a/tests/ui/option_as_ref_deref.rs b/tests/ui/option_as_ref_deref.rs index d6b29e5e61b1..9f7c8c53434b 100644 --- a/tests/ui/option_as_ref_deref.rs +++ b/tests/ui/option_as_ref_deref.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::redundant_clone, clippy::useless_vec)] #![warn(clippy::option_as_ref_deref)] +#![expect(clippy::useless_vec)] use std::ffi::{CString, OsString}; use std::ops::{Deref, DerefMut}; diff --git a/tests/ui/option_env_unwrap.rs b/tests/ui/option_env_unwrap.rs index b8476830efe5..0dfe61277a2c 100644 --- a/tests/ui/option_env_unwrap.rs +++ b/tests/ui/option_env_unwrap.rs @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs #![warn(clippy::option_env_unwrap)] -#![allow(clippy::map_flatten)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/option_env_unwrap.stderr b/tests/ui/option_env_unwrap.stderr index c14a3ea23ff3..7026a5e9c388 100644 --- a/tests/ui/option_env_unwrap.stderr +++ b/tests/ui/option_env_unwrap.stderr @@ -1,5 +1,5 @@ error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:10:13 + --> tests/ui/option_env_unwrap.rs:9:13 | LL | let _ = option_env!("PATH").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | let _ = option_env!("PATH").unwrap(); = help: to override `-D warnings` add `#[allow(clippy::option_env_unwrap)]` error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:12:13 + --> tests/ui/option_env_unwrap.rs:11:13 | LL | let _ = option_env!("PATH").expect("environment variable PATH isn't set"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let _ = option_env!("PATH").expect("environment variable PATH isn't set = help: consider using the `env!` macro instead error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:14:13 + --> tests/ui/option_env_unwrap.rs:13:13 | LL | let _ = option_env!("__Y__do_not_use").unwrap(); // This test only works if you don't have a __Y__do_not_use env variable in you... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | let _ = option_env!("__Y__do_not_use").unwrap(); // This test only work = help: consider using the `env!` macro instead error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:17:21 + --> tests/ui/option_env_unwrap.rs:16:21 | LL | let _ = inline!(option_env!($"PATH").unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ LL | let _ = inline!(option_env!($"PATH").unwrap()); = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:19:21 + --> tests/ui/option_env_unwrap.rs:18:21 | LL | let _ = inline!(option_env!($"PATH").expect($"environment variable PATH isn't set")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | let _ = inline!(option_env!($"PATH").expect($"environment variable PATH = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:21:13 + --> tests/ui/option_env_unwrap.rs:20:13 | LL | let _ = external!(option_env!($"PATH").unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,7 +52,7 @@ LL | let _ = external!(option_env!($"PATH").unwrap()); = note: this error originates in the macro `external` (in Nightly builds, run with -Z macro-backtrace for more info) error: this will panic at run-time if the environment variable doesn't exist at compile-time - --> tests/ui/option_env_unwrap.rs:23:13 + --> tests/ui/option_env_unwrap.rs:22:13 | LL | let _ = external!(option_env!($"PATH").expect($"environment variable PATH isn't set")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/option_filter_map.fixed b/tests/ui/option_filter_map.fixed index b3191c6c1d46..3e7cb35db952 100644 --- a/tests/ui/option_filter_map.fixed +++ b/tests/ui/option_filter_map.fixed @@ -1,5 +1,6 @@ #![warn(clippy::option_filter_map)] -#![allow(clippy::map_flatten, clippy::some_filter, clippy::unnecessary_map_on_constructor)] +#![allow(clippy::map_flatten)] +#![expect(clippy::unnecessary_map_on_constructor)] fn main() { let _ = Some(Some(1)).flatten(); diff --git a/tests/ui/option_filter_map.rs b/tests/ui/option_filter_map.rs index 7d373f353688..36fd0ac8cbfd 100644 --- a/tests/ui/option_filter_map.rs +++ b/tests/ui/option_filter_map.rs @@ -1,5 +1,6 @@ #![warn(clippy::option_filter_map)] -#![allow(clippy::map_flatten, clippy::some_filter, clippy::unnecessary_map_on_constructor)] +#![allow(clippy::map_flatten)] +#![expect(clippy::unnecessary_map_on_constructor)] fn main() { let _ = Some(Some(1)).filter(Option::is_some).map(Option::unwrap); diff --git a/tests/ui/option_filter_map.stderr b/tests/ui/option_filter_map.stderr index df3c1f9d47b8..deac2f0abb79 100644 --- a/tests/ui/option_filter_map.stderr +++ b/tests/ui/option_filter_map.stderr @@ -1,5 +1,5 @@ error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:5:27 + --> tests/ui/option_filter_map.rs:6:27 | LL | let _ = Some(Some(1)).filter(Option::is_some).map(Option::unwrap); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` @@ -8,37 +8,37 @@ LL | let _ = Some(Some(1)).filter(Option::is_some).map(Option::unwrap); = help: to override `-D warnings` add `#[allow(clippy::option_filter_map)]` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:8:27 + --> tests/ui/option_filter_map.rs:9:27 | LL | let _ = Some(Some(1)).filter(|o| o.is_some()).map(|o| o.unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:11:35 + --> tests/ui/option_filter_map.rs:12:35 | LL | let _ = Some(1).map(odds_out).filter(Option::is_some).map(Option::unwrap); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:14:35 + --> tests/ui/option_filter_map.rs:15:35 | LL | let _ = Some(1).map(odds_out).filter(|o| o.is_some()).map(|o| o.unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:17:39 + --> tests/ui/option_filter_map.rs:18:39 | LL | let _ = vec![Some(1)].into_iter().filter(Option::is_some).map(Option::unwrap); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:20:39 + --> tests/ui/option_filter_map.rs:21:39 | LL | let _ = vec![Some(1)].into_iter().filter(|o| o.is_some()).map(|o| o.unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:26:10 + --> tests/ui/option_filter_map.rs:27:10 | LL | .filter(Option::is_some) | __________^ @@ -47,7 +47,7 @@ LL | | .map(Option::unwrap); | |____________________________^ help: consider using `flatten` instead: `flatten()` error: `filter` for `Some` followed by `unwrap` - --> tests/ui/option_filter_map.rs:32:10 + --> tests/ui/option_filter_map.rs:33:10 | LL | .filter(|o| o.is_some()) | __________^ diff --git a/tests/ui/option_if_let_else.fixed b/tests/ui/option_if_let_else.fixed index 2c13ce5dae2a..d61481613666 100644 --- a/tests/ui/option_if_let_else.fixed +++ b/tests/ui/option_if_let_else.fixed @@ -1,15 +1,10 @@ #![warn(clippy::option_if_let_else)] #![allow( - clippy::ref_option_ref, - clippy::equatable_if_let, - clippy::let_unit_value, - clippy::redundant_locals, - clippy::manual_midpoint, - clippy::manual_unwrap_or_default, clippy::manual_unwrap_or, - clippy::unnecessary_option_map_or_else, - clippy::map_or_identity + clippy::map_or_identity, + clippy::unnecessary_option_map_or_else )] +#![expect(clippy::let_unit_value, clippy::redundant_locals)] fn bad1(string: Option<&str>) -> (bool, &str) { string.map_or((false, "hello"), |x| (true, x)) @@ -227,7 +222,6 @@ fn main() { //~^ option_if_let_else } -#[allow(dead_code)] fn issue9742() -> Option<&'static str> { // should not lint because of guards match Some("foo ") { @@ -237,7 +231,7 @@ fn issue9742() -> Option<&'static str> { } mod issue10729 { - #![allow(clippy::unit_arg, dead_code)] + #![allow(clippy::unit_arg)] pub fn reproduce(initial: &Option) { // 👇 needs `.as_ref()` because initial is an `&Option<_>` diff --git a/tests/ui/option_if_let_else.rs b/tests/ui/option_if_let_else.rs index c41394a1e35e..db83dfe0bd84 100644 --- a/tests/ui/option_if_let_else.rs +++ b/tests/ui/option_if_let_else.rs @@ -1,15 +1,10 @@ #![warn(clippy::option_if_let_else)] #![allow( - clippy::ref_option_ref, - clippy::equatable_if_let, - clippy::let_unit_value, - clippy::redundant_locals, - clippy::manual_midpoint, - clippy::manual_unwrap_or_default, clippy::manual_unwrap_or, - clippy::unnecessary_option_map_or_else, - clippy::map_or_identity + clippy::map_or_identity, + clippy::unnecessary_option_map_or_else )] +#![expect(clippy::let_unit_value, clippy::redundant_locals)] fn bad1(string: Option<&str>) -> (bool, &str) { if let Some(x) = string { @@ -283,7 +278,6 @@ fn main() { //~^ option_if_let_else } -#[allow(dead_code)] fn issue9742() -> Option<&'static str> { // should not lint because of guards match Some("foo ") { @@ -293,7 +287,7 @@ fn issue9742() -> Option<&'static str> { } mod issue10729 { - #![allow(clippy::unit_arg, dead_code)] + #![allow(clippy::unit_arg)] pub fn reproduce(initial: &Option) { // 👇 needs `.as_ref()` because initial is an `&Option<_>` diff --git a/tests/ui/option_if_let_else.stderr b/tests/ui/option_if_let_else.stderr index 7e5df7c53110..a0838dccc69e 100644 --- a/tests/ui/option_if_let_else.stderr +++ b/tests/ui/option_if_let_else.stderr @@ -1,5 +1,5 @@ error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:15:5 + --> tests/ui/option_if_let_else.rs:10:5 | LL | / if let Some(x) = string { LL | | @@ -13,19 +13,19 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:34:13 + --> tests/ui/option_if_let_else.rs:29:13 | LL | let _ = if let Some(s) = *string { s.len() } else { 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:36:13 + --> tests/ui/option_if_let_else.rs:31:13 | LL | let _ = if let Some(s) = &num { s } else { &0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:38:13 + --> tests/ui/option_if_let_else.rs:33:13 | LL | let _ = if let Some(s) = &mut num { | _____________^ @@ -47,13 +47,13 @@ LL ~ }); | error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:45:13 + --> tests/ui/option_if_let_else.rs:40:13 | LL | let _ = if let Some(ref s) = num { s } else { &0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:47:13 + --> tests/ui/option_if_let_else.rs:42:13 | LL | let _ = if let Some(mut s) = num { | _____________^ @@ -75,7 +75,7 @@ LL ~ }); | error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:54:13 + --> tests/ui/option_if_let_else.rs:49:13 | LL | let _ = if let Some(ref mut s) = num { | _____________^ @@ -97,7 +97,7 @@ LL ~ }); | error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:64:5 + --> tests/ui/option_if_let_else.rs:59:5 | LL | / if let Some(x) = arg { LL | | @@ -118,7 +118,7 @@ LL + }) | error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:78:13 + --> tests/ui/option_if_let_else.rs:73:13 | LL | let _ = if let Some(x) = arg { | _____________^ @@ -131,7 +131,7 @@ LL | | }; | |_____^ help: try: `arg.map_or_else(side_effect, |x| x)` error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:88:13 + --> tests/ui/option_if_let_else.rs:83:13 | LL | let _ = if let Some(x) = arg { | _____________^ @@ -154,7 +154,7 @@ LL ~ }, |x| x * x * x * x); | error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:122:13 + --> tests/ui/option_if_let_else.rs:117:13 | LL | / if let Some(idx) = s.find('.') { LL | | @@ -165,7 +165,7 @@ LL | | } | |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])` error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:134:5 + --> tests/ui/option_if_let_else.rs:129:5 | LL | / if let Ok(binding) = variable { LL | | @@ -189,7 +189,7 @@ LL + }) | error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:159:5 + --> tests/ui/option_if_let_else.rs:154:5 | LL | / match r { LL | | @@ -199,7 +199,7 @@ LL | | } | |_____^ help: try: `r.map_or_else(|_| Vec::new(), |s| s.to_owned())` error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:168:5 + --> tests/ui/option_if_let_else.rs:163:5 | LL | / if let Ok(s) = r { s.to_owned() } LL | | @@ -207,13 +207,13 @@ LL | | else { Vec::new() } | |_______________________^ help: try: `r.map_or_else(|_| Vec::new(), |s| s.to_owned())` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:175:13 + --> tests/ui/option_if_let_else.rs:170:13 | LL | let _ = if let Some(x) = optional { x + 2 } else { 5 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:186:13 + --> tests/ui/option_if_let_else.rs:181:13 | LL | let _ = if let Some(x) = Some(0) { | _____________^ @@ -235,13 +235,13 @@ LL ~ }); | error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:215:13 + --> tests/ui/option_if_let_else.rs:210:13 | LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:220:13 + --> tests/ui/option_if_let_else.rs:215:13 | LL | let _ = if let Some(x) = Some(0) { | _____________^ @@ -263,7 +263,7 @@ LL ~ }); | error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:260:13 + --> tests/ui/option_if_let_else.rs:255:13 | LL | let _ = match s { | _____________^ @@ -274,7 +274,7 @@ LL | | }; | |_____^ help: try: `s.map_or(1, |string| string.len())` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:265:13 + --> tests/ui/option_if_let_else.rs:260:13 | LL | let _ = match Some(10) { | _____________^ @@ -285,7 +285,7 @@ LL | | }; | |_____^ help: try: `Some(10).map_or(5, |a| a + 1)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:272:13 + --> tests/ui/option_if_let_else.rs:267:13 | LL | let _ = match res { | _____________^ @@ -296,7 +296,7 @@ LL | | }; | |_____^ help: try: `res.map_or(1, |a| a + 1)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:277:13 + --> tests/ui/option_if_let_else.rs:272:13 | LL | let _ = match res { | _____________^ @@ -307,13 +307,13 @@ LL | | }; | |_____^ help: try: `res.map_or(1, |a| a + 1)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:282:13 + --> tests/ui/option_if_let_else.rs:277:13 | LL | let _ = if let Ok(a) = res { a + 1 } else { 5 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:300:17 + --> tests/ui/option_if_let_else.rs:294:17 | LL | let _ = match initial { | _________________^ @@ -324,7 +324,7 @@ LL | | }; | |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:308:17 + --> tests/ui/option_if_let_else.rs:302:17 | LL | let _ = match initial { | _________________^ @@ -335,7 +335,7 @@ LL | | }; | |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))` error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:332:24 + --> tests/ui/option_if_let_else.rs:326:24 | LL | let mut _hashmap = if let Some(hm) = &opt { | ________________________^ @@ -347,19 +347,19 @@ LL | | }; | |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())` error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:339:19 + --> tests/ui/option_if_let_else.rs:333:19 | LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())` error: use Option::map_or instead of an if let/else - --> tests/ui/option_if_let_else.rs:390:22 + --> tests/ui/option_if_let_else.rs:384:22 | LL | let _ = unsafe { if let Some(o) = *opt_raw_ptr { o } else { 1 } }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*opt_raw_ptr).map_or(1, |o| o)` error: use Option::map_or_else instead of an if let/else - --> tests/ui/option_if_let_else.rs:396:13 + --> tests/ui/option_if_let_else.rs:390:13 | LL | let _ = match res { | _____________^ diff --git a/tests/ui/option_map_unit_fn_unfixable.rs b/tests/ui/option_map_unit_fn_unfixable.rs index a6d7ea4a4c8d..8faeb8155cc2 100644 --- a/tests/ui/option_map_unit_fn_unfixable.rs +++ b/tests/ui/option_map_unit_fn_unfixable.rs @@ -1,6 +1,6 @@ //@no-rustfix #![warn(clippy::option_map_unit_fn)] -#![allow(clippy::unnecessary_wraps, clippy::unnecessary_map_on_constructor)] // only fires before the fix +#![expect(clippy::unnecessary_map_on_constructor)] fn do_nothing(_: T) {} diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed index 1633161c4264..db65a33ecdcf 100644 --- a/tests/ui/or_fun_call.fixed +++ b/tests/ui/or_fun_call.fixed @@ -1,14 +1,10 @@ #![warn(clippy::or_fun_call)] #![allow( - clippy::borrow_as_ptr, - clippy::uninlined_format_args, - clippy::unnecessary_wraps, - clippy::unnecessary_literal_unwrap, - clippy::unnecessary_result_map_or_else, - clippy::unnecessary_option_map_or_else, clippy::map_or_identity, - clippy::useless_vec + clippy::unnecessary_option_map_or_else, + clippy::unnecessary_result_map_or_else )] +#![expect(clippy::unnecessary_literal_unwrap, clippy::useless_vec)] use std::collections::{BTreeMap, HashMap}; use std::time::Duration; @@ -198,7 +194,6 @@ fn f() -> Option<()> { mod issue6675 { unsafe fn ptr_to_ref<'a, T>(p: *const T) -> &'a T { unsafe { - #[allow(unused)] let x = vec![0; 1000]; // future-proofing, make this function expensive. &*p } diff --git a/tests/ui/or_fun_call.rs b/tests/ui/or_fun_call.rs index 55339348e2bc..6c31be62f1f5 100644 --- a/tests/ui/or_fun_call.rs +++ b/tests/ui/or_fun_call.rs @@ -1,14 +1,10 @@ #![warn(clippy::or_fun_call)] #![allow( - clippy::borrow_as_ptr, - clippy::uninlined_format_args, - clippy::unnecessary_wraps, - clippy::unnecessary_literal_unwrap, - clippy::unnecessary_result_map_or_else, - clippy::unnecessary_option_map_or_else, clippy::map_or_identity, - clippy::useless_vec + clippy::unnecessary_option_map_or_else, + clippy::unnecessary_result_map_or_else )] +#![expect(clippy::unnecessary_literal_unwrap, clippy::useless_vec)] use std::collections::{BTreeMap, HashMap}; use std::time::Duration; @@ -198,7 +194,6 @@ fn f() -> Option<()> { mod issue6675 { unsafe fn ptr_to_ref<'a, T>(p: *const T) -> &'a T { unsafe { - #[allow(unused)] let x = vec![0; 1000]; // future-proofing, make this function expensive. &*p } diff --git a/tests/ui/or_fun_call.stderr b/tests/ui/or_fun_call.stderr index 934af4656ea3..32d93bab3633 100644 --- a/tests/ui/or_fun_call.stderr +++ b/tests/ui/or_fun_call.stderr @@ -1,5 +1,5 @@ error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:54:22 + --> tests/ui/or_fun_call.rs:50:22 | LL | with_constructor.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(make)` @@ -8,7 +8,7 @@ LL | with_constructor.unwrap_or(make()); = help: to override `-D warnings` add `#[allow(clippy::or_fun_call)]` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:58:14 + --> tests/ui/or_fun_call.rs:54:14 | LL | with_new.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` @@ -17,205 +17,205 @@ LL | with_new.unwrap_or(Vec::new()); = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:62:21 + --> tests/ui/or_fun_call.rs:58:21 | LL | with_const_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Vec::with_capacity(12))` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:66:14 + --> tests/ui/or_fun_call.rs:62:14 | LL | with_err.unwrap_or(make()); | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:70:19 + --> tests/ui/or_fun_call.rs:66:19 | LL | with_err_args.unwrap_or(Vec::with_capacity(12)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:74:24 + --> tests/ui/or_fun_call.rs:70:24 | LL | with_default_trait.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:78:23 + --> tests/ui/or_fun_call.rs:74:23 | LL | with_default_type.unwrap_or(u64::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:98:18 + --> tests/ui/or_fun_call.rs:94:18 | LL | self_default.unwrap_or(::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(::default)` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:102:18 + --> tests/ui/or_fun_call.rs:98:18 | LL | real_default.unwrap_or(::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:106:14 + --> tests/ui/or_fun_call.rs:102:14 | LL | with_vec.unwrap_or(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:110:21 + --> tests/ui/or_fun_call.rs:106:21 | LL | without_default.unwrap_or(Foo::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)` error: use of `or_insert` to construct default value - --> tests/ui/or_fun_call.rs:114:19 + --> tests/ui/or_fun_call.rs:110:19 | LL | map.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` error: use of `or_insert` to construct default value - --> tests/ui/or_fun_call.rs:118:23 + --> tests/ui/or_fun_call.rs:114:23 | LL | map_vec.entry(42).or_insert(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` error: use of `or_insert` to construct default value - --> tests/ui/or_fun_call.rs:122:21 + --> tests/ui/or_fun_call.rs:118:21 | LL | btree.entry(42).or_insert(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` error: use of `or_insert` to construct default value - --> tests/ui/or_fun_call.rs:126:25 + --> tests/ui/or_fun_call.rs:122:25 | LL | btree_vec.entry(42).or_insert(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:130:21 + --> tests/ui/or_fun_call.rs:126:21 | LL | let _ = stringy.unwrap_or(String::new()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: function call inside of `ok_or` - --> tests/ui/or_fun_call.rs:135:17 + --> tests/ui/or_fun_call.rs:131:17 | LL | let _ = opt.ok_or(format!("{} world.", hello)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:140:21 + --> tests/ui/or_fun_call.rs:136:21 | LL | let _ = Some(1).unwrap_or(map[&1]); | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:143:21 + --> tests/ui/or_fun_call.rs:139:21 | LL | let _ = Some(1).unwrap_or(map[&1]); | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])` error: function call inside of `or` - --> tests/ui/or_fun_call.rs:168:35 + --> tests/ui/or_fun_call.rs:164:35 | LL | let _ = Some("a".to_string()).or(Some("b".to_string())); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:211:18 + --> tests/ui/or_fun_call.rs:206:18 | LL | None.unwrap_or(ptr_to_ref(s)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:219:14 + --> tests/ui/or_fun_call.rs:214:14 | LL | None.unwrap_or(unsafe { ptr_to_ref(s) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:222:14 + --> tests/ui/or_fun_call.rs:217:14 | LL | None.unwrap_or( unsafe { ptr_to_ref(s) } ); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })` error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:298:25 + --> tests/ui/or_fun_call.rs:293:25 | LL | let _ = Some(4).map_or(g(), |v| v); | ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)` error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:300:25 + --> tests/ui/or_fun_call.rs:295:25 | LL | let _ = Some(4).map_or(g(), f); | ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)` error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:303:25 + --> tests/ui/or_fun_call.rs:298:25 | LL | let _ = Some(4).map_or("asd".to_string().len() as i32, f); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| "asd".to_string().len() as i32, f)` error: use of `unwrap_or_else` to construct default value - --> tests/ui/or_fun_call.rs:334:18 + --> tests/ui/or_fun_call.rs:329:18 | LL | with_new.unwrap_or_else(Vec::new); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/or_fun_call.rs:338:28 + --> tests/ui/or_fun_call.rs:333:28 | LL | with_default_trait.unwrap_or_else(Default::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/or_fun_call.rs:342:27 + --> tests/ui/or_fun_call.rs:337:27 | LL | with_default_type.unwrap_or_else(u64::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/or_fun_call.rs:346:22 + --> tests/ui/or_fun_call.rs:341:22 | LL | real_default.unwrap_or_else(::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `or_insert_with` to construct default value - --> tests/ui/or_fun_call.rs:350:23 + --> tests/ui/or_fun_call.rs:345:23 | LL | map.entry(42).or_insert_with(String::new); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` error: use of `or_insert_with` to construct default value - --> tests/ui/or_fun_call.rs:354:25 + --> tests/ui/or_fun_call.rs:349:25 | LL | btree.entry(42).or_insert_with(String::new); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/or_fun_call.rs:358:25 + --> tests/ui/or_fun_call.rs:353:25 | LL | let _ = stringy.unwrap_or_else(String::new); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:400:17 + --> tests/ui/or_fun_call.rs:395:17 | LL | let _ = opt.unwrap_or({ f() }); // suggest `.unwrap_or_else(f)` | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(f)` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:405:17 + --> tests/ui/or_fun_call.rs:400:17 | LL | let _ = opt.unwrap_or(f() + 1); // suggest `.unwrap_or_else(|| f() + 1)` | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| f() + 1)` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:410:17 + --> tests/ui/or_fun_call.rs:405:17 | LL | let _ = opt.unwrap_or({ | _________________^ @@ -235,79 +235,79 @@ LL ~ }); | error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:416:17 + --> tests/ui/or_fun_call.rs:411:17 | LL | let _ = opt.map_or(f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)` | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| f() + 1, |v| v)` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:421:17 + --> tests/ui/or_fun_call.rs:416:17 | LL | let _ = opt.unwrap_or({ i32::default() }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:428:21 + --> tests/ui/or_fun_call.rs:423:21 | LL | let _ = opt_foo.unwrap_or(Foo { val: String::default() }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })` error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:443:19 + --> tests/ui/or_fun_call.rs:438:19 | LL | let _ = x.map_or(g(), |v| v); | ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), |v| v)` error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:445:19 + --> tests/ui/or_fun_call.rs:440:19 | LL | let _ = x.map_or(g(), f); | ^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), f)` error: function call inside of `map_or` - --> tests/ui/or_fun_call.rs:448:19 + --> tests/ui/or_fun_call.rs:443:19 | LL | let _ = x.map_or("asd".to_string().len() as i32, f); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| "asd".to_string().len() as i32, f)` error: function call inside of `get_or_insert` - --> tests/ui/or_fun_call.rs:459:15 + --> tests/ui/or_fun_call.rs:454:15 | LL | let _ = x.get_or_insert(g()); | ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)` error: function call inside of `and` - --> tests/ui/or_fun_call.rs:469:15 + --> tests/ui/or_fun_call.rs:464:15 | LL | let _ = x.and(g()); | ^^^^^^^^ help: try: `and_then(|_| g())` error: function call inside of `and` - --> tests/ui/or_fun_call.rs:479:15 + --> tests/ui/or_fun_call.rs:474:15 | LL | let _ = x.and(g()); | ^^^^^^^^ help: try: `and_then(|_| g())` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:485:17 + --> tests/ui/or_fun_call.rs:480:17 | LL | let _ = opt.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: function call inside of `unwrap_or` - --> tests/ui/or_fun_call.rs:487:17 + --> tests/ui/or_fun_call.rs:482:17 | LL | let _ = res.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Default::default())` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:493:17 + --> tests/ui/or_fun_call.rs:488:17 | LL | let _ = opt.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or` to construct default value - --> tests/ui/or_fun_call.rs:495:17 + --> tests/ui/or_fun_call.rs:490:17 | LL | let _ = res.unwrap_or(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` diff --git a/tests/ui/or_then_unwrap.fixed b/tests/ui/or_then_unwrap.fixed index 9660b82fe7d6..35b53bbb8116 100644 --- a/tests/ui/or_then_unwrap.fixed +++ b/tests/ui/or_then_unwrap.fixed @@ -1,5 +1,6 @@ #![warn(clippy::or_then_unwrap)] -#![allow(clippy::map_identity, clippy::let_unit_value, clippy::unnecessary_literal_unwrap)] +#![allow(clippy::unnecessary_literal_unwrap)] +#![expect(clippy::let_unit_value, clippy::map_identity)] struct SomeStruct; impl SomeStruct { diff --git a/tests/ui/or_then_unwrap.rs b/tests/ui/or_then_unwrap.rs index c38733521164..c3d68a0d3a44 100644 --- a/tests/ui/or_then_unwrap.rs +++ b/tests/ui/or_then_unwrap.rs @@ -1,5 +1,6 @@ #![warn(clippy::or_then_unwrap)] -#![allow(clippy::map_identity, clippy::let_unit_value, clippy::unnecessary_literal_unwrap)] +#![allow(clippy::unnecessary_literal_unwrap)] +#![expect(clippy::let_unit_value, clippy::map_identity)] struct SomeStruct; impl SomeStruct { diff --git a/tests/ui/or_then_unwrap.stderr b/tests/ui/or_then_unwrap.stderr index 3e66b15edbd6..828e569571e8 100644 --- a/tests/ui/or_then_unwrap.stderr +++ b/tests/ui/or_then_unwrap.stderr @@ -1,5 +1,5 @@ error: found `.or(Some(…)).unwrap()` - --> tests/ui/or_then_unwrap.rs:22:20 + --> tests/ui/or_then_unwrap.rs:23:20 | LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")` @@ -8,19 +8,19 @@ LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint = help: to override `-D warnings` add `#[allow(clippy::or_then_unwrap)]` error: found `.or(Ok(…)).unwrap()` - --> tests/ui/or_then_unwrap.rs:27:20 + --> tests/ui/or_then_unwrap.rs:28:20 | LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")` error: found `.or(Some(…)).unwrap()` - --> tests/ui/or_then_unwrap.rs:33:20 + --> tests/ui/or_then_unwrap.rs:34:20 | LL | let _ = option.or(Some(vec!["fallback"])).unwrap(); // should trigger lint | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or(vec!["fallback"])` error: found `.or(Some(…)).unwrap()` - --> tests/ui/or_then_unwrap.rs:39:31 + --> tests/ui/or_then_unwrap.rs:40:31 | LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or("fallback")` diff --git a/tests/ui/out_of_bounds_indexing/issue-3102.rs b/tests/ui/out_of_bounds_indexing/issue-3102.rs index e1e0fa02a937..fa2a8dab1306 100644 --- a/tests/ui/out_of_bounds_indexing/issue-3102.rs +++ b/tests/ui/out_of_bounds_indexing/issue-3102.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect)] +#![expect(clippy::no_effect)] fn main() { let x = [1, 2, 3, 4]; diff --git a/tests/ui/out_of_bounds_indexing/simple.rs b/tests/ui/out_of_bounds_indexing/simple.rs index e613e527eee4..dbd00eabcef8 100644 --- a/tests/ui/out_of_bounds_indexing/simple.rs +++ b/tests/ui/out_of_bounds_indexing/simple.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect, clippy::unnecessary_operation)] +#![expect(clippy::no_effect, clippy::unnecessary_operation)] fn main() { let x = [1, 2, 3, 4]; diff --git a/tests/ui/overly_complex_bool_expr.fixed b/tests/ui/overly_complex_bool_expr.fixed index 6818f96725e7..6d129c906eca 100644 --- a/tests/ui/overly_complex_bool_expr.fixed +++ b/tests/ui/overly_complex_bool_expr.fixed @@ -1,5 +1,5 @@ -#![allow(unused, clippy::diverging_sub_expression)] #![warn(clippy::overly_complex_bool_expr)] +#![expect(clippy::diverging_sub_expression)] fn main() { let a: bool = unimplemented!(); diff --git a/tests/ui/overly_complex_bool_expr.rs b/tests/ui/overly_complex_bool_expr.rs index f1cd9562a855..1e01c84ec8da 100644 --- a/tests/ui/overly_complex_bool_expr.rs +++ b/tests/ui/overly_complex_bool_expr.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::diverging_sub_expression)] #![warn(clippy::overly_complex_bool_expr)] +#![expect(clippy::diverging_sub_expression)] fn main() { let a: bool = unimplemented!(); diff --git a/tests/ui/panic_in_result_fn.rs b/tests/ui/panic_in_result_fn.rs index 005e38db9021..26a4a61e5f82 100644 --- a/tests/ui/panic_in_result_fn.rs +++ b/tests/ui/panic_in_result_fn.rs @@ -1,5 +1,5 @@ #![warn(clippy::panic_in_result_fn)] -#![allow(clippy::unnecessary_wraps)] +#![expect(clippy::unnecessary_wraps)] struct A; impl A { diff --git a/tests/ui/panic_in_result_fn_assertions.rs b/tests/ui/panic_in_result_fn_assertions.rs index 17b221044b1f..879f25f5d68f 100644 --- a/tests/ui/panic_in_result_fn_assertions.rs +++ b/tests/ui/panic_in_result_fn_assertions.rs @@ -1,5 +1,5 @@ #![warn(clippy::panic_in_result_fn)] -#![allow(clippy::uninlined_format_args, clippy::unnecessary_wraps)] +#![expect(clippy::uninlined_format_args, clippy::unnecessary_wraps)] struct A; diff --git a/tests/ui/panic_in_result_fn_debug_assertions.rs b/tests/ui/panic_in_result_fn_debug_assertions.rs index 9cce339f4d60..23985eeaccbd 100644 --- a/tests/ui/panic_in_result_fn_debug_assertions.rs +++ b/tests/ui/panic_in_result_fn_debug_assertions.rs @@ -1,7 +1,7 @@ //@ check-pass #![warn(clippy::panic_in_result_fn)] -#![allow(clippy::uninlined_format_args, clippy::unnecessary_wraps)] +#![expect(clippy::uninlined_format_args, clippy::unnecessary_wraps)] // debug_assert should never trigger the `panic_in_result_fn` lint diff --git a/tests/ui/panicking_macros.rs b/tests/ui/panicking_macros.rs index a9728d4708e6..5f6941f1f4b0 100644 --- a/tests/ui/panicking_macros.rs +++ b/tests/ui/panicking_macros.rs @@ -1,5 +1,5 @@ -#![allow(clippy::assertions_on_constants, clippy::eq_op, clippy::let_unit_value)] -#![warn(clippy::unimplemented, clippy::unreachable, clippy::todo, clippy::panic)] +#![warn(clippy::panic, clippy::todo, clippy::unimplemented, clippy::unreachable)] +#![expect(clippy::assertions_on_constants, clippy::eq_op, clippy::let_unit_value)] extern crate core; diff --git a/tests/ui/panicking_overflow_checks.rs b/tests/ui/panicking_overflow_checks.rs index ecae3130fd50..de0aa70d3ff8 100644 --- a/tests/ui/panicking_overflow_checks.rs +++ b/tests/ui/panicking_overflow_checks.rs @@ -1,5 +1,5 @@ #![warn(clippy::panicking_overflow_checks)] -#![allow(clippy::needless_ifs)] +#![expect(clippy::needless_ifs)] fn test(a: u32, b: u32, c: u32) { if a + b < a {} diff --git a/tests/ui/partial_pub_fields.rs b/tests/ui/partial_pub_fields.rs index 27f4b2a0b4fc..c4ed63b758c8 100644 --- a/tests/ui/partial_pub_fields.rs +++ b/tests/ui/partial_pub_fields.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::partial_pub_fields)] fn main() { diff --git a/tests/ui/partial_pub_fields.stderr b/tests/ui/partial_pub_fields.stderr index af3b2f758757..2e74bf2cb47e 100644 --- a/tests/ui/partial_pub_fields.stderr +++ b/tests/ui/partial_pub_fields.stderr @@ -1,5 +1,5 @@ error: mixed usage of pub and non-pub fields - --> tests/ui/partial_pub_fields.rs:10:9 + --> tests/ui/partial_pub_fields.rs:9:9 | LL | pub paths: HashMap, | ^^^ @@ -9,7 +9,7 @@ LL | pub paths: HashMap, = help: to override `-D warnings` add `#[allow(clippy::partial_pub_fields)]` error: mixed usage of pub and non-pub fields - --> tests/ui/partial_pub_fields.rs:17:9 + --> tests/ui/partial_pub_fields.rs:16:9 | LL | b: u8, | ^ @@ -17,7 +17,7 @@ LL | b: u8, = help: consider using public field here error: mixed usage of pub and non-pub fields - --> tests/ui/partial_pub_fields.rs:21:27 + --> tests/ui/partial_pub_fields.rs:20:27 | LL | pub struct Point(i32, pub i32); | ^^^ @@ -25,7 +25,7 @@ LL | pub struct Point(i32, pub i32); = help: consider using private field here error: mixed usage of pub and non-pub fields - --> tests/ui/partial_pub_fields.rs:26:9 + --> tests/ui/partial_pub_fields.rs:25:9 | LL | pub pos: u32, | ^^^ diff --git a/tests/ui/partialeq_ne_impl.rs b/tests/ui/partialeq_ne_impl.rs index a3b2b68708ba..343402f7a72c 100644 --- a/tests/ui/partialeq_ne_impl.rs +++ b/tests/ui/partialeq_ne_impl.rs @@ -1,5 +1,4 @@ -#![allow(dead_code)] - +#![warn(clippy::partialeq_ne_impl)] struct Foo; impl PartialEq for Foo { diff --git a/tests/ui/partialeq_ne_impl.stderr b/tests/ui/partialeq_ne_impl.stderr index 0f700654f7cc..9353db1c90bf 100644 --- a/tests/ui/partialeq_ne_impl.stderr +++ b/tests/ui/partialeq_ne_impl.stderr @@ -1,5 +1,5 @@ error: re-implementing `PartialEq::ne` is unnecessary - --> tests/ui/partialeq_ne_impl.rs:9:5 + --> tests/ui/partialeq_ne_impl.rs:8:5 | LL | fn ne(&self, _: &Foo) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/partialeq_to_none.fixed b/tests/ui/partialeq_to_none.fixed index 9288529423dd..9f9edb2e2448 100644 --- a/tests/ui/partialeq_to_none.fixed +++ b/tests/ui/partialeq_to_none.fixed @@ -1,5 +1,5 @@ #![warn(clippy::partialeq_to_none)] -#![allow(clippy::eq_op, clippy::needless_ifs)] +#![expect(clippy::eq_op, clippy::needless_ifs)] struct Foobar; @@ -9,7 +9,6 @@ impl PartialEq> for Foobar { } } -#[allow(dead_code)] fn foo(f: Option) -> &'static str { if f.is_some() { "yay" } else { "nay" } //~^ partialeq_to_none diff --git a/tests/ui/partialeq_to_none.rs b/tests/ui/partialeq_to_none.rs index 7940251c18a2..a82a33f154dd 100644 --- a/tests/ui/partialeq_to_none.rs +++ b/tests/ui/partialeq_to_none.rs @@ -1,5 +1,5 @@ #![warn(clippy::partialeq_to_none)] -#![allow(clippy::eq_op, clippy::needless_ifs)] +#![expect(clippy::eq_op, clippy::needless_ifs)] struct Foobar; @@ -9,7 +9,6 @@ impl PartialEq> for Foobar { } } -#[allow(dead_code)] fn foo(f: Option) -> &'static str { if f != None { "yay" } else { "nay" } //~^ partialeq_to_none diff --git a/tests/ui/partialeq_to_none.stderr b/tests/ui/partialeq_to_none.stderr index b09bd7fa0f42..31b73051b0e4 100644 --- a/tests/ui/partialeq_to_none.stderr +++ b/tests/ui/partialeq_to_none.stderr @@ -1,5 +1,5 @@ error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:14:8 + --> tests/ui/partialeq_to_none.rs:13:8 | LL | if f != None { "yay" } else { "nay" } | ^^^^^^^^^ help: use `Option::is_some()` instead: `f.is_some()` @@ -8,55 +8,55 @@ LL | if f != None { "yay" } else { "nay" } = help: to override `-D warnings` add `#[allow(clippy::partialeq_to_none)]` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:45:13 + --> tests/ui/partialeq_to_none.rs:44:13 | LL | let _ = x == None; | ^^^^^^^^^ help: use `Option::is_none()` instead: `x.is_none()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:47:13 + --> tests/ui/partialeq_to_none.rs:46:13 | LL | let _ = x != None; | ^^^^^^^^^ help: use `Option::is_some()` instead: `x.is_some()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:49:13 + --> tests/ui/partialeq_to_none.rs:48:13 | LL | let _ = None == x; | ^^^^^^^^^ help: use `Option::is_none()` instead: `x.is_none()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:51:13 + --> tests/ui/partialeq_to_none.rs:50:13 | LL | let _ = None != x; | ^^^^^^^^^ help: use `Option::is_some()` instead: `x.is_some()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:54:8 + --> tests/ui/partialeq_to_none.rs:53:8 | LL | if foobar() == None {} | ^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `foobar().is_none()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:57:8 + --> tests/ui/partialeq_to_none.rs:56:8 | LL | if bar().ok() != None {} | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `bar().ok().is_some()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:60:13 + --> tests/ui/partialeq_to_none.rs:59:13 | LL | let _ = Some(1 + 2) != None; | ^^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `Some(1 + 2).is_some()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:63:13 + --> tests/ui/partialeq_to_none.rs:62:13 | LL | let _ = { Some(0) } == None; | ^^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `{ Some(0) }.is_none()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:66:13 + --> tests/ui/partialeq_to_none.rs:65:13 | LL | let _ = { | _____________^ @@ -80,31 +80,31 @@ LL ~ }.is_some(); | error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:77:13 + --> tests/ui/partialeq_to_none.rs:76:13 | LL | let _ = optref() == &&None; | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `optref().is_none()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:79:13 + --> tests/ui/partialeq_to_none.rs:78:13 | LL | let _ = &&None != optref(); | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `optref().is_some()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:81:13 + --> tests/ui/partialeq_to_none.rs:80:13 | LL | let _ = **optref() == None; | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `optref().is_none()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:83:13 + --> tests/ui/partialeq_to_none.rs:82:13 | LL | let _ = &None != *optref(); | ^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `optref().is_some()` error: binary comparison to literal `Option::None` - --> tests/ui/partialeq_to_none.rs:87:13 + --> tests/ui/partialeq_to_none.rs:86:13 | LL | let _ = None != *x; | ^^^^^^^^^^ help: use `Option::is_some()` instead: `(*x).is_some()` diff --git a/tests/ui/pattern_type_mismatch/mutability.rs b/tests/ui/pattern_type_mismatch/mutability.rs index 643d8fedda98..eacc86962d56 100644 --- a/tests/ui/pattern_type_mismatch/mutability.rs +++ b/tests/ui/pattern_type_mismatch/mutability.rs @@ -1,5 +1,5 @@ #![warn(clippy::pattern_type_mismatch)] -#![allow(clippy::single_match)] +#![expect(clippy::single_match)] fn main() {} diff --git a/tests/ui/pattern_type_mismatch/syntax.rs b/tests/ui/pattern_type_mismatch/syntax.rs index aa988a577df2..852120b0105a 100644 --- a/tests/ui/pattern_type_mismatch/syntax.rs +++ b/tests/ui/pattern_type_mismatch/syntax.rs @@ -1,5 +1,5 @@ #![warn(clippy::pattern_type_mismatch)] -#![allow( +#![expect( clippy::match_ref_pats, clippy::never_loop, clippy::redundant_pattern_matching, diff --git a/tests/ui/patterns.fixed b/tests/ui/patterns.fixed index a6dd5fd63a9f..51225c5a1dee 100644 --- a/tests/ui/patterns.fixed +++ b/tests/ui/patterns.fixed @@ -1,5 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::uninlined_format_args, clippy::single_match)] +#![warn(clippy::redundant_pattern)] +#![expect(clippy::single_match, clippy::uninlined_format_args)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/patterns.rs b/tests/ui/patterns.rs index 64bfbdecdac2..667668319a47 100644 --- a/tests/ui/patterns.rs +++ b/tests/ui/patterns.rs @@ -1,5 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::uninlined_format_args, clippy::single_match)] +#![warn(clippy::redundant_pattern)] +#![expect(clippy::single_match, clippy::uninlined_format_args)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/patterns.stderr b/tests/ui/patterns.stderr index ff5e1a8de90a..20e385780f8b 100644 --- a/tests/ui/patterns.stderr +++ b/tests/ui/patterns.stderr @@ -1,5 +1,5 @@ error: the `y @ _` pattern can be written as just `y` - --> tests/ui/patterns.rs:12:9 + --> tests/ui/patterns.rs:13:9 | LL | y @ _ => (), | ^^^^^ help: try: `y` @@ -8,13 +8,13 @@ LL | y @ _ => (), = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern)]` error: the `x @ _` pattern can be written as just `x` - --> tests/ui/patterns.rs:28:9 + --> tests/ui/patterns.rs:29:9 | LL | ref mut x @ _ => { | ^^^^^^^^^^^^^ help: try: `ref mut x` error: the `x @ _` pattern can be written as just `x` - --> tests/ui/patterns.rs:37:9 + --> tests/ui/patterns.rs:38:9 | LL | ref x @ _ => println!("vec: {:?}", x), | ^^^^^^^^^ help: try: `ref x` diff --git a/tests/ui/permissions_set_readonly_false.rs b/tests/ui/permissions_set_readonly_false.rs index ccca523da551..bd4dff8bf1d0 100644 --- a/tests/ui/permissions_set_readonly_false.rs +++ b/tests/ui/permissions_set_readonly_false.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::permissions_set_readonly_false)] use std::fs::File; diff --git a/tests/ui/permissions_set_readonly_false.stderr b/tests/ui/permissions_set_readonly_false.stderr index 4e0a8e39db7f..105a36799b4c 100644 --- a/tests/ui/permissions_set_readonly_false.stderr +++ b/tests/ui/permissions_set_readonly_false.stderr @@ -1,5 +1,5 @@ error: call to `set_readonly` with argument `false` - --> tests/ui/permissions_set_readonly_false.rs:19:5 + --> tests/ui/permissions_set_readonly_false.rs:18:5 | LL | permissions.set_readonly(false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/precedence.fixed b/tests/ui/precedence.fixed index f0252c4484a5..b9c67c0baa63 100644 --- a/tests/ui/precedence.fixed +++ b/tests/ui/precedence.fixed @@ -1,12 +1,5 @@ #![warn(clippy::precedence)] -#![allow( - unused_must_use, - clippy::no_effect, - clippy::unnecessary_operation, - clippy::clone_on_copy, - clippy::identity_op, - clippy::eq_op -)] +#![expect(clippy::clone_on_copy, clippy::eq_op, clippy::identity_op, clippy::no_effect)] macro_rules! trip { ($a:expr) => { diff --git a/tests/ui/precedence.rs b/tests/ui/precedence.rs index 5d47462114b8..8333f887f46e 100644 --- a/tests/ui/precedence.rs +++ b/tests/ui/precedence.rs @@ -1,12 +1,5 @@ #![warn(clippy::precedence)] -#![allow( - unused_must_use, - clippy::no_effect, - clippy::unnecessary_operation, - clippy::clone_on_copy, - clippy::identity_op, - clippy::eq_op -)] +#![expect(clippy::clone_on_copy, clippy::eq_op, clippy::identity_op, clippy::no_effect)] macro_rules! trip { ($a:expr) => { diff --git a/tests/ui/precedence.stderr b/tests/ui/precedence.stderr index f086cfe02890..080f48cb5ba1 100644 --- a/tests/ui/precedence.stderr +++ b/tests/ui/precedence.stderr @@ -1,5 +1,5 @@ error: operator precedence might not be obvious - --> tests/ui/precedence.rs:21:5 + --> tests/ui/precedence.rs:14:5 | LL | 1 << 2 + 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `1 << (2 + 3)` @@ -8,43 +8,43 @@ LL | 1 << 2 + 3; = help: to override `-D warnings` add `#[allow(clippy::precedence)]` error: operator precedence might not be obvious - --> tests/ui/precedence.rs:23:5 + --> tests/ui/precedence.rs:16:5 | LL | 1 + 2 << 3; | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 2) << 3` error: operator precedence might not be obvious - --> tests/ui/precedence.rs:25:5 + --> tests/ui/precedence.rs:18:5 | LL | 4 >> 1 + 1; | ^^^^^^^^^^ help: consider parenthesizing your expression: `4 >> (1 + 1)` error: operator precedence might not be obvious - --> tests/ui/precedence.rs:27:5 + --> tests/ui/precedence.rs:20:5 | LL | 1 + 3 >> 2; | ^^^^^^^^^^ help: consider parenthesizing your expression: `(1 + 3) >> 2` error: operator precedence might not be obvious - --> tests/ui/precedence.rs:29:5 + --> tests/ui/precedence.rs:22:5 | LL | 1 ^ 1 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression: `1 ^ (1 - 1)` error: operator precedence might not be obvious - --> tests/ui/precedence.rs:31:5 + --> tests/ui/precedence.rs:24:5 | LL | 3 | 2 - 1; | ^^^^^^^^^ help: consider parenthesizing your expression: `3 | (2 - 1)` error: operator precedence might not be obvious - --> tests/ui/precedence.rs:33:5 + --> tests/ui/precedence.rs:26:5 | LL | 3 & 5 - 2; | ^^^^^^^^^ help: consider parenthesizing your expression: `3 & (5 - 2)` error: precedence might not be obvious - --> tests/ui/precedence.rs:56:13 + --> tests/ui/precedence.rs:49:13 | LL | let f = |x: W| -> _ { x }.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | let f = (|x: W| -> _ { x }).clone(); | + + error: precedence might not be obvious - --> tests/ui/precedence.rs:60:13 + --> tests/ui/precedence.rs:53:13 | LL | let f = move |x: W| -> _ { x }.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/precedence_bits.fixed b/tests/ui/precedence_bits.fixed index e0ce4a992bb1..20cde92bf3e5 100644 --- a/tests/ui/precedence_bits.fixed +++ b/tests/ui/precedence_bits.fixed @@ -1,12 +1,5 @@ #![warn(clippy::precedence_bits)] -#![allow( - unused_must_use, - clippy::no_effect, - clippy::unnecessary_operation, - clippy::precedence -)] -#![allow(clippy::identity_op)] -#![allow(clippy::eq_op)] +#![expect(clippy::eq_op, clippy::identity_op, clippy::no_effect, clippy::precedence)] macro_rules! trip { ($a:expr) => { diff --git a/tests/ui/precedence_bits.rs b/tests/ui/precedence_bits.rs index 20d17e26c355..b2613aac1b96 100644 --- a/tests/ui/precedence_bits.rs +++ b/tests/ui/precedence_bits.rs @@ -1,12 +1,5 @@ #![warn(clippy::precedence_bits)] -#![allow( - unused_must_use, - clippy::no_effect, - clippy::unnecessary_operation, - clippy::precedence -)] -#![allow(clippy::identity_op)] -#![allow(clippy::eq_op)] +#![expect(clippy::eq_op, clippy::identity_op, clippy::no_effect, clippy::precedence)] macro_rules! trip { ($a:expr) => { diff --git a/tests/ui/precedence_bits.stderr b/tests/ui/precedence_bits.stderr index 9cbdca8956d6..28b2c22487c1 100644 --- a/tests/ui/precedence_bits.stderr +++ b/tests/ui/precedence_bits.stderr @@ -1,5 +1,5 @@ error: operator precedence might not be obvious - --> tests/ui/precedence_bits.rs:28:5 + --> tests/ui/precedence_bits.rs:21:5 | LL | 0x0F00 & 0x00F0 << 4; | ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `0x0F00 & (0x00F0 << 4)` @@ -8,19 +8,19 @@ LL | 0x0F00 & 0x00F0 << 4; = help: to override `-D warnings` add `#[allow(clippy::precedence_bits)]` error: operator precedence might not be obvious - --> tests/ui/precedence_bits.rs:30:5 + --> tests/ui/precedence_bits.rs:23:5 | LL | 0x0F00 & 0xF000 >> 4; | ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `0x0F00 & (0xF000 >> 4)` error: operator precedence might not be obvious - --> tests/ui/precedence_bits.rs:32:5 + --> tests/ui/precedence_bits.rs:25:5 | LL | 0x0F00 << 1 ^ 3; | ^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(0x0F00 << 1) ^ 3` error: operator precedence might not be obvious - --> tests/ui/precedence_bits.rs:34:5 + --> tests/ui/precedence_bits.rs:27:5 | LL | 0x0F00 << 1 | 2; | ^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(0x0F00 << 1) | 2` diff --git a/tests/ui/print_in_format_impl.rs b/tests/ui/print_in_format_impl.rs index 8bc704921220..4abe420d9c04 100644 --- a/tests/ui/print_in_format_impl.rs +++ b/tests/ui/print_in_format_impl.rs @@ -1,4 +1,3 @@ -#![allow(unused, clippy::print_literal, clippy::write_literal)] #![warn(clippy::print_in_format_impl)] use std::fmt::{Debug, Display, Error, Formatter}; //@no-rustfix diff --git a/tests/ui/print_in_format_impl.stderr b/tests/ui/print_in_format_impl.stderr index 91d6ce953849..20e3ac82c09f 100644 --- a/tests/ui/print_in_format_impl.stderr +++ b/tests/ui/print_in_format_impl.stderr @@ -1,5 +1,5 @@ error: use of `print!` in `Debug` impl - --> tests/ui/print_in_format_impl.rs:20:9 + --> tests/ui/print_in_format_impl.rs:19:9 | LL | print!("{}", 1); | ^^^^^^^^^^^^^^^ help: replace with: `write!(f, ..)` @@ -8,37 +8,37 @@ LL | print!("{}", 1); = help: to override `-D warnings` add `#[allow(clippy::print_in_format_impl)]` error: use of `println!` in `Debug` impl - --> tests/ui/print_in_format_impl.rs:23:9 + --> tests/ui/print_in_format_impl.rs:22:9 | LL | println!("{}", 2); | ^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(f, ..)` error: use of `eprint!` in `Debug` impl - --> tests/ui/print_in_format_impl.rs:26:9 + --> tests/ui/print_in_format_impl.rs:25:9 | LL | eprint!("{}", 3); | ^^^^^^^^^^^^^^^^ help: replace with: `write!(f, ..)` error: use of `eprintln!` in `Debug` impl - --> tests/ui/print_in_format_impl.rs:29:9 + --> tests/ui/print_in_format_impl.rs:28:9 | LL | eprintln!("{}", 4); | ^^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(f, ..)` error: use of `println!` in `Debug` impl - --> tests/ui/print_in_format_impl.rs:33:13 + --> tests/ui/print_in_format_impl.rs:32:13 | LL | println!("nested"); | ^^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(f, ..)` error: use of `print!` in `Display` impl - --> tests/ui/print_in_format_impl.rs:48:9 + --> tests/ui/print_in_format_impl.rs:47:9 | LL | print!("Display"); | ^^^^^^^^^^^^^^^^^ help: replace with: `write!(f, ..)` error: use of `println!` in `Debug` impl - --> tests/ui/print_in_format_impl.rs:60:9 + --> tests/ui/print_in_format_impl.rs:59:9 | LL | println!("UnnamedFormatter"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `writeln!(..)` diff --git a/tests/ui/print_literal.fixed b/tests/ui/print_literal.fixed index 26139f9b6710..3baaa1877d1d 100644 --- a/tests/ui/print_literal.fixed +++ b/tests/ui/print_literal.fixed @@ -1,5 +1,5 @@ #![warn(clippy::print_literal)] -#![allow(clippy::uninlined_format_args, clippy::literal_string_with_formatting_args)] +#![expect(clippy::literal_string_with_formatting_args, clippy::uninlined_format_args)] fn main() { // these should be fine diff --git a/tests/ui/print_literal.rs b/tests/ui/print_literal.rs index 7c4cf028e84c..32a9476cdbf5 100644 --- a/tests/ui/print_literal.rs +++ b/tests/ui/print_literal.rs @@ -1,5 +1,5 @@ #![warn(clippy::print_literal)] -#![allow(clippy::uninlined_format_args, clippy::literal_string_with_formatting_args)] +#![expect(clippy::literal_string_with_formatting_args, clippy::uninlined_format_args)] fn main() { // these should be fine diff --git a/tests/ui/print_with_newline.fixed b/tests/ui/print_with_newline.fixed index 96c5ee4c1e92..3970ad7b8fc6 100644 --- a/tests/ui/print_with_newline.fixed +++ b/tests/ui/print_with_newline.fixed @@ -1,7 +1,7 @@ // FIXME: Ideally these suggestions would be fixed via rustfix. Blocked by rust-lang/rust#53934 -#![allow(clippy::print_literal)] #![warn(clippy::print_with_newline)] +#![expect(clippy::print_literal)] fn main() { println!("Hello"); diff --git a/tests/ui/print_with_newline.rs b/tests/ui/print_with_newline.rs index 60d1e4788308..d71cc4552ae6 100644 --- a/tests/ui/print_with_newline.rs +++ b/tests/ui/print_with_newline.rs @@ -1,7 +1,7 @@ // FIXME: Ideally these suggestions would be fixed via rustfix. Blocked by rust-lang/rust#53934 -#![allow(clippy::print_literal)] #![warn(clippy::print_with_newline)] +#![expect(clippy::print_literal)] fn main() { print!("Hello\n"); diff --git a/tests/ui/println_empty_string.fixed b/tests/ui/println_empty_string.fixed index 3a31cbc04134..a735795df432 100644 --- a/tests/ui/println_empty_string.fixed +++ b/tests/ui/println_empty_string.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::match_single_binding, clippy::unnecessary_trailing_comma)] +#![warn(clippy::println_empty_string)] +#![expect(clippy::match_single_binding)] fn main() { println!(); diff --git a/tests/ui/println_empty_string.rs b/tests/ui/println_empty_string.rs index 79309080131f..d081338f02a1 100644 --- a/tests/ui/println_empty_string.rs +++ b/tests/ui/println_empty_string.rs @@ -1,4 +1,5 @@ -#![allow(clippy::match_single_binding, clippy::unnecessary_trailing_comma)] +#![warn(clippy::println_empty_string)] +#![expect(clippy::match_single_binding)] fn main() { println!(); diff --git a/tests/ui/println_empty_string.stderr b/tests/ui/println_empty_string.stderr index 82ef3378f110..ed216ea5f39f 100644 --- a/tests/ui/println_empty_string.stderr +++ b/tests/ui/println_empty_string.stderr @@ -1,5 +1,5 @@ error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:5:5 + --> tests/ui/println_empty_string.rs:6:5 | LL | println!(""); | ^^^^^^^^^--^ @@ -10,7 +10,7 @@ LL | println!(""); = help: to override `-D warnings` add `#[allow(clippy::println_empty_string)]` error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:9:14 + --> tests/ui/println_empty_string.rs:10:14 | LL | _ => println!(""), | ^^^^^^^^^--^ @@ -18,7 +18,7 @@ LL | _ => println!(""), | help: remove the empty string error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string.rs:14:5 + --> tests/ui/println_empty_string.rs:15:5 | LL | eprintln!(""); | ^^^^^^^^^^--^ @@ -26,7 +26,7 @@ LL | eprintln!(""); | help: remove the empty string error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string.rs:18:14 + --> tests/ui/println_empty_string.rs:19:14 | LL | _ => eprintln!(""), | ^^^^^^^^^^--^ @@ -34,7 +34,7 @@ LL | _ => eprintln!(""), | help: remove the empty string error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:26:5 + --> tests/ui/println_empty_string.rs:27:5 | LL | / println!( LL | |/ "\ @@ -47,7 +47,7 @@ LL | || ); | help: remove the empty string error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:34:14 + --> tests/ui/println_empty_string.rs:35:14 | LL | _ => println!("" ,), // there is a space between "" and comma | ^^^^^^^^^----^ @@ -55,7 +55,7 @@ LL | _ => println!("" ,), // there is a space between "" and comma | help: remove the empty string error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string.rs:38:5 + --> tests/ui/println_empty_string.rs:39:5 | LL | eprintln!("" ,); // there is a tab between "" and comma | ^^^^^^^^^^-------^ @@ -63,7 +63,7 @@ LL | eprintln!("" ,); // there is a tab between "" and comma | help: remove the empty string error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string.rs:42:14 + --> tests/ui/println_empty_string.rs:43:14 | LL | _ => eprintln!("" ,), // tab and space between "" and comma | ^^^^^^^^^^--------^ @@ -71,7 +71,7 @@ LL | _ => eprintln!("" ,), // tab and space between "" and comma | help: remove the empty string error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:49:5 + --> tests/ui/println_empty_string.rs:50:5 | LL | println!{""}; | ^^^^^^^^^--^ @@ -79,7 +79,7 @@ LL | println!{""}; | help: remove the empty string error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:52:5 + --> tests/ui/println_empty_string.rs:53:5 | LL | println![""]; | ^^^^^^^^^--^ @@ -87,7 +87,7 @@ LL | println![""]; | help: remove the empty string error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string.rs:55:5 + --> tests/ui/println_empty_string.rs:56:5 | LL | eprintln!{""}; | ^^^^^^^^^^--^ @@ -95,7 +95,7 @@ LL | eprintln!{""}; | help: remove the empty string error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string.rs:58:5 + --> tests/ui/println_empty_string.rs:59:5 | LL | eprintln![""]; | ^^^^^^^^^^--^ @@ -103,7 +103,7 @@ LL | eprintln![""]; | help: remove the empty string error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:62:14 + --> tests/ui/println_empty_string.rs:63:14 | LL | _ => println!{""}, | ^^^^^^^^^--^ @@ -111,7 +111,7 @@ LL | _ => println!{""}, | help: remove the empty string error: empty string literal in `println!` - --> tests/ui/println_empty_string.rs:67:14 + --> tests/ui/println_empty_string.rs:68:14 | LL | _ => println![""], | ^^^^^^^^^--^ diff --git a/tests/ui/println_empty_string_unfixable.rs b/tests/ui/println_empty_string_unfixable.rs index d6c30f627a58..dbbb42712259 100644 --- a/tests/ui/println_empty_string_unfixable.rs +++ b/tests/ui/println_empty_string_unfixable.rs @@ -1,5 +1,4 @@ -#![allow(clippy::match_single_binding)] - +#![warn(clippy::println_empty_string)] // If there is a comment in the span of macro call, we don't provide an auto-fix suggestion. #[rustfmt::skip] fn issue_16167() { diff --git a/tests/ui/println_empty_string_unfixable.stderr b/tests/ui/println_empty_string_unfixable.stderr index 648fd7cdbccd..715f3dbca28a 100644 --- a/tests/ui/println_empty_string_unfixable.stderr +++ b/tests/ui/println_empty_string_unfixable.stderr @@ -1,11 +1,11 @@ error: empty string literal in `println!` - --> tests/ui/println_empty_string_unfixable.rs:7:5 + --> tests/ui/println_empty_string_unfixable.rs:6:5 | LL | println!("" /* comment */); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: remove the empty string - --> tests/ui/println_empty_string_unfixable.rs:7:14 + --> tests/ui/println_empty_string_unfixable.rs:6:14 | LL | println!("" /* comment */); | ^^ @@ -13,57 +13,57 @@ LL | println!("" /* comment */); = help: to override `-D warnings` add `#[allow(clippy::println_empty_string)]` error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string_unfixable.rs:9:5 + --> tests/ui/println_empty_string_unfixable.rs:8:5 | LL | eprintln!("" /* comment */); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: remove the empty string - --> tests/ui/println_empty_string_unfixable.rs:9:15 + --> tests/ui/println_empty_string_unfixable.rs:8:15 | LL | eprintln!("" /* comment */); | ^^ error: empty string literal in `println!` - --> tests/ui/println_empty_string_unfixable.rs:12:5 + --> tests/ui/println_empty_string_unfixable.rs:11:5 | LL | / println!( // comment LL | | ""); | |___________________^ | note: remove the empty string - --> tests/ui/println_empty_string_unfixable.rs:13:17 + --> tests/ui/println_empty_string_unfixable.rs:12:17 | LL | ""); | ^^ error: empty string literal in `eprintln!` - --> tests/ui/println_empty_string_unfixable.rs:15:5 + --> tests/ui/println_empty_string_unfixable.rs:14:5 | LL | / eprintln!( // comment LL | | ""); | |___________________^ | note: remove the empty string - --> tests/ui/println_empty_string_unfixable.rs:16:17 + --> tests/ui/println_empty_string_unfixable.rs:15:17 | LL | ""); | ^^ error: empty string literal in `println!` - --> tests/ui/println_empty_string_unfixable.rs:19:5 + --> tests/ui/println_empty_string_unfixable.rs:18:5 | LL | println!("", /* comment */); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: remove the empty string - --> tests/ui/println_empty_string_unfixable.rs:19:14 + --> tests/ui/println_empty_string_unfixable.rs:18:14 | LL | println!("", /* comment */); | ^^ error: empty string literal in `println!` - --> tests/ui/println_empty_string_unfixable.rs:22:5 + --> tests/ui/println_empty_string_unfixable.rs:21:5 | LL | / println!( LL | | "\ @@ -74,7 +74,7 @@ LL | | ); | |_____^ | note: remove the empty string - --> tests/ui/println_empty_string_unfixable.rs:23:9 + --> tests/ui/println_empty_string_unfixable.rs:22:9 | LL | / "\ LL | | \ diff --git a/tests/ui/ptr_arg.rs b/tests/ui/ptr_arg.rs index be14e0762ff4..5313e4065575 100644 --- a/tests/ui/ptr_arg.rs +++ b/tests/ui/ptr_arg.rs @@ -1,10 +1,3 @@ -#![allow( - unused, - clippy::many_single_char_names, - clippy::needless_lifetimes, - clippy::redundant_clone, - clippy::needless_pass_by_ref_mut -)] #![warn(clippy::ptr_arg)] //@no-rustfix use std::borrow::Cow; @@ -118,7 +111,6 @@ fn false_positive_capacity_too(x: &String) -> String { x.clone() } -#[allow(dead_code)] fn test_cow_with_ref(c: &Cow<[i32]>) {} //~^ ptr_arg diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr index 08746460add1..993a59a0dd67 100644 --- a/tests/ui/ptr_arg.stderr +++ b/tests/ui/ptr_arg.stderr @@ -1,5 +1,5 @@ error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:13:14 + --> tests/ui/ptr_arg.rs:6:14 | LL | fn do_vec(x: &Vec) { | ^^^^^^^^^ @@ -13,7 +13,7 @@ LL + fn do_vec(x: &[i64]) { | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:19:18 + --> tests/ui/ptr_arg.rs:12:18 | LL | fn do_vec_mut(x: &mut Vec) { | ^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + fn do_vec_mut(x: &mut [i64]) { | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:25:19 + --> tests/ui/ptr_arg.rs:18:19 | LL | fn do_vec_mut2(x: &mut Vec) { | ^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + fn do_vec_mut2(x: &mut [i64]) { | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:32:14 + --> tests/ui/ptr_arg.rs:25:14 | LL | fn do_str(x: &String) { | ^^^^^^^ @@ -49,7 +49,7 @@ LL + fn do_str(x: &str) { | error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:38:18 + --> tests/ui/ptr_arg.rs:31:18 | LL | fn do_str_mut(x: &mut String) { | ^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + fn do_str_mut(x: &mut str) { | error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:44:15 + --> tests/ui/ptr_arg.rs:37:15 | LL | fn do_path(x: &PathBuf) { | ^^^^^^^^ @@ -73,7 +73,7 @@ LL + fn do_path(x: &Path) { | error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:50:19 + --> tests/ui/ptr_arg.rs:43:19 | LL | fn do_path_mut(x: &mut PathBuf) { | ^^^^^^^^^^^^ @@ -85,13 +85,13 @@ LL + fn do_path_mut(x: &mut Path) { | error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:60:18 + --> tests/ui/ptr_arg.rs:53:18 | LL | fn do_vec(x: &Vec); | ^^^^^^^^^ help: change this to: `&[i64]` error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:75:14 + --> tests/ui/ptr_arg.rs:68:14 | LL | fn cloned(x: &Vec) -> Vec { | ^^^^^^^^ @@ -110,7 +110,7 @@ LL ~ x.to_owned() | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:86:18 + --> tests/ui/ptr_arg.rs:79:18 | LL | fn str_cloned(x: &String) -> String { | ^^^^^^^ @@ -128,7 +128,7 @@ LL ~ x.to_owned() | error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:96:19 + --> tests/ui/ptr_arg.rs:89:19 | LL | fn path_cloned(x: &PathBuf) -> PathBuf { | ^^^^^^^^ @@ -146,7 +146,7 @@ LL ~ x.to_path_buf() | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:106:44 + --> tests/ui/ptr_arg.rs:99:44 | LL | fn false_positive_capacity(x: &Vec, y: &String) { | ^^^^^^^ @@ -162,13 +162,13 @@ LL ~ let c = y; | error: using a reference to `Cow` is not recommended - --> tests/ui/ptr_arg.rs:122:25 + --> tests/ui/ptr_arg.rs:114:25 | LL | fn test_cow_with_ref(c: &Cow<[i32]>) {} | ^^^^^^^^^^^ help: change this to: `&[i32]` error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:152:64 + --> tests/ui/ptr_arg.rs:144:64 | LL | fn some_allowed(#[allow(clippy::ptr_arg)] v: &Vec, s: &String) {} | ^^^^^^^ @@ -180,7 +180,7 @@ LL + fn some_allowed(#[allow(clippy::ptr_arg)] v: &Vec, s: &str) {} | error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:182:21 + --> tests/ui/ptr_arg.rs:174:21 | LL | fn foo_vec(vec: &Vec) { | ^^^^^^^^ @@ -195,7 +195,7 @@ LL ~ let b = vec.to_owned().clone(); | error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:189:23 + --> tests/ui/ptr_arg.rs:181:23 | LL | fn foo_path(path: &PathBuf) { | ^^^^^^^^ @@ -210,7 +210,7 @@ LL ~ let d = path.to_path_buf().clone(); | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:196:21 + --> tests/ui/ptr_arg.rs:188:21 | LL | fn foo_str(str: &String) { | ^^^^^^^ @@ -225,7 +225,7 @@ LL ~ let f = str.to_owned().clone(); | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:204:29 + --> tests/ui/ptr_arg.rs:196:29 | LL | fn mut_vec_slice_methods(v: &mut Vec) { | ^^^^^^^^^^^^^ @@ -237,7 +237,7 @@ LL + fn mut_vec_slice_methods(v: &mut [u32]) { | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:268:17 + --> tests/ui/ptr_arg.rs:260:17 | LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut PathBuf) { | ^^^^^^^^^^^^^ @@ -249,7 +249,7 @@ LL + fn dyn_trait(a: &mut [u32], b: &mut String, c: &mut PathBuf) { | error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:268:35 + --> tests/ui/ptr_arg.rs:260:35 | LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut PathBuf) { | ^^^^^^^^^^^ @@ -261,7 +261,7 @@ LL + fn dyn_trait(a: &mut Vec, b: &mut str, c: &mut PathBuf) { | error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:268:51 + --> tests/ui/ptr_arg.rs:260:51 | LL | fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut PathBuf) { | ^^^^^^^^^^^^ @@ -273,25 +273,25 @@ LL + fn dyn_trait(a: &mut Vec, b: &mut String, c: &mut Path) { | error: using a reference to `Cow` is not recommended - --> tests/ui/ptr_arg.rs:295:39 + --> tests/ui/ptr_arg.rs:287:39 | LL | fn cow_elided_lifetime<'a>(input: &'a Cow) -> &'a str { | ^^^^^^^^^^^^ help: change this to: `&str` error: using a reference to `Cow` is not recommended - --> tests/ui/ptr_arg.rs:302:36 + --> tests/ui/ptr_arg.rs:294:36 | LL | fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str { | ^^^^^^^^^^^^^^^^ help: change this to: `&str` error: using a reference to `Cow` is not recommended - --> tests/ui/ptr_arg.rs:307:40 + --> tests/ui/ptr_arg.rs:299:40 | LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str { | ^^^^^^^^^^^^^^^^ help: change this to: `&str` error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:347:17 + --> tests/ui/ptr_arg.rs:339:17 | LL | fn good(v1: &String, v2: &String) { | ^^^^^^^ @@ -303,7 +303,7 @@ LL + fn good(v1: &str, v2: &String) { | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:347:30 + --> tests/ui/ptr_arg.rs:339:30 | LL | fn good(v1: &String, v2: &String) { | ^^^^^^^ @@ -315,7 +315,7 @@ LL + fn good(v1: &String, v2: &str) { | error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:363:20 + --> tests/ui/ptr_arg.rs:355:20 | LL | fn foo_used(x: &Vec) { | ^^^^^^^^^ @@ -327,7 +327,7 @@ LL + fn foo_used(x: &[i32]) { | error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:377:26 + --> tests/ui/ptr_arg.rs:369:26 | LL | fn foo_local_used(x: &Vec) { | ^^^^^^^^^ @@ -339,7 +339,7 @@ LL + fn foo_local_used(x: &[i32]) { | error: writing `&String` instead of `&str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:386:33 + --> tests/ui/ptr_arg.rs:378:33 | LL | fn foofoo(_x: &Vec, y: &String) { | ^^^^^^^ @@ -351,7 +351,7 @@ LL + fn foofoo(_x: &Vec, y: &str) { | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:407:20 + --> tests/ui/ptr_arg.rs:399:20 | LL | fn bar_used(x: &mut Vec) { | ^^^^^^^^^^^^^ @@ -363,7 +363,7 @@ LL + fn bar_used(x: &mut [u32]) { | error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:421:26 + --> tests/ui/ptr_arg.rs:413:26 | LL | fn bar_local_used(x: &mut Vec) { | ^^^^^^^^^^^^^ @@ -375,7 +375,7 @@ LL + fn bar_local_used(x: &mut [u32]) { | error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do - --> tests/ui/ptr_arg.rs:430:37 + --> tests/ui/ptr_arg.rs:422:37 | LL | fn barbar(_x: &mut Vec, y: &mut String) { | ^^^^^^^^^^^ @@ -387,7 +387,7 @@ LL + fn barbar(_x: &mut Vec, y: &mut str) { | error: eliding a lifetime that's named elsewhere is confusing - --> tests/ui/ptr_arg.rs:314:56 + --> tests/ui/ptr_arg.rs:306:56 | LL | fn cow_good_ret_ty<'a>(input: &'a Cow<'a, str>) -> &str { | -- -- ^^^^ the same lifetime is elided here diff --git a/tests/ui/ptr_cast_constness.fixed b/tests/ui/ptr_cast_constness.fixed index cf57de53d9f3..db284a0b6a9c 100644 --- a/tests/ui/ptr_cast_constness.fixed +++ b/tests/ui/ptr_cast_constness.fixed @@ -1,12 +1,7 @@ //@aux-build:proc_macros.rs #![warn(clippy::ptr_cast_constness)] -#![allow( - clippy::transmute_ptr_to_ref, - clippy::unnecessary_cast, - unused, - clippy::missing_transmute_annotations -)] +#![expect(clippy::transmute_ptr_to_ref, clippy::unnecessary_cast)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/ptr_cast_constness.rs b/tests/ui/ptr_cast_constness.rs index ea53a0fa8c50..a374df64497b 100644 --- a/tests/ui/ptr_cast_constness.rs +++ b/tests/ui/ptr_cast_constness.rs @@ -1,12 +1,7 @@ //@aux-build:proc_macros.rs #![warn(clippy::ptr_cast_constness)] -#![allow( - clippy::transmute_ptr_to_ref, - clippy::unnecessary_cast, - unused, - clippy::missing_transmute_annotations -)] +#![expect(clippy::transmute_ptr_to_ref, clippy::unnecessary_cast)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/ptr_cast_constness.stderr b/tests/ui/ptr_cast_constness.stderr index 4adb5cc5ad7f..3bd1c660211f 100644 --- a/tests/ui/ptr_cast_constness.stderr +++ b/tests/ui/ptr_cast_constness.stderr @@ -1,5 +1,5 @@ error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:16:45 + --> tests/ui/ptr_cast_constness.rs:11:45 | LL | let _: &mut T = std::mem::transmute(p as *mut T); | ^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `p.cast_mut()` @@ -8,67 +8,67 @@ LL | let _: &mut T = std::mem::transmute(p as *mut T); = help: to override `-D warnings` add `#[allow(clippy::ptr_cast_constness)]` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:18:23 + --> tests/ui/ptr_cast_constness.rs:13:23 | LL | let _ = &mut *(p as *mut T); | ^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `p.cast_mut()` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:35:17 + --> tests/ui/ptr_cast_constness.rs:30:17 | LL | let _ = *ptr_ptr as *mut u32; | ^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `(*ptr_ptr).cast_mut()` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:39:13 + --> tests/ui/ptr_cast_constness.rs:34:13 | LL | let _ = ptr as *mut u32; | ^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `ptr.cast_mut()` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:41:13 + --> tests/ui/ptr_cast_constness.rs:36:13 | LL | let _ = mut_ptr as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `mut_ptr.cast_const()` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:75:13 + --> tests/ui/ptr_cast_constness.rs:70:13 | LL | let _ = ptr as *mut u32; | ^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `ptr.cast_mut()` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:77:13 + --> tests/ui/ptr_cast_constness.rs:72:13 | LL | let _ = mut_ptr as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `mut_ptr.cast_const()` error: `as` casting to make a const null pointer into a mutable null pointer - --> tests/ui/ptr_cast_constness.rs:84:13 + --> tests/ui/ptr_cast_constness.rs:79:13 | LL | let _ = ptr::null::() as *mut String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::()` error: `as` casting to make a mutable null pointer into a const null pointer - --> tests/ui/ptr_cast_constness.rs:86:13 + --> tests/ui/ptr_cast_constness.rs:81:13 | LL | let _ = ptr::null_mut::() as *const u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null()` directly instead: `std::ptr::null::()` error: changing constness of a null pointer - --> tests/ui/ptr_cast_constness.rs:88:13 + --> tests/ui/ptr_cast_constness.rs:83:13 | LL | let _ = ptr::null::().cast_mut(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::()` error: changing constness of a null pointer - --> tests/ui/ptr_cast_constness.rs:90:13 + --> tests/ui/ptr_cast_constness.rs:85:13 | LL | let _ = ptr::null_mut::().cast_const(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null()` directly instead: `std::ptr::null::()` error: `as` casting to make a const null pointer into a mutable null pointer - --> tests/ui/ptr_cast_constness.rs:94:21 + --> tests/ui/ptr_cast_constness.rs:89:21 | LL | let _ = inline!(ptr::null::() as *mut u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::()` @@ -76,7 +76,7 @@ LL | let _ = inline!(ptr::null::() as *mut u32); = note: this error originates in the macro `__inline_mac_fn_null_pointers` (in Nightly builds, run with -Z macro-backtrace for more info) error: changing constness of a null pointer - --> tests/ui/ptr_cast_constness.rs:96:21 + --> tests/ui/ptr_cast_constness.rs:91:21 | LL | let _ = inline!(ptr::null::().cast_mut()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::()` @@ -84,13 +84,13 @@ LL | let _ = inline!(ptr::null::().cast_mut()); = note: this error originates in the macro `__inline_mac_fn_null_pointers` (in Nightly builds, run with -Z macro-backtrace for more info) error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:106:13 + --> tests/ui/ptr_cast_constness.rs:101:13 | LL | let _ = std::ptr::addr_of_mut!(local) as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `std::ptr::addr_of_mut!(local).cast_const()` error: `as` casting between raw pointers while changing only its constness - --> tests/ui/ptr_cast_constness.rs:112:26 + --> tests/ui/ptr_cast_constness.rs:107:26 | LL | let _ptr: *mut u32 = r as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `(r as *const u32).cast_mut()` diff --git a/tests/ui/ptr_eq.fixed b/tests/ui/ptr_eq.fixed index d3624a129b5f..9629b3eea587 100644 --- a/tests/ui/ptr_eq.fixed +++ b/tests/ui/ptr_eq.fixed @@ -1,5 +1,4 @@ #![warn(clippy::ptr_eq)] -#![allow(function_casts_as_integer)] macro_rules! mac { ($a:expr, $b:expr) => { diff --git a/tests/ui/ptr_eq.rs b/tests/ui/ptr_eq.rs index f06a99cabc81..2b741d8df468 100644 --- a/tests/ui/ptr_eq.rs +++ b/tests/ui/ptr_eq.rs @@ -1,5 +1,4 @@ #![warn(clippy::ptr_eq)] -#![allow(function_casts_as_integer)] macro_rules! mac { ($a:expr, $b:expr) => { diff --git a/tests/ui/ptr_eq.stderr b/tests/ui/ptr_eq.stderr index f6be4c3f016b..e7340624b595 100644 --- a/tests/ui/ptr_eq.stderr +++ b/tests/ui/ptr_eq.stderr @@ -1,5 +1,5 @@ error: use `std::ptr::eq` when comparing raw pointers - --> tests/ui/ptr_eq.rs:23:13 + --> tests/ui/ptr_eq.rs:22:13 | LL | let _ = a as *const _ as usize == b as *const _ as usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)` @@ -8,31 +8,31 @@ LL | let _ = a as *const _ as usize == b as *const _ as usize; = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]` error: use `std::ptr::eq` when comparing raw pointers - --> tests/ui/ptr_eq.rs:25:13 + --> tests/ui/ptr_eq.rs:24:13 | LL | let _ = a as *const _ == b as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)` error: use `std::ptr::eq` when comparing raw pointers - --> tests/ui/ptr_eq.rs:51:13 + --> tests/ui/ptr_eq.rs:50:13 | LL | let _ = x as *const u32 == y as *mut u32 as *const u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(x, y)` error: use `std::ptr::eq` when comparing raw pointers - --> tests/ui/ptr_eq.rs:54:13 + --> tests/ui/ptr_eq.rs:53:13 | LL | let _ = x as *const u32 != y as *mut u32 as *const u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!std::ptr::eq(x, y)` error: use `std::ptr::eq` when comparing raw pointers - --> tests/ui/ptr_eq.rs:62:13 + --> tests/ui/ptr_eq.rs:61:13 | LL | let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))` error: use `std::ptr::eq` when comparing raw pointers - --> tests/ui/ptr_eq.rs:66:13 + --> tests/ui/ptr_eq.rs:65:13 | LL | let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))` From 3ed82340e3e2c58355e4f58ab7f10e7cffc11965 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 05/11] Attributes cleanup in tests [20/20] --- tests/ui/unused_self.rs | 2 +- tests/ui/unused_trait_names.fixed | 1 - tests/ui/unused_trait_names.rs | 1 - tests/ui/unused_trait_names.stderr | 18 +-- tests/ui/unused_unit.edition2021.fixed | 6 +- tests/ui/unused_unit.edition2021.stderr | 47 +++--- tests/ui/unused_unit.edition2024.fixed | 6 +- tests/ui/unused_unit.edition2024.stderr | 45 +++--- tests/ui/unused_unit.rs | 6 +- tests/ui/unwrap_expect_used.rs | 4 +- tests/ui/unwrap_in_result.rs | 2 +- tests/ui/unwrap_or.fixed | 2 +- tests/ui/unwrap_or.rs | 2 +- tests/ui/unwrap_or_else_default.fixed | 4 +- tests/ui/unwrap_or_else_default.rs | 4 +- tests/ui/unwrap_or_else_default.stderr | 30 ++-- tests/ui/use_self.fixed | 13 +- tests/ui/use_self.rs | 13 +- tests/ui/use_self.stderr | 84 +++++----- tests/ui/use_self_structs.fixed | 2 +- tests/ui/use_self_structs.rs | 2 +- tests/ui/use_self_trait.fixed | 2 - tests/ui/use_self_trait.rs | 2 - tests/ui/use_self_trait.stderr | 32 ++-- tests/ui/used_underscore_binding.rs | 2 +- tests/ui/used_underscore_items.rs | 1 - tests/ui/used_underscore_items.stderr | 36 ++--- tests/ui/useful_asref.rs | 4 +- tests/ui/useless_asref.fixed | 12 +- tests/ui/useless_asref.rs | 12 +- tests/ui/useless_asref.stderr | 53 +++---- tests/ui/useless_attribute.fixed | 5 +- tests/ui/useless_attribute.rs | 5 +- tests/ui/useless_attribute.stderr | 6 +- tests/ui/useless_borrows_in_formatting.fixed | 1 - tests/ui/useless_borrows_in_formatting.rs | 1 - tests/ui/useless_borrows_in_formatting.stderr | 88 +++++------ tests/ui/useless_conversion.fixed | 9 +- tests/ui/useless_conversion.rs | 9 +- tests/ui/useless_conversion.stderr | 145 +++++++++--------- tests/ui/useless_conversion_try.rs | 8 +- tests/ui/useless_conversion_try.stderr | 25 ++- tests/ui/vec_box_sized.rs | 2 +- tests/ui/vec_init_then_push.rs | 1 - tests/ui/vec_init_then_push.stderr | 16 +- tests/ui/while_let_loop.rs | 2 +- tests/ui/while_let_on_iterator.fixed | 7 +- tests/ui/while_let_on_iterator.rs | 7 +- tests/ui/while_let_on_iterator.stderr | 66 ++++---- tests/ui/wildcard_enum_match_arm.fixed | 11 +- tests/ui/wildcard_enum_match_arm.rs | 11 +- tests/ui/wildcard_enum_match_arm.stderr | 23 ++- tests/ui/wildcard_imports.fixed | 4 +- tests/ui/wildcard_imports.rs | 4 +- .../wildcard_imports_2021.edition2018.fixed | 4 +- .../wildcard_imports_2021.edition2021.fixed | 4 +- tests/ui/wildcard_imports_2021.rs | 4 +- tests/ui/wildcard_imports_cfgtest.rs | 2 +- tests/ui/write_literal.fixed | 2 +- tests/ui/write_literal.rs | 2 +- tests/ui/write_literal_unfixable.rs | 1 - tests/ui/write_literal_unfixable.stderr | 4 +- tests/ui/write_with_newline.fixed | 2 +- tests/ui/write_with_newline.rs | 2 +- tests/ui/writeln_empty_string.fixed | 1 - tests/ui/writeln_empty_string.rs | 1 - tests/ui/writeln_empty_string.stderr | 4 +- tests/ui/writeln_empty_string_unfixable.rs | 1 - .../ui/writeln_empty_string_unfixable.stderr | 12 +- tests/ui/wrong_self_convention.rs | 1 - tests/ui/wrong_self_convention.stderr | 48 +++--- tests/ui/wrong_self_convention2.rs | 1 - tests/ui/wrong_self_convention2.stderr | 4 +- tests/ui/wrong_self_conventions_mut.rs | 1 - tests/ui/wrong_self_conventions_mut.stderr | 4 +- tests/ui/zero_repeat_side_effects.fixed | 10 +- tests/ui/zero_repeat_side_effects.rs | 10 +- tests/ui/zero_repeat_side_effects.stderr | 26 ++-- tests/ui/zombie_processes.rs | 2 +- tests/ui/zombie_processes_fixable.fixed | 2 +- tests/ui/zombie_processes_fixable.rs | 2 +- .../{literal_string_with_formatting_args}.rs | 1 - 82 files changed, 476 insertions(+), 588 deletions(-) diff --git a/tests/ui/unused_self.rs b/tests/ui/unused_self.rs index cb80d946aced..9e016af40053 100644 --- a/tests/ui/unused_self.rs +++ b/tests/ui/unused_self.rs @@ -1,5 +1,5 @@ #![warn(clippy::unused_self)] -#![allow(clippy::boxed_local, clippy::fn_params_excessive_bools)] +#![expect(clippy::boxed_local, clippy::fn_params_excessive_bools)] mod unused_self { use std::pin::Pin; diff --git a/tests/ui/unused_trait_names.fixed b/tests/ui/unused_trait_names.fixed index 6abbed01bb02..014e667d125d 100644 --- a/tests/ui/unused_trait_names.fixed +++ b/tests/ui/unused_trait_names.fixed @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs -#![allow(unused)] #![warn(clippy::unused_trait_names)] #![feature(decl_macro)] diff --git a/tests/ui/unused_trait_names.rs b/tests/ui/unused_trait_names.rs index 4a06f062dc37..38c0b775f84b 100644 --- a/tests/ui/unused_trait_names.rs +++ b/tests/ui/unused_trait_names.rs @@ -1,6 +1,5 @@ //@aux-build:proc_macros.rs -#![allow(unused)] #![warn(clippy::unused_trait_names)] #![feature(decl_macro)] diff --git a/tests/ui/unused_trait_names.stderr b/tests/ui/unused_trait_names.stderr index 28067e17414f..32c7151e9908 100644 --- a/tests/ui/unused_trait_names.stderr +++ b/tests/ui/unused_trait_names.stderr @@ -1,5 +1,5 @@ error: unused import: `std::any::Any` - --> tests/ui/unused_trait_names.rs:254:9 + --> tests/ui/unused_trait_names.rs:253:9 | LL | use std::any::Any; | ^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | use std::any::Any; = help: to override `-D warnings` add `#[allow(unused_imports)]` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:12:19 + --> tests/ui/unused_trait_names.rs:11:19 | LL | use std::any::Any; | ^^^ help: use: `Any as _` @@ -17,43 +17,43 @@ LL | use std::any::Any; = help: to override `-D warnings` add `#[allow(clippy::unused_trait_names)]` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:32:26 + --> tests/ui/unused_trait_names.rs:31:26 | LL | use std::any::{self, Any, TypeId}; | ^^^ help: use: `Any as _` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:45:19 + --> tests/ui/unused_trait_names.rs:44:19 | LL | use std::any::Any as MyAny; | ^^^^^^^^^^^^ help: use: `Any as _` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:52:20 + --> tests/ui/unused_trait_names.rs:51:20 | LL | use std::any::{Any as MyAny, TypeId as MyTypeId}; | ^^^^^^^^^^^^ help: use: `Any as _` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:76:23 + --> tests/ui/unused_trait_names.rs:75:23 | LL | use std::any::Any; | ^^^ help: use: `Any as _` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:118:19 + --> tests/ui/unused_trait_names.rs:117:19 | LL | use std::any::Any; | ^^^ help: use: `Any as _` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:138:19 + --> tests/ui/unused_trait_names.rs:137:19 | LL | use std::any::Any; | ^^^ help: use: `Any as _` error: importing trait that is only used anonymously - --> tests/ui/unused_trait_names.rs:198:34 + --> tests/ui/unused_trait_names.rs:197:34 | LL | use simple_trait::{MyStruct, MyTrait}; | ^^^^^^^ help: use: `MyTrait as _` diff --git a/tests/ui/unused_unit.edition2021.fixed b/tests/ui/unused_unit.edition2021.fixed index 8e12bd2c8c7b..b6e3753d9ee4 100644 --- a/tests/ui/unused_unit.edition2021.fixed +++ b/tests/ui/unused_unit.edition2021.fixed @@ -12,9 +12,8 @@ #![feature(closure_lifetime_binder)] #![rustfmt::skip] -#![deny(clippy::unused_unit)] -#![allow(dead_code)] -#![allow(clippy::from_over_into)] +#![warn(clippy::unused_unit)] +#![expect(clippy::from_over_into)] struct Unitter; impl Unitter { @@ -142,7 +141,6 @@ mod issue14577 { } mod pr14962 { - #[allow(unused_parens)] type UnusedParensButNoUnit = Box; } diff --git a/tests/ui/unused_unit.edition2021.stderr b/tests/ui/unused_unit.edition2021.stderr index 9ad3c2df915e..a6b9fa70d6cf 100644 --- a/tests/ui/unused_unit.edition2021.stderr +++ b/tests/ui/unused_unit.edition2021.stderr @@ -1,125 +1,122 @@ error: unneeded unit expression - --> tests/ui/unused_unit.rs:37:9 + --> tests/ui/unused_unit.rs:36:9 | LL | () | ^^ help: remove the final `()` | -note: the lint level is defined here - --> tests/ui/unused_unit.rs:15:9 - | -LL | #![deny(clippy::unused_unit)] - | ^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::unused-unit` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::unused_unit)]` error: unneeded unit expression - --> tests/ui/unused_unit.rs:62:26 + --> tests/ui/unused_unit.rs:61:26 | LL | fn return_unit() -> () { () } | ^^ help: remove the final `()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:22:28 + --> tests/ui/unused_unit.rs:21:28 | LL | pub fn get_unit (), G>(&self, f: F, _g: G) -> () | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:25:18 + --> tests/ui/unused_unit.rs:24:18 | LL | where G: Fn() -> () { | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:22:58 + --> tests/ui/unused_unit.rs:21:58 | LL | pub fn get_unit (), G>(&self, f: F, _g: G) -> () | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:27:26 + --> tests/ui/unused_unit.rs:26:26 | LL | let _y: &dyn Fn() -> () = &f; | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:35:18 + --> tests/ui/unused_unit.rs:34:18 | LL | fn into(self) -> () { | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:43:29 + --> tests/ui/unused_unit.rs:42:29 | LL | fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:46:19 + --> tests/ui/unused_unit.rs:45:19 | LL | G: FnMut() -> (), | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:48:16 + --> tests/ui/unused_unit.rs:47:16 | LL | H: Fn() -> (); | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:53:29 + --> tests/ui/unused_unit.rs:52:29 | LL | fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:56:19 + --> tests/ui/unused_unit.rs:55:19 | LL | G: FnMut() -> (), | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:58:16 + --> tests/ui/unused_unit.rs:57:16 | LL | H: Fn() -> () {} | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:62:17 + --> tests/ui/unused_unit.rs:61:17 | LL | fn return_unit() -> () { () } | ^^^^^^ help: remove the `-> ()` error: unneeded `()` - --> tests/ui/unused_unit.rs:74:14 + --> tests/ui/unused_unit.rs:73:14 | LL | break(); | ^^ help: remove the `()` error: unneeded `()` - --> tests/ui/unused_unit.rs:77:11 + --> tests/ui/unused_unit.rs:76:11 | LL | return(); | ^^ help: remove the `()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:95:10 + --> tests/ui/unused_unit.rs:94:10 | LL | fn test()->(){} | ^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:99:11 + --> tests/ui/unused_unit.rs:98:11 | LL | fn test2() ->(){} | ^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:103:11 + --> tests/ui/unused_unit.rs:102:11 | LL | fn test3()-> (){} | ^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:131:13 + --> tests/ui/unused_unit.rs:130:13 | LL | fn bar() -> () { | ^^^^^^ help: remove the `-> ()` diff --git a/tests/ui/unused_unit.edition2024.fixed b/tests/ui/unused_unit.edition2024.fixed index 688d2fe9afa2..f389b833310a 100644 --- a/tests/ui/unused_unit.edition2024.fixed +++ b/tests/ui/unused_unit.edition2024.fixed @@ -12,9 +12,8 @@ #![feature(closure_lifetime_binder)] #![rustfmt::skip] -#![deny(clippy::unused_unit)] -#![allow(dead_code)] -#![allow(clippy::from_over_into)] +#![warn(clippy::unused_unit)] +#![expect(clippy::from_over_into)] struct Unitter; impl Unitter { @@ -142,7 +141,6 @@ mod issue14577 { } mod pr14962 { - #[allow(unused_parens)] type UnusedParensButNoUnit = Box; } diff --git a/tests/ui/unused_unit.edition2024.stderr b/tests/ui/unused_unit.edition2024.stderr index a79e70e066bd..360dabbe145a 100644 --- a/tests/ui/unused_unit.edition2024.stderr +++ b/tests/ui/unused_unit.edition2024.stderr @@ -1,119 +1,116 @@ error: unneeded unit expression - --> tests/ui/unused_unit.rs:37:9 + --> tests/ui/unused_unit.rs:36:9 | LL | () | ^^ help: remove the final `()` | -note: the lint level is defined here - --> tests/ui/unused_unit.rs:15:9 - | -LL | #![deny(clippy::unused_unit)] - | ^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::unused-unit` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::unused_unit)]` error: unneeded unit expression - --> tests/ui/unused_unit.rs:62:26 + --> tests/ui/unused_unit.rs:61:26 | LL | fn return_unit() -> () { () } | ^^ help: remove the final `()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:22:28 + --> tests/ui/unused_unit.rs:21:28 | LL | pub fn get_unit (), G>(&self, f: F, _g: G) -> () | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:25:18 + --> tests/ui/unused_unit.rs:24:18 | LL | where G: Fn() -> () { | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:22:58 + --> tests/ui/unused_unit.rs:21:58 | LL | pub fn get_unit (), G>(&self, f: F, _g: G) -> () | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:27:26 + --> tests/ui/unused_unit.rs:26:26 | LL | let _y: &dyn Fn() -> () = &f; | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:35:18 + --> tests/ui/unused_unit.rs:34:18 | LL | fn into(self) -> () { | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:43:29 + --> tests/ui/unused_unit.rs:42:29 | LL | fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:46:19 + --> tests/ui/unused_unit.rs:45:19 | LL | G: FnMut() -> (), | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:48:16 + --> tests/ui/unused_unit.rs:47:16 | LL | H: Fn() -> (); | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:53:29 + --> tests/ui/unused_unit.rs:52:29 | LL | fn redundant (), G, H>(&self, _f: F, _g: G, _h: H) | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:56:19 + --> tests/ui/unused_unit.rs:55:19 | LL | G: FnMut() -> (), | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:58:16 + --> tests/ui/unused_unit.rs:57:16 | LL | H: Fn() -> () {} | ^^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:62:17 + --> tests/ui/unused_unit.rs:61:17 | LL | fn return_unit() -> () { () } | ^^^^^^ help: remove the `-> ()` error: unneeded `()` - --> tests/ui/unused_unit.rs:74:14 + --> tests/ui/unused_unit.rs:73:14 | LL | break(); | ^^ help: remove the `()` error: unneeded `()` - --> tests/ui/unused_unit.rs:77:11 + --> tests/ui/unused_unit.rs:76:11 | LL | return(); | ^^ help: remove the `()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:95:10 + --> tests/ui/unused_unit.rs:94:10 | LL | fn test()->(){} | ^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:99:11 + --> tests/ui/unused_unit.rs:98:11 | LL | fn test2() ->(){} | ^^^^^ help: remove the `-> ()` error: unneeded unit return type - --> tests/ui/unused_unit.rs:103:11 + --> tests/ui/unused_unit.rs:102:11 | LL | fn test3()-> (){} | ^^^^^ help: remove the `-> ()` diff --git a/tests/ui/unused_unit.rs b/tests/ui/unused_unit.rs index 31e980f2655c..b70d7bf18ac8 100644 --- a/tests/ui/unused_unit.rs +++ b/tests/ui/unused_unit.rs @@ -12,9 +12,8 @@ #![feature(closure_lifetime_binder)] #![rustfmt::skip] -#![deny(clippy::unused_unit)] -#![allow(dead_code)] -#![allow(clippy::from_over_into)] +#![warn(clippy::unused_unit)] +#![expect(clippy::from_over_into)] struct Unitter; impl Unitter { @@ -142,7 +141,6 @@ mod issue14577 { } mod pr14962 { - #[allow(unused_parens)] type UnusedParensButNoUnit = Box; } diff --git a/tests/ui/unwrap_expect_used.rs b/tests/ui/unwrap_expect_used.rs index 207d4dd815be..ef638bf0e9c9 100644 --- a/tests/ui/unwrap_expect_used.rs +++ b/tests/ui/unwrap_expect_used.rs @@ -1,5 +1,5 @@ -#![warn(clippy::unwrap_used, clippy::expect_used)] -#![allow(clippy::unnecessary_literal_unwrap)] +#![warn(clippy::expect_used, clippy::unwrap_used)] +#![expect(clippy::unnecessary_literal_unwrap)] #![feature(never_type)] use std::convert::Infallible; diff --git a/tests/ui/unwrap_in_result.rs b/tests/ui/unwrap_in_result.rs index 70c28fe54f37..bcdbbd2ae7fe 100644 --- a/tests/ui/unwrap_in_result.rs +++ b/tests/ui/unwrap_in_result.rs @@ -1,5 +1,5 @@ #![warn(clippy::unwrap_in_result)] -#![allow(clippy::ok_expect)] +#![expect(clippy::ok_expect)] struct A; diff --git a/tests/ui/unwrap_or.fixed b/tests/ui/unwrap_or.fixed index e550484b5d9f..f27103e48dd3 100644 --- a/tests/ui/unwrap_or.fixed +++ b/tests/ui/unwrap_or.fixed @@ -1,5 +1,5 @@ #![warn(clippy::or_fun_call)] -#![allow(clippy::unnecessary_literal_unwrap)] +#![expect(clippy::unnecessary_literal_unwrap)] fn main() { let s = Some(String::from("test string")).unwrap_or_else(|| "Fail".to_string()).len(); diff --git a/tests/ui/unwrap_or.rs b/tests/ui/unwrap_or.rs index cdd61ac898e6..456ca5c143e1 100644 --- a/tests/ui/unwrap_or.rs +++ b/tests/ui/unwrap_or.rs @@ -1,5 +1,5 @@ #![warn(clippy::or_fun_call)] -#![allow(clippy::unnecessary_literal_unwrap)] +#![expect(clippy::unnecessary_literal_unwrap)] fn main() { let s = Some(String::from("test string")).unwrap_or("Fail".to_string()).len(); diff --git a/tests/ui/unwrap_or_else_default.fixed b/tests/ui/unwrap_or_else_default.fixed index 5cf529fe0143..b6ef0d7f264b 100644 --- a/tests/ui/unwrap_or_else_default.fixed +++ b/tests/ui/unwrap_or_else_default.fixed @@ -1,6 +1,5 @@ #![warn(clippy::unwrap_or_default)] -#![allow(dead_code)] -#![allow(clippy::unnecessary_wraps, clippy::unnecessary_literal_unwrap)] +#![expect(clippy::unnecessary_literal_unwrap)] /// Checks implementation of the `UNWRAP_OR_DEFAULT` lint. fn unwrap_or_else_default() { @@ -135,7 +134,6 @@ fn method_call_with_deref() { let mut outer_map = cell.borrow_mut(); - #[allow(unused_assignments)] let mut option = None; option = Some(0); diff --git a/tests/ui/unwrap_or_else_default.rs b/tests/ui/unwrap_or_else_default.rs index e49ff13e1f2f..b2149a5dd091 100644 --- a/tests/ui/unwrap_or_else_default.rs +++ b/tests/ui/unwrap_or_else_default.rs @@ -1,6 +1,5 @@ #![warn(clippy::unwrap_or_default)] -#![allow(dead_code)] -#![allow(clippy::unnecessary_wraps, clippy::unnecessary_literal_unwrap)] +#![expect(clippy::unnecessary_literal_unwrap)] /// Checks implementation of the `UNWRAP_OR_DEFAULT` lint. fn unwrap_or_else_default() { @@ -135,7 +134,6 @@ fn method_call_with_deref() { let mut outer_map = cell.borrow_mut(); - #[allow(unused_assignments)] let mut option = None; option = Some(0); diff --git a/tests/ui/unwrap_or_else_default.stderr b/tests/ui/unwrap_or_else_default.stderr index 610f20fa62b1..1d61a5e89e45 100644 --- a/tests/ui/unwrap_or_else_default.stderr +++ b/tests/ui/unwrap_or_else_default.stderr @@ -1,5 +1,5 @@ error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:60:23 + --> tests/ui/unwrap_or_else_default.rs:59:23 | LL | with_real_default.unwrap_or_else(::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` @@ -8,85 +8,85 @@ LL | with_real_default.unwrap_or_else(::d = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:64:24 + --> tests/ui/unwrap_or_else_default.rs:63:24 | LL | with_default_trait.unwrap_or_else(Default::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:68:23 + --> tests/ui/unwrap_or_else_default.rs:67:23 | LL | with_default_type.unwrap_or_else(u64::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:72:23 + --> tests/ui/unwrap_or_else_default.rs:71:23 | LL | with_default_type.unwrap_or_else(Vec::new); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:76:18 + --> tests/ui/unwrap_or_else_default.rs:75:18 | LL | empty_string.unwrap_or_else(|| "".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:81:12 + --> tests/ui/unwrap_or_else_default.rs:80:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:85:12 + --> tests/ui/unwrap_or_else_default.rs:84:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:89:12 + --> tests/ui/unwrap_or_else_default.rs:88:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:93:12 + --> tests/ui/unwrap_or_else_default.rs:92:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:97:12 + --> tests/ui/unwrap_or_else_default.rs:96:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:101:12 + --> tests/ui/unwrap_or_else_default.rs:100:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:105:12 + --> tests/ui/unwrap_or_else_default.rs:104:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:109:12 + --> tests/ui/unwrap_or_else_default.rs:108:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `unwrap_or_else` to construct default value - --> tests/ui/unwrap_or_else_default.rs:126:12 + --> tests/ui/unwrap_or_else_default.rs:125:12 | LL | option.unwrap_or_else(Vec::new).push(1); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` error: use of `or_insert_with` to construct default value - --> tests/ui/unwrap_or_else_default.rs:144:32 + --> tests/ui/unwrap_or_else_default.rs:142:32 | LL | let _ = inner_map.entry(0).or_insert_with(Default::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` diff --git a/tests/ui/use_self.fixed b/tests/ui/use_self.fixed index 37559f9a2367..817676346dd2 100644 --- a/tests/ui/use_self.fixed +++ b/tests/ui/use_self.fixed @@ -1,16 +1,7 @@ //@aux-build:proc_macro_derive.rs #![warn(clippy::use_self)] -#![allow(dead_code, unreachable_code)] -#![allow( - clippy::should_implement_trait, - clippy::upper_case_acronyms, - clippy::from_over_into, - clippy::self_named_constructors, - clippy::needless_lifetimes, - clippy::missing_transmute_annotations -)] -#![allow(incomplete_features)] +#![expect(incomplete_features, clippy::from_over_into, clippy::self_named_constructors)] #![feature(adt_const_params)] #![feature(unsized_const_params)] @@ -160,7 +151,6 @@ mod nesting { struct Foo; impl Foo { fn foo() { - #[allow(unused_imports)] use self::Foo; // Can't use Self here struct Bar { foo: Foo, // Foo != Self @@ -195,7 +185,6 @@ mod nesting { } impl Enum { fn method() { - #[allow(unused_imports)] use self::Enum::*; // Issue 3425 static STATIC: Enum = Enum::A; // Can't use Self as type } diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs index 74abd2f61bf9..b2eb869b3f4b 100644 --- a/tests/ui/use_self.rs +++ b/tests/ui/use_self.rs @@ -1,16 +1,7 @@ //@aux-build:proc_macro_derive.rs #![warn(clippy::use_self)] -#![allow(dead_code, unreachable_code)] -#![allow( - clippy::should_implement_trait, - clippy::upper_case_acronyms, - clippy::from_over_into, - clippy::self_named_constructors, - clippy::needless_lifetimes, - clippy::missing_transmute_annotations -)] -#![allow(incomplete_features)] +#![expect(incomplete_features, clippy::from_over_into, clippy::self_named_constructors)] #![feature(adt_const_params)] #![feature(unsized_const_params)] @@ -160,7 +151,6 @@ mod nesting { struct Foo; impl Foo { fn foo() { - #[allow(unused_imports)] use self::Foo; // Can't use Self here struct Bar { foo: Foo, // Foo != Self @@ -195,7 +185,6 @@ mod nesting { } impl Enum { fn method() { - #[allow(unused_imports)] use self::Enum::*; // Issue 3425 static STATIC: Enum = Enum::A; // Can't use Self as type } diff --git a/tests/ui/use_self.stderr b/tests/ui/use_self.stderr index 8ce341d22d4f..eedd11fe5617 100644 --- a/tests/ui/use_self.stderr +++ b/tests/ui/use_self.stderr @@ -1,5 +1,5 @@ error: unnecessary structure name repetition - --> tests/ui/use_self.rs:26:21 + --> tests/ui/use_self.rs:17:21 | LL | fn new() -> Foo { | ^^^ help: use the applicable keyword: `Self` @@ -8,247 +8,247 @@ LL | fn new() -> Foo { = help: to override `-D warnings` add `#[allow(clippy::use_self)]` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:28:13 + --> tests/ui/use_self.rs:19:13 | LL | Foo {} | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:31:22 + --> tests/ui/use_self.rs:22:22 | LL | fn test() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:33:13 + --> tests/ui/use_self.rs:24:13 | LL | Foo::new() | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:39:25 + --> tests/ui/use_self.rs:30:25 | LL | fn default() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:41:13 + --> tests/ui/use_self.rs:32:13 | LL | Foo::new() | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:83:28 + --> tests/ui/use_self.rs:74:28 | LL | fn clone(&self) -> Foo<'a> { | ^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:117:24 + --> tests/ui/use_self.rs:108:24 | LL | fn bad(foos: &[Foo]) -> impl Iterator { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:117:55 + --> tests/ui/use_self.rs:108:55 | LL | fn bad(foos: &[Foo]) -> impl Iterator { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:134:13 + --> tests/ui/use_self.rs:125:13 | LL | TS(0) | ^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:170:29 + --> tests/ui/use_self.rs:160:29 | LL | fn bar() -> Bar { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:172:21 + --> tests/ui/use_self.rs:162:21 | LL | Bar { foo: Foo {} } | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:184:21 + --> tests/ui/use_self.rs:174:21 | LL | fn baz() -> Foo { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:186:13 + --> tests/ui/use_self.rs:176:13 | LL | Foo {} | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:204:21 + --> tests/ui/use_self.rs:193:21 | LL | let _ = Enum::B(42); | ^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:206:21 + --> tests/ui/use_self.rs:195:21 | LL | let _ = Enum::C { field: true }; | ^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:208:21 + --> tests/ui/use_self.rs:197:21 | LL | let _ = Enum::A; | ^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:251:13 + --> tests/ui/use_self.rs:240:13 | LL | nested::A::fun_1(); | ^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:253:13 + --> tests/ui/use_self.rs:242:13 | LL | nested::A::A; | ^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:256:13 + --> tests/ui/use_self.rs:245:13 | LL | nested::A {}; | ^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:276:13 + --> tests/ui/use_self.rs:265:13 | LL | TestStruct::from_something() | ^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:291:25 + --> tests/ui/use_self.rs:280:25 | LL | async fn g() -> S { | ^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:293:13 + --> tests/ui/use_self.rs:282:13 | LL | S {} | ^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:298:16 + --> tests/ui/use_self.rs:287:16 | LL | &p[S::A..S::B] | ^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:298:22 + --> tests/ui/use_self.rs:287:22 | LL | &p[S::A..S::B] | ^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:323:29 + --> tests/ui/use_self.rs:312:29 | LL | fn foo(value: T) -> Foo { | ^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:325:13 + --> tests/ui/use_self.rs:314:13 | LL | Foo:: { value } | ^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:498:13 + --> tests/ui/use_self.rs:487:13 | LL | A::new::(submod::B {}) | ^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:574:17 + --> tests/ui/use_self.rs:563:17 | LL | Foo::Bar => unimplemented!(), | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:576:17 + --> tests/ui/use_self.rs:565:17 | LL | Foo::Baz => unimplemented!(), | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:583:20 + --> tests/ui/use_self.rs:572:20 | LL | if let Foo::Bar = self { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:608:17 + --> tests/ui/use_self.rs:597:17 | LL | Something::Num(n) => *n, | ^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:610:17 + --> tests/ui/use_self.rs:599:17 | LL | Something::TupleNums(n, _m) => *n, | ^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:612:17 + --> tests/ui/use_self.rs:601:17 | LL | Something::StructNums { one, two: _ } => *one, | ^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:619:17 + --> tests/ui/use_self.rs:608:17 | LL | crate::issue8845::Something::Num(n) => *n, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:621:17 + --> tests/ui/use_self.rs:610:17 | LL | crate::issue8845::Something::TupleNums(n, _m) => *n, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:623:17 + --> tests/ui/use_self.rs:612:17 | LL | crate::issue8845::Something::StructNums { one, two: _ } => *one, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:640:17 + --> tests/ui/use_self.rs:629:17 | LL | let Foo(x) = self; | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:646:17 + --> tests/ui/use_self.rs:635:17 | LL | let crate::issue8845::Foo(x) = self; | ^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:654:17 + --> tests/ui/use_self.rs:643:17 | LL | let Bar { x, .. } = self; | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:660:17 + --> tests/ui/use_self.rs:649:17 | LL | let crate::issue8845::Bar { x, .. } = self; | ^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self.rs:700:17 + --> tests/ui/use_self.rs:689:17 | LL | E::A => {}, | ^ help: use the applicable keyword: `Self` diff --git a/tests/ui/use_self_structs.fixed b/tests/ui/use_self_structs.fixed index bd7bc3e0c1f6..bb3c8722de9f 100644 --- a/tests/ui/use_self_structs.fixed +++ b/tests/ui/use_self_structs.fixed @@ -1,5 +1,5 @@ #![warn(clippy::use_self)] -#![allow(clippy::type_complexity)] +#![expect(clippy::type_complexity)] fn main() {} diff --git a/tests/ui/use_self_structs.rs b/tests/ui/use_self_structs.rs index 624f158164ab..3dbf1337882a 100644 --- a/tests/ui/use_self_structs.rs +++ b/tests/ui/use_self_structs.rs @@ -1,5 +1,5 @@ #![warn(clippy::use_self)] -#![allow(clippy::type_complexity)] +#![expect(clippy::type_complexity)] fn main() {} diff --git a/tests/ui/use_self_trait.fixed b/tests/ui/use_self_trait.fixed index c5d800dc94e1..77c47d304750 100644 --- a/tests/ui/use_self_trait.fixed +++ b/tests/ui/use_self_trait.fixed @@ -1,6 +1,4 @@ #![warn(clippy::use_self)] -#![allow(dead_code)] -#![allow(clippy::should_implement_trait, clippy::boxed_local)] use std::ops::Mul; diff --git a/tests/ui/use_self_trait.rs b/tests/ui/use_self_trait.rs index dcf5820afc26..e8a1a772ec26 100644 --- a/tests/ui/use_self_trait.rs +++ b/tests/ui/use_self_trait.rs @@ -1,6 +1,4 @@ #![warn(clippy::use_self)] -#![allow(dead_code)] -#![allow(clippy::should_implement_trait, clippy::boxed_local)] use std::ops::Mul; diff --git a/tests/ui/use_self_trait.stderr b/tests/ui/use_self_trait.stderr index 1b664b3b7a28..f7eb8f21306b 100644 --- a/tests/ui/use_self_trait.stderr +++ b/tests/ui/use_self_trait.stderr @@ -1,5 +1,5 @@ error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:19:18 + --> tests/ui/use_self_trait.rs:17:18 | LL | fn refs(p1: &Bad) -> &Bad { | ^^^ help: use the applicable keyword: `Self` @@ -8,91 +8,91 @@ LL | fn refs(p1: &Bad) -> &Bad { = help: to override `-D warnings` add `#[allow(clippy::use_self)]` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:19:27 + --> tests/ui/use_self_trait.rs:17:27 | LL | fn refs(p1: &Bad) -> &Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:25:33 + --> tests/ui/use_self_trait.rs:23:33 | LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:25:49 + --> tests/ui/use_self_trait.rs:23:49 | LL | fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:31:26 + --> tests/ui/use_self_trait.rs:29:26 | LL | fn mut_refs(p1: &mut Bad) -> &mut Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:31:39 + --> tests/ui/use_self_trait.rs:29:39 | LL | fn mut_refs(p1: &mut Bad) -> &mut Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:37:24 + --> tests/ui/use_self_trait.rs:35:24 | LL | fn nested(_p1: Box, _p2: (&u8, &Bad)) {} | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:37:42 + --> tests/ui/use_self_trait.rs:35:42 | LL | fn nested(_p1: Box, _p2: (&u8, &Bad)) {} | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:41:16 + --> tests/ui/use_self_trait.rs:39:16 | LL | fn vals(_: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:41:24 + --> tests/ui/use_self_trait.rs:39:24 | LL | fn vals(_: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:44:9 + --> tests/ui/use_self_trait.rs:42:9 | LL | Bad | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:50:19 + --> tests/ui/use_self_trait.rs:48:19 | LL | type Output = Bad; | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:53:23 + --> tests/ui/use_self_trait.rs:51:23 | LL | fn mul(self, rhs: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:53:31 + --> tests/ui/use_self_trait.rs:51:31 | LL | fn mul(self, rhs: Bad) -> Bad { | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:62:9 + --> tests/ui/use_self_trait.rs:60:9 | LL | Bad | ^^^ help: use the applicable keyword: `Self` error: unnecessary structure name repetition - --> tests/ui/use_self_trait.rs:160:13 + --> tests/ui/use_self_trait.rs:158:13 | LL | std::fmt::Error // Should lint | ^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self` diff --git a/tests/ui/used_underscore_binding.rs b/tests/ui/used_underscore_binding.rs index 3b063fd16be1..b2a8fdcc0ce7 100644 --- a/tests/ui/used_underscore_binding.rs +++ b/tests/ui/used_underscore_binding.rs @@ -1,7 +1,7 @@ //@aux-build:proc_macro_derive.rs #![feature(rustc_private)] #![warn(clippy::used_underscore_binding)] -#![allow(clippy::disallowed_names, clippy::eq_op, clippy::uninlined_format_args)] +#![expect(clippy::disallowed_names, clippy::eq_op, clippy::uninlined_format_args)] #[macro_use] extern crate proc_macro_derive; diff --git a/tests/ui/used_underscore_items.rs b/tests/ui/used_underscore_items.rs index aecdd32693c1..08660eefc322 100644 --- a/tests/ui/used_underscore_items.rs +++ b/tests/ui/used_underscore_items.rs @@ -1,5 +1,4 @@ //@aux-build:external_item.rs -#![allow(unused)] #![warn(clippy::used_underscore_items)] extern crate external_item; diff --git a/tests/ui/used_underscore_items.stderr b/tests/ui/used_underscore_items.stderr index d6e23f1e726a..b2f9e2db0dfc 100644 --- a/tests/ui/used_underscore_items.stderr +++ b/tests/ui/used_underscore_items.stderr @@ -1,11 +1,11 @@ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:43:5 + --> tests/ui/used_underscore_items.rs:42:5 | LL | _foo1(); | ^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:22:1 + --> tests/ui/used_underscore_items.rs:21:1 | LL | fn _foo1() {} | ^^^^^^^^^^ @@ -13,97 +13,97 @@ LL | fn _foo1() {} = help: to override `-D warnings` add `#[allow(clippy::used_underscore_items)]` error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:45:13 + --> tests/ui/used_underscore_items.rs:44:13 | LL | let _ = _foo2(); | ^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:24:1 + --> tests/ui/used_underscore_items.rs:23:1 | LL | fn _foo2() -> i32 { | ^^^^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:47:5 + --> tests/ui/used_underscore_items.rs:46:5 | LL | a::b::c::_foo3(); | ^^^^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:31:13 + --> tests/ui/used_underscore_items.rs:30:13 | LL | pub fn _foo3() {} | ^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:49:14 + --> tests/ui/used_underscore_items.rs:48:14 | LL | let _ = &_FooStruct {}; | ^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:16:1 + --> tests/ui/used_underscore_items.rs:15:1 | LL | struct _FooStruct {} | ^^^^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:51:13 + --> tests/ui/used_underscore_items.rs:50:13 | LL | let _ = _FooStruct {}; | ^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:16:1 + --> tests/ui/used_underscore_items.rs:15:1 | LL | struct _FooStruct {} | ^^^^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:54:22 + --> tests/ui/used_underscore_items.rs:53:22 | LL | let foo_struct = _FooStruct {}; | ^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:16:1 + --> tests/ui/used_underscore_items.rs:15:1 | LL | struct _FooStruct {} | ^^^^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:56:5 + --> tests/ui/used_underscore_items.rs:55:5 | LL | foo_struct._method_call(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:19:5 + --> tests/ui/used_underscore_items.rs:18:5 | LL | fn _method_call(self) {} | ^^^^^^^^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:59:23 + --> tests/ui/used_underscore_items.rs:58:23 | LL | let foo_struct2 = a::b::c::_FooStruct2 {}; | ^^^^^^^^^^^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:33:13 + --> tests/ui/used_underscore_items.rs:32:13 | LL | pub struct _FooStruct2 {} | ^^^^^^^^^^^^^^^^^^^^^^ error: used underscore-prefixed item - --> tests/ui/used_underscore_items.rs:61:5 + --> tests/ui/used_underscore_items.rs:60:5 | LL | foo_struct2._method_call(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: item is defined here - --> tests/ui/used_underscore_items.rs:36:17 + --> tests/ui/used_underscore_items.rs:35:17 | LL | pub fn _method_call(self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/useful_asref.rs b/tests/ui/useful_asref.rs index a37c2785bde2..12e2a5837bf8 100644 --- a/tests/ui/useful_asref.rs +++ b/tests/ui/useful_asref.rs @@ -1,7 +1,7 @@ //@ check-pass -#![deny(clippy::useless_asref)] -#![allow(clippy::needless_lifetimes)] +#![warn(clippy::useless_asref)] +#![expect(clippy::needless_lifetimes)] trait Trait { fn as_ptr(&self); diff --git a/tests/ui/useless_asref.fixed b/tests/ui/useless_asref.fixed index 5131ae113d18..587f3cf6427b 100644 --- a/tests/ui/useless_asref.fixed +++ b/tests/ui/useless_asref.fixed @@ -1,11 +1,5 @@ -#![deny(clippy::useless_asref)] -#![allow( - clippy::explicit_auto_deref, - clippy::uninlined_format_args, - clippy::map_clone, - clippy::needless_pass_by_ref_mut, - clippy::redundant_closure -)] +#![warn(clippy::useless_asref)] +#![expect(clippy::redundant_closure)] use std::fmt::Debug; use std::ops::Deref; @@ -83,7 +77,7 @@ fn not_ok() { //~^ useless_asref foo_rslice(mrrrrrslice); } - #[allow(unused_parens, clippy::double_parens, clippy::needless_borrow)] + #[allow(clippy::double_parens, clippy::needless_borrow)] foo_rrrrmr((&&&&MoreRef)); //~^ useless_asref diff --git a/tests/ui/useless_asref.rs b/tests/ui/useless_asref.rs index e1c2a1d81d04..e203942bbaf5 100644 --- a/tests/ui/useless_asref.rs +++ b/tests/ui/useless_asref.rs @@ -1,11 +1,5 @@ -#![deny(clippy::useless_asref)] -#![allow( - clippy::explicit_auto_deref, - clippy::uninlined_format_args, - clippy::map_clone, - clippy::needless_pass_by_ref_mut, - clippy::redundant_closure -)] +#![warn(clippy::useless_asref)] +#![expect(clippy::redundant_closure)] use std::fmt::Debug; use std::ops::Deref; @@ -83,7 +77,7 @@ fn not_ok() { //~^ useless_asref foo_rslice(mrrrrrslice); } - #[allow(unused_parens, clippy::double_parens, clippy::needless_borrow)] + #[allow(clippy::double_parens, clippy::needless_borrow)] foo_rrrrmr((&&&&MoreRef).as_ref()); //~^ useless_asref diff --git a/tests/ui/useless_asref.stderr b/tests/ui/useless_asref.stderr index 861472b4419e..cc7bf0e8ae36 100644 --- a/tests/ui/useless_asref.stderr +++ b/tests/ui/useless_asref.stderr @@ -1,143 +1,140 @@ error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:51:18 + --> tests/ui/useless_asref.rs:45:18 | LL | foo_rstr(rstr.as_ref()); | ^^^^^^^^^^^^^ help: try: `rstr` | -note: the lint level is defined here - --> tests/ui/useless_asref.rs:1:9 - | -LL | #![deny(clippy::useless_asref)] - | ^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::useless-asref` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::useless_asref)]` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:54:20 + --> tests/ui/useless_asref.rs:48:20 | LL | foo_rslice(rslice.as_ref()); | ^^^^^^^^^^^^^^^ help: try: `rslice` error: this call to `as_mut` does nothing - --> tests/ui/useless_asref.rs:59:21 + --> tests/ui/useless_asref.rs:53:21 | LL | foo_mrslice(mrslice.as_mut()); | ^^^^^^^^^^^^^^^^ help: try: `mrslice` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:62:20 + --> tests/ui/useless_asref.rs:56:20 | LL | foo_rslice(mrslice.as_ref()); | ^^^^^^^^^^^^^^^^ help: try: `mrslice` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:70:20 + --> tests/ui/useless_asref.rs:64:20 | LL | foo_rslice(rrrrrslice.as_ref()); | ^^^^^^^^^^^^^^^^^^^ help: try: `rrrrrslice` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:73:18 + --> tests/ui/useless_asref.rs:67:18 | LL | foo_rstr(rrrrrstr.as_ref()); | ^^^^^^^^^^^^^^^^^ help: try: `rrrrrstr` error: this call to `as_mut` does nothing - --> tests/ui/useless_asref.rs:79:21 + --> tests/ui/useless_asref.rs:73:21 | LL | foo_mrslice(mrrrrrslice.as_mut()); | ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:82:20 + --> tests/ui/useless_asref.rs:76:20 | LL | foo_rslice(mrrrrrslice.as_ref()); | ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:87:16 + --> tests/ui/useless_asref.rs:81:16 | LL | foo_rrrrmr((&&&&MoreRef).as_ref()); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&&&&MoreRef)` error: this call to `as_mut` does nothing - --> tests/ui/useless_asref.rs:138:13 + --> tests/ui/useless_asref.rs:132:13 | LL | foo_mrt(mrt.as_mut()); | ^^^^^^^^^^^^ help: try: `mrt` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:141:12 + --> tests/ui/useless_asref.rs:135:12 | LL | foo_rt(mrt.as_ref()); | ^^^^^^^^^^^^ help: try: `mrt` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:153:13 + --> tests/ui/useless_asref.rs:147:13 | LL | let z = x.as_ref().map(String::clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:156:13 + --> tests/ui/useless_asref.rs:150:13 | LL | let z = x.as_ref().map(|z| z.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:159:13 + --> tests/ui/useless_asref.rs:153:13 | LL | let z = x.as_ref().map(|z| String::clone(z)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:183:9 + --> tests/ui/useless_asref.rs:177:9 | LL | x.field.as_ref().map(|v| v.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.field.clone()` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:186:9 + --> tests/ui/useless_asref.rs:180:9 | LL | x.field.as_ref().map(Clone::clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.field.clone()` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:189:9 + --> tests/ui/useless_asref.rs:183:9 | LL | x.field.as_ref().map(|v| Clone::clone(v)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.field.clone()` error: this call to `as_ref.map(...)` does nothing - --> tests/ui/useless_asref.rs:194:9 + --> tests/ui/useless_asref.rs:188:9 | LL | Some(1).as_ref().map(|&x| x.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(1).clone()` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:264:66 + --> tests/ui/useless_asref.rs:258:66 | LL | let v: Vec> = exts.iter().map(|s| Cow::Borrowed(s.as_ref())).collect(); | ^^^^^^^^^^ help: try: `*s` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:277:66 + --> tests/ui/useless_asref.rs:271:66 | LL | let v: Vec> = exts.iter().map(|s| Cow::Borrowed(s.id().as_ref())).collect(); | ^^^^^^^^^^^^^^^ help: try: `s.id()` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:282:32 + --> tests/ui/useless_asref.rs:276:32 | LL | .map(|s| Cow::Borrowed(std::convert::identity(s).as_ref())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `*std::convert::identity(s)` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:288:72 + --> tests/ui/useless_asref.rs:282:72 | LL | let v: Vec> = exts_field.iter().map(|w| Cow::Borrowed(w.0.as_ref())).collect(); | ^^^^^^^^^^^^ help: try: `w.0` error: this call to `as_ref` does nothing - --> tests/ui/useless_asref.rs:292:74 + --> tests/ui/useless_asref.rs:286:74 | LL | let v: Vec> = exts_index.iter().map(|arr| Cow::Borrowed(arr[0].as_ref())).collect(); | ^^^^^^^^^^^^^^^ help: try: `arr[0]` diff --git a/tests/ui/useless_attribute.fixed b/tests/ui/useless_attribute.fixed index ff40f51c0205..7ca97f517f95 100644 --- a/tests/ui/useless_attribute.fixed +++ b/tests/ui/useless_attribute.fixed @@ -1,8 +1,7 @@ //@aux-build:proc_macro_derive.rs - -#![allow(unused, clippy::duplicated_attributes)] #![warn(clippy::useless_attribute)] -#![warn(unreachable_pub)] +#![deny(unreachable_pub)] +#![expect(clippy::duplicated_attributes)] #![feature(rustc_private)] #![allow(dead_code)] diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs index 426c720b4429..effc1691edac 100644 --- a/tests/ui/useless_attribute.rs +++ b/tests/ui/useless_attribute.rs @@ -1,8 +1,7 @@ //@aux-build:proc_macro_derive.rs - -#![allow(unused, clippy::duplicated_attributes)] #![warn(clippy::useless_attribute)] -#![warn(unreachable_pub)] +#![deny(unreachable_pub)] +#![expect(clippy::duplicated_attributes)] #![feature(rustc_private)] #[allow(dead_code)] diff --git a/tests/ui/useless_attribute.stderr b/tests/ui/useless_attribute.stderr index 91383adf994b..9efc7ee0bbc6 100644 --- a/tests/ui/useless_attribute.stderr +++ b/tests/ui/useless_attribute.stderr @@ -1,5 +1,5 @@ error: useless lint attribute - --> tests/ui/useless_attribute.rs:8:1 + --> tests/ui/useless_attribute.rs:7:1 | LL | #[allow(dead_code)] | ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code)]` @@ -8,13 +8,13 @@ LL | #[allow(dead_code)] = help: to override `-D warnings` add `#[allow(clippy::useless_attribute)]` error: useless lint attribute - --> tests/ui/useless_attribute.rs:10:1 + --> tests/ui/useless_attribute.rs:9:1 | LL | #[cfg_attr(clippy, allow(dead_code))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![cfg_attr(clippy, allow(dead_code)` error: useless lint attribute - --> tests/ui/useless_attribute.rs:22:5 + --> tests/ui/useless_attribute.rs:21:5 | LL | #[allow(clippy::almost_swapped)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(clippy::almost_swapped)]` diff --git a/tests/ui/useless_borrows_in_formatting.fixed b/tests/ui/useless_borrows_in_formatting.fixed index f1a4635ee726..675303d97819 100644 --- a/tests/ui/useless_borrows_in_formatting.fixed +++ b/tests/ui/useless_borrows_in_formatting.fixed @@ -2,7 +2,6 @@ // TESTNAME=useless_borrows_in_formatting cargo uitest // TESTNAME=useless_borrows_in_formatting cargo uibless #![warn(clippy::useless_borrows_in_formatting)] -#![allow(unused, clippy::useless_format)] fn main() { let mut s: &str = "hello"; diff --git a/tests/ui/useless_borrows_in_formatting.rs b/tests/ui/useless_borrows_in_formatting.rs index 12ad80cc8dd5..dc67d38fa6d5 100644 --- a/tests/ui/useless_borrows_in_formatting.rs +++ b/tests/ui/useless_borrows_in_formatting.rs @@ -2,7 +2,6 @@ // TESTNAME=useless_borrows_in_formatting cargo uitest // TESTNAME=useless_borrows_in_formatting cargo uibless #![warn(clippy::useless_borrows_in_formatting)] -#![allow(unused, clippy::useless_format)] fn main() { let mut s: &str = "hello"; diff --git a/tests/ui/useless_borrows_in_formatting.stderr b/tests/ui/useless_borrows_in_formatting.stderr index 683d9dfdf946..13c014df0cc7 100644 --- a/tests/ui/useless_borrows_in_formatting.stderr +++ b/tests/ui/useless_borrows_in_formatting.stderr @@ -1,5 +1,5 @@ error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:9:20 + --> tests/ui/useless_borrows_in_formatting.rs:8:20 | LL | println!("{}", &s); | ^^ help: remove the redundant `&`: `s` @@ -8,103 +8,103 @@ LL | println!("{}", &s); = help: to override `-D warnings` add `#[allow(clippy::useless_borrows_in_formatting)]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:10:22 + --> tests/ui/useless_borrows_in_formatting.rs:9:22 | LL | println!("{:?}", &s); | ^^ help: remove the redundant `&`: `s` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:11:20 + --> tests/ui/useless_borrows_in_formatting.rs:10:20 | LL | println!("{}", &&s); | ^^^ help: remove the redundant `&`: `s` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:12:20 + --> tests/ui/useless_borrows_in_formatting.rs:11:20 | LL | println!("{}", &&mut s); | ^^^^^^^ help: remove the redundant `&`/`&mut`: `s` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:13:20 + --> tests/ui/useless_borrows_in_formatting.rs:12:20 | LL | println!("{}", &mut &s); | ^^^^^^^ help: remove the redundant `&`/`&mut`: `s` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:14:20 + --> tests/ui/useless_borrows_in_formatting.rs:13:20 | LL | println!("{}", &mut s); | ^^^^^^ help: remove the redundant `&mut`: `s` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:17:20 + --> tests/ui/useless_borrows_in_formatting.rs:16:20 | LL | println!("{}", &string); | ^^^^^^^ help: remove the redundant `&`: `string` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:18:22 + --> tests/ui/useless_borrows_in_formatting.rs:17:22 | LL | println!("{:?}", &string); | ^^^^^^^ help: remove the redundant `&`: `string` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:19:20 + --> tests/ui/useless_borrows_in_formatting.rs:18:20 | LL | println!("{}", &&string); | ^^^^^^^^ help: remove the redundant `&`: `string` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:20:20 + --> tests/ui/useless_borrows_in_formatting.rs:19:20 | LL | println!("{}", &&string[..2]); | ^^^^^^^^^^^^^ help: remove the redundant `&`: `&string[..2]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:21:22 + --> tests/ui/useless_borrows_in_formatting.rs:20:22 | LL | println!("{:?}", &&string[..2]); | ^^^^^^^^^^^^^ help: remove the redundant `&`: `&string[..2]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:27:20 + --> tests/ui/useless_borrows_in_formatting.rs:26:20 | LL | println!("{}", &n); | ^^ help: remove the redundant `&`: `n` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:28:22 + --> tests/ui/useless_borrows_in_formatting.rs:27:22 | LL | println!("{:?}", &n); | ^^ help: remove the redundant `&`: `n` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:29:20 + --> tests/ui/useless_borrows_in_formatting.rs:28:20 | LL | println!("{}", &&n); | ^^^ help: remove the redundant `&`: `n` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:33:20 + --> tests/ui/useless_borrows_in_formatting.rs:32:20 | LL | println!("{}", &slice[0]); | ^^^^^^^^^ help: remove the redundant `&`: `slice[0]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:34:22 + --> tests/ui/useless_borrows_in_formatting.rs:33:22 | LL | println!("{:?}", &slice[0]); | ^^^^^^^^^ help: remove the redundant `&`: `slice[0]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:35:20 + --> tests/ui/useless_borrows_in_formatting.rs:34:20 | LL | println!("{}", &&slice[0]); | ^^^^^^^^^^ help: remove the redundant `&`: `slice[0]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:40:9 + --> tests/ui/useless_borrows_in_formatting.rs:39:9 | LL | / &[ LL | | @@ -125,157 +125,157 @@ LL + ] | error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:48:22 + --> tests/ui/useless_borrows_in_formatting.rs:47:22 | LL | println!("{:?}", &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the redundant `&`: `[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:52:26 + --> tests/ui/useless_borrows_in_formatting.rs:51:26 | LL | println!("{:016x?}", &[a[0], a[1], a[0], a[1]]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the redundant `&`: `[a[0], a[1], a[0], a[1]]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:56:22 + --> tests/ui/useless_borrows_in_formatting.rs:55:22 | LL | println!("{:?}", &&slice[0..1]); | ^^^^^^^^^^^^^ help: remove the redundant `&`: `&slice[0..1]` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:65:20 + --> tests/ui/useless_borrows_in_formatting.rs:64:20 | LL | println!("{}", &w.0); | ^^^^ help: remove the redundant `&`: `w.0` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:66:22 + --> tests/ui/useless_borrows_in_formatting.rs:65:22 | LL | println!("{:?}", &w.0); | ^^^^ help: remove the redundant `&`: `w.0` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:67:20 + --> tests/ui/useless_borrows_in_formatting.rs:66:20 | LL | println!("{}", &&w.0); | ^^^^^ help: remove the redundant `&`: `w.0` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:72:20 + --> tests/ui/useless_borrows_in_formatting.rs:71:20 | LL | println!("{}", &w.0); | ^^^^ help: remove the redundant `&`: `w.0` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:73:22 + --> tests/ui/useless_borrows_in_formatting.rs:72:22 | LL | println!("{:?}", &w.0); | ^^^^ help: remove the redundant `&`: `w.0` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:74:20 + --> tests/ui/useless_borrows_in_formatting.rs:73:20 | LL | println!("{}", &&w.0); | ^^^^^ help: remove the redundant `&`: `w.0` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:77:20 + --> tests/ui/useless_borrows_in_formatting.rs:76:20 | LL | println!("{}", &*a); | ^^^ help: remove the redundant `&`: `*a` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:78:22 + --> tests/ui/useless_borrows_in_formatting.rs:77:22 | LL | println!("{:?}", &*a); | ^^^ help: remove the redundant `&`: `*a` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:82:20 + --> tests/ui/useless_borrows_in_formatting.rs:81:20 | LL | println!("{}", &(n)); | ^^^^ help: remove the redundant `&`: `(n)` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:83:22 + --> tests/ui/useless_borrows_in_formatting.rs:82:22 | LL | println!("{:?}", &(n + 1)); | ^^^^^^^^ help: remove the redundant `&`: `(n + 1)` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:84:20 + --> tests/ui/useless_borrows_in_formatting.rs:83:20 | LL | println!("{}", &(String::from("paren"))); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the redundant `&`: `(String::from("paren"))` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:87:20 + --> tests/ui/useless_borrows_in_formatting.rs:86:20 | LL | println!("{}", &{ n }); | ^^^^^^ help: remove the redundant `&`: `{ n }` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:88:22 + --> tests/ui/useless_borrows_in_formatting.rs:87:22 | LL | println!("{:?}", &{ n + 1 }); | ^^^^^^^^^^ help: remove the redundant `&`: `{ n + 1 }` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:89:20 + --> tests/ui/useless_borrows_in_formatting.rs:88:20 | LL | println!("{}", &{ String::from("block") }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the redundant `&`: `{ String::from("block") }` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:94:27 + --> tests/ui/useless_borrows_in_formatting.rs:93:27 | LL | println!("{0:1$.2$}", &v1, &v2, &v3); | ^^^ help: remove the redundant `&`: `v1` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:94:32 + --> tests/ui/useless_borrows_in_formatting.rs:93:32 | LL | println!("{0:1$.2$}", &v1, &v2, &v3); | ^^^ help: remove the redundant `&`: `v2` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:94:37 + --> tests/ui/useless_borrows_in_formatting.rs:93:37 | LL | println!("{0:1$.2$}", &v1, &v2, &v3); | ^^^ help: remove the redundant `&`: `v3` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:98:28 + --> tests/ui/useless_borrows_in_formatting.rs:97:28 | LL | println!("{0:1$.2$?}", &v1, &v2, &v3); | ^^^ help: remove the redundant `&`: `v1` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:98:33 + --> tests/ui/useless_borrows_in_formatting.rs:97:33 | LL | println!("{0:1$.2$?}", &v1, &v2, &v3); | ^^^ help: remove the redundant `&`: `v2` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:98:38 + --> tests/ui/useless_borrows_in_formatting.rs:97:38 | LL | println!("{0:1$.2$?}", &v1, &v2, &v3); | ^^^ help: remove the redundant `&`: `v3` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:102:27 + --> tests/ui/useless_borrows_in_formatting.rs:101:27 | LL | println!("{0:1$.2$}", &v1, v2, v3); | ^^^ help: remove the redundant `&`: `v1` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:103:31 + --> tests/ui/useless_borrows_in_formatting.rs:102:31 | LL | println!("{0:1$.2$}", v1, &v2, v3); | ^^^ help: remove the redundant `&`: `v2` error: redundant reference in `println!` argument - --> tests/ui/useless_borrows_in_formatting.rs:104:35 + --> tests/ui/useless_borrows_in_formatting.rs:103:35 | LL | println!("{0:1$.2$}", v1, v2, &v3); | ^^^ help: remove the redundant `&`: `v3` diff --git a/tests/ui/useless_conversion.fixed b/tests/ui/useless_conversion.fixed index a22df7013f98..84e20b4d0983 100644 --- a/tests/ui/useless_conversion.fixed +++ b/tests/ui/useless_conversion.fixed @@ -1,8 +1,7 @@ -#![deny(clippy::useless_conversion)] -#![allow(clippy::into_iter_on_ref)] -#![allow(clippy::needless_ifs, clippy::unnecessary_wraps, unused)] +#![warn(clippy::useless_conversion)] // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint -#![allow(static_mut_refs)] +#![expect(static_mut_refs)] +#![allow(clippy::into_iter_on_ref)] use std::ops::ControlFlow; @@ -173,7 +172,6 @@ fn main() { issue11300::bar(); } -#[allow(dead_code)] fn issue11065_fp() { use std::option::IntoIter; fn takes_into_iter(_: impl IntoIterator) {} @@ -187,7 +185,6 @@ fn issue11065_fp() { x!(Some(5).into_iter()); } -#[allow(dead_code)] fn explicit_into_iter_fn_arg() { fn a(_: T) {} fn b>(_: T) {} diff --git a/tests/ui/useless_conversion.rs b/tests/ui/useless_conversion.rs index 1f170cf87ac5..1782b840855f 100644 --- a/tests/ui/useless_conversion.rs +++ b/tests/ui/useless_conversion.rs @@ -1,8 +1,7 @@ -#![deny(clippy::useless_conversion)] -#![allow(clippy::into_iter_on_ref)] -#![allow(clippy::needless_ifs, clippy::unnecessary_wraps, unused)] +#![warn(clippy::useless_conversion)] // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint -#![allow(static_mut_refs)] +#![expect(static_mut_refs)] +#![allow(clippy::into_iter_on_ref)] use std::ops::ControlFlow; @@ -173,7 +172,6 @@ fn main() { issue11300::bar(); } -#[allow(dead_code)] fn issue11065_fp() { use std::option::IntoIter; fn takes_into_iter(_: impl IntoIterator) {} @@ -187,7 +185,6 @@ fn issue11065_fp() { x!(Some(5).into_iter()); } -#[allow(dead_code)] fn explicit_into_iter_fn_arg() { fn a(_: T) {} fn b>(_: T) {} diff --git a/tests/ui/useless_conversion.stderr b/tests/ui/useless_conversion.stderr index 7042e18a2cad..e8174427de82 100644 --- a/tests/ui/useless_conversion.stderr +++ b/tests/ui/useless_conversion.stderr @@ -1,65 +1,62 @@ error: useless conversion to the same type: `T` - --> tests/ui/useless_conversion.rs:10:13 + --> tests/ui/useless_conversion.rs:9:13 | LL | let _ = T::from(val); | ^^^^^^^^^^^^ help: consider removing `T::from()`: `val` | -note: the lint level is defined here - --> tests/ui/useless_conversion.rs:1:9 - | -LL | #![deny(clippy::useless_conversion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::useless-conversion` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]` error: useless conversion to the same type: `T` - --> tests/ui/useless_conversion.rs:12:5 + --> tests/ui/useless_conversion.rs:11:5 | LL | val.into() | ^^^^^^^^^^ help: consider removing `.into()`: `val` error: useless conversion to the same type: `i32` - --> tests/ui/useless_conversion.rs:25:22 + --> tests/ui/useless_conversion.rs:24:22 | LL | let _: i32 = 0i32.into(); | ^^^^^^^^^^^ help: consider removing `.into()`: `0i32` error: useless conversion to the same type: `std::str::Lines<'_>` - --> tests/ui/useless_conversion.rs:56:22 + --> tests/ui/useless_conversion.rs:55:22 | LL | if Some("ok") == lines.into_iter().next() {} | ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines` error: useless conversion to the same type: `std::str::Lines<'_>` - --> tests/ui/useless_conversion.rs:62:21 + --> tests/ui/useless_conversion.rs:61:21 | LL | let mut lines = text.lines().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()` error: useless conversion to the same type: `std::str::Lines<'_>` - --> tests/ui/useless_conversion.rs:69:22 + --> tests/ui/useless_conversion.rs:68:22 | LL | if Some("ok") == text.lines().into_iter().next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()` error: useless conversion to the same type: `std::iter::Empty` - --> tests/ui/useless_conversion.rs:76:13 + --> tests/ui/useless_conversion.rs:75:13 | LL | let _ = NUMBERS.into_iter().next(); | ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS` error: useless conversion to the same type: `std::iter::Empty` - --> tests/ui/useless_conversion.rs:82:17 + --> tests/ui/useless_conversion.rs:81:17 | LL | let mut n = NUMBERS.into_iter(); | ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS` error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:126:17 + --> tests/ui/useless_conversion.rs:125:17 | LL | consume(items.into_iter()); | ^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:122:28 + --> tests/ui/useless_conversion.rs:121:28 | LL | fn consume(_: impl IntoIterator) {} | ^^^^^^^^^^^^ @@ -70,79 +67,79 @@ LL + consume(*items); | error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion.rs:139:21 + --> tests/ui/useless_conversion.rs:138:21 | LL | let _: String = "foo".to_string().into(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion.rs:141:21 + --> tests/ui/useless_conversion.rs:140:21 | LL | let _: String = From::from("foo".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion.rs:143:13 + --> tests/ui/useless_conversion.rs:142:13 | LL | let _ = String::from("foo".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion.rs:145:13 + --> tests/ui/useless_conversion.rs:144:13 | LL | let _ = String::from(format!("A: {:04}", 123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)` error: useless conversion to the same type: `std::str::Lines<'_>` - --> tests/ui/useless_conversion.rs:147:13 + --> tests/ui/useless_conversion.rs:146:13 | LL | let _ = "".lines().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()` error: useless conversion to the same type: `std::vec::IntoIter` - --> tests/ui/useless_conversion.rs:149:13 + --> tests/ui/useless_conversion.rs:148:13 | LL | let _ = vec![1, 2, 3].into_iter().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion.rs:151:21 + --> tests/ui/useless_conversion.rs:150:21 | LL | let _: String = format!("Hello {}", "world").into(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")` error: useless conversion to the same type: `i32` - --> tests/ui/useless_conversion.rs:157:13 + --> tests/ui/useless_conversion.rs:156:13 | LL | let _ = i32::from(a + b) * 3; | ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)` error: useless conversion to the same type: `Foo<'a'>` - --> tests/ui/useless_conversion.rs:164:23 + --> tests/ui/useless_conversion.rs:163:23 | LL | let _: Foo<'a'> = s2.into(); | ^^^^^^^^^ help: consider removing `.into()`: `s2` error: useless conversion to the same type: `Foo<'a'>` - --> tests/ui/useless_conversion.rs:167:13 + --> tests/ui/useless_conversion.rs:166:13 | LL | let _ = Foo::<'a'>::from(s3); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3` error: useless conversion to the same type: `std::vec::IntoIter>` - --> tests/ui/useless_conversion.rs:170:13 + --> tests/ui/useless_conversion.rs:169:13 | LL | let _ = vec![s4, s4, s4].into_iter().into_iter(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()` error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:203:7 + --> tests/ui/useless_conversion.rs:200:7 | LL | b(vec![1, 2].into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:193:13 + --> tests/ui/useless_conversion.rs:190:13 | LL | fn b>(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -153,13 +150,13 @@ LL + b(vec![1, 2]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:205:7 + --> tests/ui/useless_conversion.rs:202:7 | LL | c(vec![1, 2].into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:194:18 + --> tests/ui/useless_conversion.rs:191:18 | LL | fn c(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -170,13 +167,13 @@ LL + c(vec![1, 2]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:207:7 + --> tests/ui/useless_conversion.rs:204:7 | LL | d(vec![1, 2].into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:197:12 + --> tests/ui/useless_conversion.rs:194:12 | LL | T: IntoIterator, | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -187,13 +184,13 @@ LL + d(vec![1, 2]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:211:7 + --> tests/ui/useless_conversion.rs:208:7 | LL | b(vec![1, 2].into_iter().into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:193:13 + --> tests/ui/useless_conversion.rs:190:13 | LL | fn b>(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -204,13 +201,13 @@ LL + b(vec![1, 2]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:213:7 + --> tests/ui/useless_conversion.rs:210:7 | LL | b(vec![1, 2].into_iter().into_iter().into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:193:13 + --> tests/ui/useless_conversion.rs:190:13 | LL | fn b>(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -221,13 +218,13 @@ LL + b(vec![1, 2]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:260:24 + --> tests/ui/useless_conversion.rs:257:24 | LL | foo2::([1, 2, 3].into_iter()); | ^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:239:12 + --> tests/ui/useless_conversion.rs:236:12 | LL | I: IntoIterator + Helper, | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -238,13 +235,13 @@ LL + foo2::([1, 2, 3]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:269:14 + --> tests/ui/useless_conversion.rs:266:14 | LL | foo3([1, 2, 3].into_iter()); | ^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:248:12 + --> tests/ui/useless_conversion.rs:245:12 | LL | I: IntoIterator, | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -255,13 +252,13 @@ LL + foo3([1, 2, 3]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:279:16 + --> tests/ui/useless_conversion.rs:276:16 | LL | S1.foo([1, 2].into_iter()); | ^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:276:27 + --> tests/ui/useless_conversion.rs:273:27 | LL | pub fn foo(&self, _: I) {} | ^^^^^^^^^^^^ @@ -272,13 +269,13 @@ LL + S1.foo([1, 2]); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:299:44 + --> tests/ui/useless_conversion.rs:296:44 | LL | v0.into_iter().interleave_shortest(v1.into_iter()); | ^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:286:20 + --> tests/ui/useless_conversion.rs:283:20 | LL | J: IntoIterator, | ^^^^^^^^^^^^ @@ -289,61 +286,61 @@ LL + v0.into_iter().interleave_shortest(v1); | error: useless conversion to the same type: `()` - --> tests/ui/useless_conversion.rs:327:58 + --> tests/ui/useless_conversion.rs:324:58 | LL | let _: Result<(), std::io::Error> = test_issue_3913().map(Into::into); | ^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `std::io::Error` - --> tests/ui/useless_conversion.rs:330:58 + --> tests/ui/useless_conversion.rs:327:58 | LL | let _: Result<(), std::io::Error> = test_issue_3913().map_err(Into::into); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `()` - --> tests/ui/useless_conversion.rs:333:58 + --> tests/ui/useless_conversion.rs:330:58 | LL | let _: Result<(), std::io::Error> = test_issue_3913().map(From::from); | ^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `std::io::Error` - --> tests/ui/useless_conversion.rs:336:58 + --> tests/ui/useless_conversion.rs:333:58 | LL | let _: Result<(), std::io::Error> = test_issue_3913().map_err(From::from); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `()` - --> tests/ui/useless_conversion.rs:340:31 + --> tests/ui/useless_conversion.rs:337:31 | LL | let _: ControlFlow<()> = c.map_break(Into::into); | ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `()` - --> tests/ui/useless_conversion.rs:344:31 + --> tests/ui/useless_conversion.rs:341:31 | LL | let _: ControlFlow<()> = c.map_continue(Into::into); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `u32` - --> tests/ui/useless_conversion.rs:358:41 + --> tests/ui/useless_conversion.rs:355:41 | LL | let _: Vec = [1u32].into_iter().map(Into::into).collect(); | ^^^^^^^^^^^^^^^^ help: consider removing error: useless conversion to the same type: `T` - --> tests/ui/useless_conversion.rs:369:18 + --> tests/ui/useless_conversion.rs:366:18 | LL | x.into_iter().map(Into::into).collect() | ^^^^^^^^^^^^^^^^ help: consider removing error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:385:29 + --> tests/ui/useless_conversion.rs:382:29 | LL | takes_into_iter(self.my_field.into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:374:32 + --> tests/ui/useless_conversion.rs:371:32 | LL | fn takes_into_iter(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -354,13 +351,13 @@ LL + takes_into_iter(&self.my_field); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:393:29 + --> tests/ui/useless_conversion.rs:390:29 | LL | takes_into_iter(self.my_field.into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:374:32 + --> tests/ui/useless_conversion.rs:371:32 | LL | fn takes_into_iter(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -371,13 +368,13 @@ LL + takes_into_iter(&mut self.my_field); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:402:29 + --> tests/ui/useless_conversion.rs:399:29 | LL | takes_into_iter(self.my_field.into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:374:32 + --> tests/ui/useless_conversion.rs:371:32 | LL | fn takes_into_iter(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -388,13 +385,13 @@ LL + takes_into_iter(*self.my_field); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:411:29 + --> tests/ui/useless_conversion.rs:408:29 | LL | takes_into_iter(self.my_field.into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:374:32 + --> tests/ui/useless_conversion.rs:371:32 | LL | fn takes_into_iter(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -405,13 +402,13 @@ LL + takes_into_iter(&*self.my_field); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:420:29 + --> tests/ui/useless_conversion.rs:417:29 | LL | takes_into_iter(self.my_field.into_iter()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:374:32 + --> tests/ui/useless_conversion.rs:371:32 | LL | fn takes_into_iter(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -422,49 +419,49 @@ LL + takes_into_iter(&mut *self.my_field); | error: useless conversion to the same type: `std::iter::Empty` - --> tests/ui/useless_conversion.rs:433:5 + --> tests/ui/useless_conversion.rs:430:5 | LL | R.into_iter().for_each(|_x| {}); | ^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `R` error: useless conversion to the same type: `std::iter::Empty` - --> tests/ui/useless_conversion.rs:435:13 + --> tests/ui/useless_conversion.rs:432:13 | LL | let _ = R.into_iter().map(|_x| 0); | ^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `R` error: useless conversion to the same type: `std::ops::Range` - --> tests/ui/useless_conversion.rs:458:14 + --> tests/ui/useless_conversion.rs:455:14 | LL | for _ in (0..10).into_iter() {} | ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `(0..10)` error: useless conversion to the same type: `std::ops::RangeInclusive` - --> tests/ui/useless_conversion.rs:459:14 + --> tests/ui/useless_conversion.rs:456:14 | LL | for _ in (0..=10).into_iter() {} | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `(0..=10)` error: useless conversion to the same type: `std::ops::RangeFrom` - --> tests/ui/useless_conversion.rs:460:14 + --> tests/ui/useless_conversion.rs:457:14 | LL | for _ in (0..).into_iter() { | ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `(0..)` error: useless conversion to the same type: `std::slice::Iter<'_, i32>` - --> tests/ui/useless_conversion.rs:473:14 + --> tests/ui/useless_conversion.rs:470:14 | LL | for _ in mac!(iter [1, 2]).into_iter() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `mac!(iter [1, 2])` error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:486:27 + --> tests/ui/useless_conversion.rs:483:27 | LL | takes_into_iter_usize(b.into_iter()); | ^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:477:34 + --> tests/ui/useless_conversion.rs:474:34 | LL | fn takes_into_iter_usize(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -475,13 +472,13 @@ LL + takes_into_iter_usize(b); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:495:31 + --> tests/ui/useless_conversion.rs:492:31 | LL | takes_into_iter_usize(b.clone().into_iter()); | ^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:477:34 + --> tests/ui/useless_conversion.rs:474:34 | LL | fn takes_into_iter_usize(_: impl IntoIterator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -492,13 +489,13 @@ LL + takes_into_iter_usize(b.clone()); | error: explicit call to `.into_iter()` in function argument accepting `IntoIterator` - --> tests/ui/useless_conversion.rs:503:34 + --> tests/ui/useless_conversion.rs:500:34 | LL | takes_into_iter_usize_result(b.clone().into_iter())?; | ^^^^^^^^^^^^^^^^^^^^^ | note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` - --> tests/ui/useless_conversion.rs:478:41 + --> tests/ui/useless_conversion.rs:475:41 | LL | fn takes_into_iter_usize_result(_: impl IntoIterator) -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/useless_conversion_try.rs b/tests/ui/useless_conversion_try.rs index 157c236a214c..69445c74f31e 100644 --- a/tests/ui/useless_conversion_try.rs +++ b/tests/ui/useless_conversion_try.rs @@ -1,9 +1,5 @@ -#![deny(clippy::useless_conversion)] -#![allow( - clippy::needless_ifs, - clippy::unnecessary_fallible_conversions, - clippy::manual_unwrap_or_default -)] +#![warn(clippy::useless_conversion)] +#![expect(clippy::manual_unwrap_or_default, clippy::unnecessary_fallible_conversions)] fn test_generic(val: T) -> T { let _ = T::try_from(val).unwrap(); diff --git a/tests/ui/useless_conversion_try.stderr b/tests/ui/useless_conversion_try.stderr index 1c62426c8952..fd15efc7ba65 100644 --- a/tests/ui/useless_conversion_try.stderr +++ b/tests/ui/useless_conversion_try.stderr @@ -1,18 +1,15 @@ error: useless conversion to the same type: `T` - --> tests/ui/useless_conversion_try.rs:9:13 + --> tests/ui/useless_conversion_try.rs:5:13 | LL | let _ = T::try_from(val).unwrap(); | ^^^^^^^^^^^^^^^^ | = help: consider removing `T::try_from()` -note: the lint level is defined here - --> tests/ui/useless_conversion_try.rs:1:9 - | -LL | #![deny(clippy::useless_conversion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::useless-conversion` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]` error: useless conversion to the same type: `T` - --> tests/ui/useless_conversion_try.rs:12:5 + --> tests/ui/useless_conversion_try.rs:8:5 | LL | val.try_into().unwrap() | ^^^^^^^^^^^^^^ @@ -20,7 +17,7 @@ LL | val.try_into().unwrap() = help: consider removing `.try_into()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:35:21 + --> tests/ui/useless_conversion_try.rs:31:21 | LL | let _: String = "foo".to_string().try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,7 +25,7 @@ LL | let _: String = "foo".to_string().try_into().unwrap(); = help: consider removing `.try_into()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:38:21 + --> tests/ui/useless_conversion_try.rs:34:21 | LL | let _: String = TryFrom::try_from("foo".to_string()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -36,7 +33,7 @@ LL | let _: String = TryFrom::try_from("foo".to_string()).unwrap(); = help: consider removing `TryFrom::try_from()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:41:13 + --> tests/ui/useless_conversion_try.rs:37:13 | LL | let _ = String::try_from("foo".to_string()).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +41,7 @@ LL | let _ = String::try_from("foo".to_string()).unwrap(); = help: consider removing `String::try_from()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:44:13 + --> tests/ui/useless_conversion_try.rs:40:13 | LL | let _ = String::try_from(format!("A: {:04}", 123)).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,7 +49,7 @@ LL | let _ = String::try_from(format!("A: {:04}", 123)).unwrap(); = help: consider removing `String::try_from()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:47:21 + --> tests/ui/useless_conversion_try.rs:43:21 | LL | let _: String = format!("Hello {}", "world").try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -60,7 +57,7 @@ LL | let _: String = format!("Hello {}", "world").try_into().unwrap(); = help: consider removing `.try_into()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:50:21 + --> tests/ui/useless_conversion_try.rs:46:21 | LL | let _: String = String::new().try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +65,7 @@ LL | let _: String = String::new().try_into().unwrap(); = help: consider removing `.try_into()` error: useless conversion to the same type: `std::string::String` - --> tests/ui/useless_conversion_try.rs:53:27 + --> tests/ui/useless_conversion_try.rs:49:27 | LL | let _: String = match String::from("_").try_into() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/vec_box_sized.rs b/tests/ui/vec_box_sized.rs index 897add423b6d..5cc140953cec 100644 --- a/tests/ui/vec_box_sized.rs +++ b/tests/ui/vec_box_sized.rs @@ -1,6 +1,6 @@ //@no-rustfix -#![allow(dead_code)] +#![warn(clippy::vec_box)] #![feature(allocator_api)] use std::alloc::{AllocError, Allocator, Layout}; diff --git a/tests/ui/vec_init_then_push.rs b/tests/ui/vec_init_then_push.rs index a32187edfea6..bae0f30a61c9 100644 --- a/tests/ui/vec_init_then_push.rs +++ b/tests/ui/vec_init_then_push.rs @@ -1,4 +1,3 @@ -#![allow(unused_variables)] #![warn(clippy::vec_init_then_push)] //@no-rustfix fn main() { diff --git a/tests/ui/vec_init_then_push.stderr b/tests/ui/vec_init_then_push.stderr index 1900ad7bd6a0..2561439accef 100644 --- a/tests/ui/vec_init_then_push.stderr +++ b/tests/ui/vec_init_then_push.stderr @@ -1,5 +1,5 @@ error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:5:5 + --> tests/ui/vec_init_then_push.rs:4:5 | LL | / let mut def_err: Vec = Default::default(); ... | @@ -10,7 +10,7 @@ LL | | def_err.push(0); = help: to override `-D warnings` add `#[allow(clippy::vec_init_then_push)]` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:10:5 + --> tests/ui/vec_init_then_push.rs:9:5 | LL | / let mut new_err = Vec::::new(); ... | @@ -18,7 +18,7 @@ LL | | new_err.push(1); | |____________________^ help: consider using the `vec![]` macro: `let mut new_err = vec![..];` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:15:5 + --> tests/ui/vec_init_then_push.rs:14:5 | LL | / let mut cap_err = Vec::with_capacity(2); LL | | @@ -29,7 +29,7 @@ LL | | cap_err.push(2); | |____________________^ help: consider using the `vec![]` macro: `let mut cap_err = vec![..];` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:29:5 + --> tests/ui/vec_init_then_push.rs:28:5 | LL | / new_err = Vec::new(); ... | @@ -37,7 +37,7 @@ LL | | new_err.push(0); | |____________________^ help: consider using the `vec![]` macro: `new_err = vec![..];` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:81:5 + --> tests/ui/vec_init_then_push.rs:80:5 | LL | / let mut v = Vec::new(); LL | | @@ -47,7 +47,7 @@ LL | | v.push(1); | |______________^ help: consider using the `vec![]` macro: `let mut v = vec![..];` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:91:5 + --> tests/ui/vec_init_then_push.rs:90:5 | LL | / let mut v = Vec::new(); LL | | @@ -59,7 +59,7 @@ LL | | v.push(0); | |______________^ help: consider using the `vec![]` macro: `let mut v = vec![..];` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:106:5 + --> tests/ui/vec_init_then_push.rs:105:5 | LL | / let mut v2 = Vec::new(); LL | | @@ -71,7 +71,7 @@ LL | | v2.push(0); | |_______________^ help: consider using the `vec![]` macro: `let mut v2 = vec![..];` error: calls to `push` immediately after creation - --> tests/ui/vec_init_then_push.rs:123:5 + --> tests/ui/vec_init_then_push.rs:122:5 | LL | / let mut v = Vec::new(); ... | diff --git a/tests/ui/while_let_loop.rs b/tests/ui/while_let_loop.rs index b5a362669ce2..0100be4ec137 100644 --- a/tests/ui/while_let_loop.rs +++ b/tests/ui/while_let_loop.rs @@ -1,5 +1,5 @@ #![warn(clippy::while_let_loop)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] //@no-rustfix fn main() { let y = Some(true); diff --git a/tests/ui/while_let_on_iterator.fixed b/tests/ui/while_let_on_iterator.fixed index 0d3b446af43f..a06c57250aba 100644 --- a/tests/ui/while_let_on_iterator.fixed +++ b/tests/ui/while_let_on_iterator.fixed @@ -1,12 +1,7 @@ #![warn(clippy::while_let_on_iterator)] -#![allow(dead_code, unreachable_code, unused_mut)] -#![allow( - clippy::equatable_if_let, - clippy::manual_find, - clippy::never_loop, +#![expect( clippy::redundant_closure_call, clippy::single_range_in_vec_init, - clippy::uninlined_format_args, clippy::useless_vec )] diff --git a/tests/ui/while_let_on_iterator.rs b/tests/ui/while_let_on_iterator.rs index e1d9e9081e45..3d3ba3d07f1f 100644 --- a/tests/ui/while_let_on_iterator.rs +++ b/tests/ui/while_let_on_iterator.rs @@ -1,12 +1,7 @@ #![warn(clippy::while_let_on_iterator)] -#![allow(dead_code, unreachable_code, unused_mut)] -#![allow( - clippy::equatable_if_let, - clippy::manual_find, - clippy::never_loop, +#![expect( clippy::redundant_closure_call, clippy::single_range_in_vec_init, - clippy::uninlined_format_args, clippy::useless_vec )] diff --git a/tests/ui/while_let_on_iterator.stderr b/tests/ui/while_let_on_iterator.stderr index cd43d3c17800..5e7e74d7ae8d 100644 --- a/tests/ui/while_let_on_iterator.stderr +++ b/tests/ui/while_let_on_iterator.stderr @@ -1,5 +1,5 @@ error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:15:5 + --> tests/ui/while_let_on_iterator.rs:10:5 | LL | while let Option::Some(x) = iter.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in iter` @@ -8,193 +8,193 @@ LL | while let Option::Some(x) = iter.next() { = help: to override `-D warnings` add `#[allow(clippy::while_let_on_iterator)]` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:21:5 + --> tests/ui/while_let_on_iterator.rs:16:5 | LL | while let Some(x) = iter.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in iter` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:27:5 + --> tests/ui/while_let_on_iterator.rs:22:5 | LL | while let Some(_) = iter.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:104:9 + --> tests/ui/while_let_on_iterator.rs:99:9 | LL | while let Some([..]) = it.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for [..] in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:112:9 + --> tests/ui/while_let_on_iterator.rs:107:9 | LL | while let Some([_x]) = it.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for [_x] in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:126:9 + --> tests/ui/while_let_on_iterator.rs:121:9 | LL | while let Some(x @ [_]) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x @ [_] in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:147:9 + --> tests/ui/while_let_on_iterator.rs:142:9 | LL | while let Some(_) = y.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in y` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:205:9 + --> tests/ui/while_let_on_iterator.rs:200:9 | LL | while let Some(m) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:217:5 + --> tests/ui/while_let_on_iterator.rs:212:5 | LL | while let Some(n) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for n in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:220:9 + --> tests/ui/while_let_on_iterator.rs:215:9 | LL | while let Some(m) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:230:9 + --> tests/ui/while_let_on_iterator.rs:225:9 | LL | while let Some(m) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:240:9 + --> tests/ui/while_let_on_iterator.rs:235:9 | LL | while let Some(m) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:258:9 + --> tests/ui/while_let_on_iterator.rs:253:9 | LL | while let Some(m) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:274:13 + --> tests/ui/while_let_on_iterator.rs:269:13 | LL | while let Some(i) = self.0.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for i in self.0.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:307:13 + --> tests/ui/while_let_on_iterator.rs:302:13 | LL | while let Some(i) = self.0.0.0.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for i in self.0.0.0.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:337:5 + --> tests/ui/while_let_on_iterator.rs:332:5 | LL | while let Some(n) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for n in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:350:9 + --> tests/ui/while_let_on_iterator.rs:345:9 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:365:5 + --> tests/ui/while_let_on_iterator.rs:360:5 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:377:5 + --> tests/ui/while_let_on_iterator.rs:372:5 | LL | while let Some(x) = it.0.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.0.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:413:5 + --> tests/ui/while_let_on_iterator.rs:408:5 | LL | while let Some(x) = s.x.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in s.x.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:421:5 + --> tests/ui/while_let_on_iterator.rs:416:5 | LL | while let Some(x) = x[0].next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in x[0].by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:430:9 + --> tests/ui/while_let_on_iterator.rs:425:9 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:441:9 + --> tests/ui/while_let_on_iterator.rs:436:9 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:452:9 + --> tests/ui/while_let_on_iterator.rs:447:9 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:463:9 + --> tests/ui/while_let_on_iterator.rs:458:9 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:476:9 + --> tests/ui/while_let_on_iterator.rs:471:9 | LL | while let Some(x) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:487:5 + --> tests/ui/while_let_on_iterator.rs:482:5 | LL | 'label: while let Some(n) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'label: for n in it` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:499:13 + --> tests/ui/while_let_on_iterator.rs:494:13 | LL | while let Some(r) = self.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for r in &mut *self` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:515:13 + --> tests/ui/while_let_on_iterator.rs:510:13 | LL | while let Some(r) = self.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for r in self.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:541:9 + --> tests/ui/while_let_on_iterator.rs:536:9 | LL | while let Some(_) = x.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in &mut ***x` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:563:9 + --> tests/ui/while_let_on_iterator.rs:558:9 | LL | while let Some(_) = x.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in &mut **x` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:594:9 + --> tests/ui/while_let_on_iterator.rs:589:9 | LL | while let Some(_) = x.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in x.by_ref()` error: this loop could be written as a `for` loop - --> tests/ui/while_let_on_iterator.rs:601:5 + --> tests/ui/while_let_on_iterator.rs:596:5 | LL | while let Some(..) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in it` diff --git a/tests/ui/wildcard_enum_match_arm.fixed b/tests/ui/wildcard_enum_match_arm.fixed index 5f738a254dcd..e51236e444fc 100644 --- a/tests/ui/wildcard_enum_match_arm.fixed +++ b/tests/ui/wildcard_enum_match_arm.fixed @@ -1,13 +1,6 @@ //@aux-build:non-exhaustive-enum.rs -#![deny(clippy::wildcard_enum_match_arm)] -#![allow(dead_code, unreachable_code, unused_variables)] -#![allow( - clippy::diverging_sub_expression, - clippy::single_match, - clippy::uninlined_format_args, - clippy::unnested_or_patterns, - clippy::wildcard_in_or_patterns -)] +#![warn(clippy::wildcard_enum_match_arm)] +#![expect(clippy::diverging_sub_expression, clippy::single_match)] extern crate non_exhaustive_enum; diff --git a/tests/ui/wildcard_enum_match_arm.rs b/tests/ui/wildcard_enum_match_arm.rs index 4bc4bfdcb794..729fca0ce637 100644 --- a/tests/ui/wildcard_enum_match_arm.rs +++ b/tests/ui/wildcard_enum_match_arm.rs @@ -1,13 +1,6 @@ //@aux-build:non-exhaustive-enum.rs -#![deny(clippy::wildcard_enum_match_arm)] -#![allow(dead_code, unreachable_code, unused_variables)] -#![allow( - clippy::diverging_sub_expression, - clippy::single_match, - clippy::uninlined_format_args, - clippy::unnested_or_patterns, - clippy::wildcard_in_or_patterns -)] +#![warn(clippy::wildcard_enum_match_arm)] +#![expect(clippy::diverging_sub_expression, clippy::single_match)] extern crate non_exhaustive_enum; diff --git a/tests/ui/wildcard_enum_match_arm.stderr b/tests/ui/wildcard_enum_match_arm.stderr index d0929989494a..34d3efc136ee 100644 --- a/tests/ui/wildcard_enum_match_arm.stderr +++ b/tests/ui/wildcard_enum_match_arm.stderr @@ -1,53 +1,50 @@ error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:39:9 + --> tests/ui/wildcard_enum_match_arm.rs:32:9 | LL | _ => eprintln!("Not red"), | ^ help: try: `Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan` | -note: the lint level is defined here - --> tests/ui/wildcard_enum_match_arm.rs:2:9 - | -LL | #![deny(clippy::wildcard_enum_match_arm)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::wildcard-enum-match-arm` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::wildcard_enum_match_arm)]` error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:44:9 + --> tests/ui/wildcard_enum_match_arm.rs:37:9 | LL | _not_red => eprintln!("Not red"), | ^^^^^^^^ help: try: `_not_red @ Color::Green | _not_red @ Color::Blue | _not_red @ Color::Rgb(..) | _not_red @ Color::Cyan` error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:49:9 + --> tests/ui/wildcard_enum_match_arm.rs:42:9 | LL | not_red => format!("{:?}", not_red), | ^^^^^^^ help: try: `not_red @ Color::Green | not_red @ Color::Blue | not_red @ Color::Rgb(..) | not_red @ Color::Cyan` error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:66:9 + --> tests/ui/wildcard_enum_match_arm.rs:59:9 | LL | _ => "No red", | ^ help: try: `Color::Red | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan` error: wildcard matches known variants and will also match future added variants - --> tests/ui/wildcard_enum_match_arm.rs:84:9 + --> tests/ui/wildcard_enum_match_arm.rs:77:9 | LL | _ => {}, | ^ help: try: `ErrorKind::PermissionDenied | _` error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:103:13 + --> tests/ui/wildcard_enum_match_arm.rs:96:13 | LL | _ => (), | ^ help: try: `Enum::B | Enum::C(_) | Enum::D(..) | Enum::E { .. }` error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:118:13 + --> tests/ui/wildcard_enum_match_arm.rs:111:13 | LL | _ => (), | ^ help: try: `Enum::B | Enum::__Private` error: wildcard match will also match any future added variants - --> tests/ui/wildcard_enum_match_arm.rs:133:9 + --> tests/ui/wildcard_enum_match_arm.rs:126:9 | LL | r#type => {}, | ^^^^^^ help: try: `r#type @ Foo::B | r#type @ Foo::C` diff --git a/tests/ui/wildcard_imports.fixed b/tests/ui/wildcard_imports.fixed index 17510683f03e..27d01e6573b8 100644 --- a/tests/ui/wildcard_imports.fixed +++ b/tests/ui/wildcard_imports.fixed @@ -7,8 +7,8 @@ // no longer detects some of the cases starting with Rust 2018. #![warn(clippy::wildcard_imports)] -#![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] -#![warn(unused_imports)] +#![deny(unused_imports)] +#![expect(clippy::let_unit_value)] extern crate wildcard_imports_helper; diff --git a/tests/ui/wildcard_imports.rs b/tests/ui/wildcard_imports.rs index 2168f0a8918d..226f26412cc1 100644 --- a/tests/ui/wildcard_imports.rs +++ b/tests/ui/wildcard_imports.rs @@ -7,8 +7,8 @@ // no longer detects some of the cases starting with Rust 2018. #![warn(clippy::wildcard_imports)] -#![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] -#![warn(unused_imports)] +#![deny(unused_imports)] +#![expect(clippy::let_unit_value)] extern crate wildcard_imports_helper; diff --git a/tests/ui/wildcard_imports_2021.edition2018.fixed b/tests/ui/wildcard_imports_2021.edition2018.fixed index f97b883ea231..46abaa91a1c2 100644 --- a/tests/ui/wildcard_imports_2021.edition2018.fixed +++ b/tests/ui/wildcard_imports_2021.edition2018.fixed @@ -5,8 +5,8 @@ //@aux-build:wildcard_imports_helper.rs #![warn(clippy::wildcard_imports)] -#![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] -#![warn(unused_imports)] +#![deny(unused_imports)] +#![expect(clippy::let_unit_value)] extern crate wildcard_imports_helper; diff --git a/tests/ui/wildcard_imports_2021.edition2021.fixed b/tests/ui/wildcard_imports_2021.edition2021.fixed index f97b883ea231..46abaa91a1c2 100644 --- a/tests/ui/wildcard_imports_2021.edition2021.fixed +++ b/tests/ui/wildcard_imports_2021.edition2021.fixed @@ -5,8 +5,8 @@ //@aux-build:wildcard_imports_helper.rs #![warn(clippy::wildcard_imports)] -#![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] -#![warn(unused_imports)] +#![deny(unused_imports)] +#![expect(clippy::let_unit_value)] extern crate wildcard_imports_helper; diff --git a/tests/ui/wildcard_imports_2021.rs b/tests/ui/wildcard_imports_2021.rs index 8075c15bc14f..3e71d83ef459 100644 --- a/tests/ui/wildcard_imports_2021.rs +++ b/tests/ui/wildcard_imports_2021.rs @@ -5,8 +5,8 @@ //@aux-build:wildcard_imports_helper.rs #![warn(clippy::wildcard_imports)] -#![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] -#![warn(unused_imports)] +#![deny(unused_imports)] +#![expect(clippy::let_unit_value)] extern crate wildcard_imports_helper; diff --git a/tests/ui/wildcard_imports_cfgtest.rs b/tests/ui/wildcard_imports_cfgtest.rs index c41458d5bb0a..5a35c0f74f21 100644 --- a/tests/ui/wildcard_imports_cfgtest.rs +++ b/tests/ui/wildcard_imports_cfgtest.rs @@ -2,7 +2,7 @@ //@compile-flags: --test #![warn(clippy::wildcard_imports)] -#![allow(unused, clippy::unnecessary_wraps, clippy::let_unit_value)] +#![expect(clippy::let_unit_value)] // Test for #10580, the lint should ignore it because of the crate's cfg test flag. diff --git a/tests/ui/write_literal.fixed b/tests/ui/write_literal.fixed index ae29f3a57462..95bbdca4d10c 100644 --- a/tests/ui/write_literal.fixed +++ b/tests/ui/write_literal.fixed @@ -1,5 +1,5 @@ #![warn(clippy::write_literal)] -#![allow(clippy::uninlined_format_args, unused_must_use)] +#![expect(clippy::uninlined_format_args)] use std::io::Write; diff --git a/tests/ui/write_literal.rs b/tests/ui/write_literal.rs index d930339e106c..6b190d9c5c10 100644 --- a/tests/ui/write_literal.rs +++ b/tests/ui/write_literal.rs @@ -1,5 +1,5 @@ #![warn(clippy::write_literal)] -#![allow(clippy::uninlined_format_args, unused_must_use)] +#![expect(clippy::uninlined_format_args)] use std::io::Write; diff --git a/tests/ui/write_literal_unfixable.rs b/tests/ui/write_literal_unfixable.rs index 3a5660180779..80b80d05d9b1 100644 --- a/tests/ui/write_literal_unfixable.rs +++ b/tests/ui/write_literal_unfixable.rs @@ -1,5 +1,4 @@ //@no-rustfix -#![allow(unused_must_use)] #![warn(clippy::write_literal)] use std::io::Write; diff --git a/tests/ui/write_literal_unfixable.stderr b/tests/ui/write_literal_unfixable.stderr index 0dd40e891893..a18b84964a7d 100644 --- a/tests/ui/write_literal_unfixable.stderr +++ b/tests/ui/write_literal_unfixable.stderr @@ -1,5 +1,5 @@ error: literal with an empty format string - --> tests/ui/write_literal_unfixable.rs:10:24 + --> tests/ui/write_literal_unfixable.rs:9:24 | LL | writeln!(v, r"{}", '"'); | ^^^ @@ -8,7 +8,7 @@ LL | writeln!(v, r"{}", '"'); = help: to override `-D warnings` add `#[allow(clippy::write_literal)]` error: literal with an empty format string - --> tests/ui/write_literal_unfixable.rs:14:28 + --> tests/ui/write_literal_unfixable.rs:13:28 | LL | writeln!(v, r#"{}{}"#, '#', '"'); | ^^^^^^^^ diff --git a/tests/ui/write_with_newline.fixed b/tests/ui/write_with_newline.fixed index 40742bbbb427..8d3245a97fd5 100644 --- a/tests/ui/write_with_newline.fixed +++ b/tests/ui/write_with_newline.fixed @@ -1,7 +1,7 @@ // FIXME: Ideally these suggestions would be fixed via rustfix. Blocked by rust-lang/rust#53934 -#![allow(clippy::write_literal)] #![warn(clippy::write_with_newline)] +#![expect(clippy::write_literal)] use std::io::Write; diff --git a/tests/ui/write_with_newline.rs b/tests/ui/write_with_newline.rs index ad6af69e7813..f77d23948959 100644 --- a/tests/ui/write_with_newline.rs +++ b/tests/ui/write_with_newline.rs @@ -1,7 +1,7 @@ // FIXME: Ideally these suggestions would be fixed via rustfix. Blocked by rust-lang/rust#53934 -#![allow(clippy::write_literal)] #![warn(clippy::write_with_newline)] +#![expect(clippy::write_literal)] use std::io::Write; diff --git a/tests/ui/writeln_empty_string.fixed b/tests/ui/writeln_empty_string.fixed index 5cb702b10f2d..e6195846c439 100644 --- a/tests/ui/writeln_empty_string.fixed +++ b/tests/ui/writeln_empty_string.fixed @@ -1,4 +1,3 @@ -#![allow(unused_must_use)] #![warn(clippy::writeln_empty_string)] use std::io::Write; diff --git a/tests/ui/writeln_empty_string.rs b/tests/ui/writeln_empty_string.rs index e6478264a578..c20eef8c813a 100644 --- a/tests/ui/writeln_empty_string.rs +++ b/tests/ui/writeln_empty_string.rs @@ -1,4 +1,3 @@ -#![allow(unused_must_use)] #![warn(clippy::writeln_empty_string)] use std::io::Write; diff --git a/tests/ui/writeln_empty_string.stderr b/tests/ui/writeln_empty_string.stderr index 43e76309ba64..899c82a47e14 100644 --- a/tests/ui/writeln_empty_string.stderr +++ b/tests/ui/writeln_empty_string.stderr @@ -1,5 +1,5 @@ error: empty string literal in `writeln!` - --> tests/ui/writeln_empty_string.rs:9:5 + --> tests/ui/writeln_empty_string.rs:8:5 | LL | writeln!(v, ""); | ^^^^^^^^^^----^ @@ -10,7 +10,7 @@ LL | writeln!(v, ""); = help: to override `-D warnings` add `#[allow(clippy::writeln_empty_string)]` error: empty string literal in `writeln!` - --> tests/ui/writeln_empty_string.rs:13:5 + --> tests/ui/writeln_empty_string.rs:12:5 | LL | writeln!(suggestion, ""); | ^^^^^^^^^^^^^^^^^^^----^ diff --git a/tests/ui/writeln_empty_string_unfixable.rs b/tests/ui/writeln_empty_string_unfixable.rs index ca570fd1fc7b..f4b16bfed0a2 100644 --- a/tests/ui/writeln_empty_string_unfixable.rs +++ b/tests/ui/writeln_empty_string_unfixable.rs @@ -1,4 +1,3 @@ -#![allow(unused_must_use)] #![warn(clippy::writeln_empty_string)] use std::io::Write; diff --git a/tests/ui/writeln_empty_string_unfixable.stderr b/tests/ui/writeln_empty_string_unfixable.stderr index 0ed802ba84ba..d2aa50f05727 100644 --- a/tests/ui/writeln_empty_string_unfixable.stderr +++ b/tests/ui/writeln_empty_string_unfixable.stderr @@ -1,11 +1,11 @@ error: empty string literal in `writeln!` - --> tests/ui/writeln_empty_string_unfixable.rs:11:5 + --> tests/ui/writeln_empty_string_unfixable.rs:10:5 | LL | writeln!(v, /* comment */ ""); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: remove the empty string - --> tests/ui/writeln_empty_string_unfixable.rs:11:31 + --> tests/ui/writeln_empty_string_unfixable.rs:10:31 | LL | writeln!(v, /* comment */ ""); | ^^ @@ -13,19 +13,19 @@ LL | writeln!(v, /* comment */ ""); = help: to override `-D warnings` add `#[allow(clippy::writeln_empty_string)]` error: empty string literal in `writeln!` - --> tests/ui/writeln_empty_string_unfixable.rs:14:5 + --> tests/ui/writeln_empty_string_unfixable.rs:13:5 | LL | writeln!(v, "" /* comment */); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: remove the empty string - --> tests/ui/writeln_empty_string_unfixable.rs:14:17 + --> tests/ui/writeln_empty_string_unfixable.rs:13:17 | LL | writeln!(v, "" /* comment */); | ^^ error: empty string literal in `writeln!` - --> tests/ui/writeln_empty_string_unfixable.rs:18:5 + --> tests/ui/writeln_empty_string_unfixable.rs:17:5 | LL | / writeln!(v, LL | | "\ @@ -36,7 +36,7 @@ LL | | ); | |_____^ | note: remove the empty string - --> tests/ui/writeln_empty_string_unfixable.rs:19:9 + --> tests/ui/writeln_empty_string_unfixable.rs:18:9 | LL | / "\ LL | | \ diff --git a/tests/ui/wrong_self_convention.rs b/tests/ui/wrong_self_convention.rs index 840dfe7c6524..802cc38af4f3 100644 --- a/tests/ui/wrong_self_convention.rs +++ b/tests/ui/wrong_self_convention.rs @@ -1,5 +1,4 @@ #![warn(clippy::wrong_self_convention)] -#![allow(dead_code)] fn main() {} diff --git a/tests/ui/wrong_self_convention.stderr b/tests/ui/wrong_self_convention.stderr index e720ddf3fae1..2f2ab956c639 100644 --- a/tests/ui/wrong_self_convention.stderr +++ b/tests/ui/wrong_self_convention.stderr @@ -1,5 +1,5 @@ error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:16:17 + --> tests/ui/wrong_self_convention.rs:15:17 | LL | fn from_i32(self) {} | ^^^^ @@ -9,7 +9,7 @@ LL | fn from_i32(self) {} = help: to override `-D warnings` add `#[allow(clippy::wrong_self_convention)]` error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:23:21 + --> tests/ui/wrong_self_convention.rs:22:21 | LL | pub fn from_i64(self) {} | ^^^^ @@ -17,7 +17,7 @@ LL | pub fn from_i64(self) {} = help: consider choosing a less ambiguous name error: methods called `as_*` usually take `self` by reference or `self` by mutable reference - --> tests/ui/wrong_self_convention.rs:37:15 + --> tests/ui/wrong_self_convention.rs:36:15 | LL | fn as_i32(self) {} | ^^^^ @@ -25,7 +25,7 @@ LL | fn as_i32(self) {} = help: consider choosing a less ambiguous name error: methods called `into_*` usually take `self` by value - --> tests/ui/wrong_self_convention.rs:41:17 + --> tests/ui/wrong_self_convention.rs:40:17 | LL | fn into_i32(&self) {} | ^^^^^ @@ -33,7 +33,7 @@ LL | fn into_i32(&self) {} = help: consider choosing a less ambiguous name error: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self` - --> tests/ui/wrong_self_convention.rs:45:15 + --> tests/ui/wrong_self_convention.rs:44:15 | LL | fn is_i32(self) {} | ^^^^ @@ -41,7 +41,7 @@ LL | fn is_i32(self) {} = help: consider choosing a less ambiguous name error: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference - --> tests/ui/wrong_self_convention.rs:49:15 + --> tests/ui/wrong_self_convention.rs:48:15 | LL | fn to_i32(self) {} | ^^^^ @@ -49,7 +49,7 @@ LL | fn to_i32(self) {} = help: consider choosing a less ambiguous name error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:53:17 + --> tests/ui/wrong_self_convention.rs:52:17 | LL | fn from_i32(self) {} | ^^^^ @@ -57,7 +57,7 @@ LL | fn from_i32(self) {} = help: consider choosing a less ambiguous name error: methods called `as_*` usually take `self` by reference or `self` by mutable reference - --> tests/ui/wrong_self_convention.rs:56:19 + --> tests/ui/wrong_self_convention.rs:55:19 | LL | pub fn as_i64(self) {} | ^^^^ @@ -65,7 +65,7 @@ LL | pub fn as_i64(self) {} = help: consider choosing a less ambiguous name error: methods called `into_*` usually take `self` by value - --> tests/ui/wrong_self_convention.rs:59:21 + --> tests/ui/wrong_self_convention.rs:58:21 | LL | pub fn into_i64(&self) {} | ^^^^^ @@ -73,7 +73,7 @@ LL | pub fn into_i64(&self) {} = help: consider choosing a less ambiguous name error: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self` - --> tests/ui/wrong_self_convention.rs:62:19 + --> tests/ui/wrong_self_convention.rs:61:19 | LL | pub fn is_i64(self) {} | ^^^^ @@ -81,7 +81,7 @@ LL | pub fn is_i64(self) {} = help: consider choosing a less ambiguous name error: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference - --> tests/ui/wrong_self_convention.rs:65:19 + --> tests/ui/wrong_self_convention.rs:64:19 | LL | pub fn to_i64(self) {} | ^^^^ @@ -89,7 +89,7 @@ LL | pub fn to_i64(self) {} = help: consider choosing a less ambiguous name error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:68:21 + --> tests/ui/wrong_self_convention.rs:67:21 | LL | pub fn from_i64(self) {} | ^^^^ @@ -97,7 +97,7 @@ LL | pub fn from_i64(self) {} = help: consider choosing a less ambiguous name error: methods called `as_*` usually take `self` by reference or `self` by mutable reference - --> tests/ui/wrong_self_convention.rs:114:19 + --> tests/ui/wrong_self_convention.rs:113:19 | LL | fn as_i32(self) {} | ^^^^ @@ -105,7 +105,7 @@ LL | fn as_i32(self) {} = help: consider choosing a less ambiguous name error: methods called `into_*` usually take `self` by value - --> tests/ui/wrong_self_convention.rs:119:25 + --> tests/ui/wrong_self_convention.rs:118:25 | LL | fn into_i32_ref(&self) {} | ^^^^^ @@ -113,7 +113,7 @@ LL | fn into_i32_ref(&self) {} = help: consider choosing a less ambiguous name error: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self` - --> tests/ui/wrong_self_convention.rs:123:19 + --> tests/ui/wrong_self_convention.rs:122:19 | LL | fn is_i32(self) {} | ^^^^ @@ -121,7 +121,7 @@ LL | fn is_i32(self) {} = help: consider choosing a less ambiguous name error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:129:21 + --> tests/ui/wrong_self_convention.rs:128:21 | LL | fn from_i32(self) {} | ^^^^ @@ -129,7 +129,7 @@ LL | fn from_i32(self) {} = help: consider choosing a less ambiguous name error: methods called `as_*` usually take `self` by reference or `self` by mutable reference - --> tests/ui/wrong_self_convention.rs:146:19 + --> tests/ui/wrong_self_convention.rs:145:19 | LL | fn as_i32(self); | ^^^^ @@ -137,7 +137,7 @@ LL | fn as_i32(self); = help: consider choosing a less ambiguous name error: methods called `into_*` usually take `self` by value - --> tests/ui/wrong_self_convention.rs:151:25 + --> tests/ui/wrong_self_convention.rs:150:25 | LL | fn into_i32_ref(&self); | ^^^^^ @@ -145,7 +145,7 @@ LL | fn into_i32_ref(&self); = help: consider choosing a less ambiguous name error: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self` - --> tests/ui/wrong_self_convention.rs:155:19 + --> tests/ui/wrong_self_convention.rs:154:19 | LL | fn is_i32(self); | ^^^^ @@ -153,7 +153,7 @@ LL | fn is_i32(self); = help: consider choosing a less ambiguous name error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:161:21 + --> tests/ui/wrong_self_convention.rs:160:21 | LL | fn from_i32(self); | ^^^^ @@ -161,7 +161,7 @@ LL | fn from_i32(self); = help: consider choosing a less ambiguous name error: methods called `into_*` usually take `self` by value - --> tests/ui/wrong_self_convention.rs:181:25 + --> tests/ui/wrong_self_convention.rs:180:25 | LL | fn into_i32_ref(&self); | ^^^^^ @@ -169,7 +169,7 @@ LL | fn into_i32_ref(&self); = help: consider choosing a less ambiguous name error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention.rs:189:21 + --> tests/ui/wrong_self_convention.rs:188:21 | LL | fn from_i32(self); | ^^^^ @@ -177,7 +177,7 @@ LL | fn from_i32(self); = help: consider choosing a less ambiguous name error: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value - --> tests/ui/wrong_self_convention.rs:215:22 + --> tests/ui/wrong_self_convention.rs:214:22 | LL | fn to_u64_v2(&self) -> u64 { | ^^^^^ @@ -185,7 +185,7 @@ LL | fn to_u64_v2(&self) -> u64 { = help: consider choosing a less ambiguous name error: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference - --> tests/ui/wrong_self_convention.rs:226:19 + --> tests/ui/wrong_self_convention.rs:225:19 | LL | fn to_u64(self) -> u64 { | ^^^^ diff --git a/tests/ui/wrong_self_convention2.rs b/tests/ui/wrong_self_convention2.rs index 0a3e4982a49a..1f40a0229d30 100644 --- a/tests/ui/wrong_self_convention2.rs +++ b/tests/ui/wrong_self_convention2.rs @@ -1,5 +1,4 @@ #![warn(clippy::wrong_self_convention)] -#![allow(dead_code)] fn main() {} diff --git a/tests/ui/wrong_self_convention2.stderr b/tests/ui/wrong_self_convention2.stderr index 2eafb95d9bbe..31ed291c7d65 100644 --- a/tests/ui/wrong_self_convention2.stderr +++ b/tests/ui/wrong_self_convention2.stderr @@ -1,5 +1,5 @@ error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention2.rs:54:29 + --> tests/ui/wrong_self_convention2.rs:53:29 | LL | pub fn from_be_self(self) -> Self { | ^^^^ @@ -9,7 +9,7 @@ LL | pub fn from_be_self(self) -> Self { = help: to override `-D warnings` add `#[allow(clippy::wrong_self_convention)]` error: methods called `from_*` usually take no `self` - --> tests/ui/wrong_self_convention2.rs:65:25 + --> tests/ui/wrong_self_convention2.rs:64:25 | LL | fn from_be_self(self) -> Self; | ^^^^ diff --git a/tests/ui/wrong_self_conventions_mut.rs b/tests/ui/wrong_self_conventions_mut.rs index eb6f08fff424..ab25d760183b 100644 --- a/tests/ui/wrong_self_conventions_mut.rs +++ b/tests/ui/wrong_self_conventions_mut.rs @@ -1,5 +1,4 @@ #![warn(clippy::wrong_self_convention)] -#![allow(dead_code)] fn main() {} diff --git a/tests/ui/wrong_self_conventions_mut.stderr b/tests/ui/wrong_self_conventions_mut.stderr index 5ea2e8192efe..f82ce70e6390 100644 --- a/tests/ui/wrong_self_conventions_mut.stderr +++ b/tests/ui/wrong_self_conventions_mut.stderr @@ -1,5 +1,5 @@ error: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference - --> tests/ui/wrong_self_conventions_mut.rs:14:24 + --> tests/ui/wrong_self_conventions_mut.rs:13:24 | LL | pub fn to_many(&mut self) -> Option<&mut [T]> { | ^^^^^^^^^ @@ -9,7 +9,7 @@ LL | pub fn to_many(&mut self) -> Option<&mut [T]> { = help: to override `-D warnings` add `#[allow(clippy::wrong_self_convention)]` error: methods with the following characteristics: (`to_*` and `*_mut`) usually take `self` by mutable reference - --> tests/ui/wrong_self_conventions_mut.rs:24:28 + --> tests/ui/wrong_self_conventions_mut.rs:23:28 | LL | pub fn to_many_mut(&self) -> Option<&[T]> { | ^^^^^ diff --git a/tests/ui/zero_repeat_side_effects.fixed b/tests/ui/zero_repeat_side_effects.fixed index 4bdff6fd0f6c..ec6929751e5d 100644 --- a/tests/ui/zero_repeat_side_effects.fixed +++ b/tests/ui/zero_repeat_side_effects.fixed @@ -1,10 +1,12 @@ #![warn(clippy::zero_repeat_side_effects)] -#![allow( - clippy::unnecessary_operation, - clippy::useless_vec, +#![expect( clippy::needless_late_init, clippy::single_match, - clippy::no_effect // only fires _after_ the fix + clippy::unnecessary_operation, + clippy::useless_vec +)] +#![allow( + clippy::no_effect // only fires _after_ the fix, )] fn f() -> i32 { diff --git a/tests/ui/zero_repeat_side_effects.rs b/tests/ui/zero_repeat_side_effects.rs index a1454d724c87..5643feb2889a 100644 --- a/tests/ui/zero_repeat_side_effects.rs +++ b/tests/ui/zero_repeat_side_effects.rs @@ -1,10 +1,12 @@ #![warn(clippy::zero_repeat_side_effects)] -#![allow( - clippy::unnecessary_operation, - clippy::useless_vec, +#![expect( clippy::needless_late_init, clippy::single_match, - clippy::no_effect // only fires _after_ the fix + clippy::unnecessary_operation, + clippy::useless_vec +)] +#![allow( + clippy::no_effect // only fires _after_ the fix, )] fn f() -> i32 { diff --git a/tests/ui/zero_repeat_side_effects.stderr b/tests/ui/zero_repeat_side_effects.stderr index f376a1501b00..5560f4855c75 100644 --- a/tests/ui/zero_repeat_side_effects.stderr +++ b/tests/ui/zero_repeat_side_effects.stderr @@ -1,5 +1,5 @@ error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:22:5 + --> tests/ui/zero_repeat_side_effects.rs:24:5 | LL | let a = [f(); 0]; | ^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let a: [i32; 0] = []; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:25:5 + --> tests/ui/zero_repeat_side_effects.rs:27:5 | LL | b = [f(); 0]; | ^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL ~ b = [] as [i32; 0]; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:30:5 + --> tests/ui/zero_repeat_side_effects.rs:32:5 | LL | let c = vec![f(); 0]; | ^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + let c: std::vec::Vec = vec![]; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:33:5 + --> tests/ui/zero_repeat_side_effects.rs:35:5 | LL | d = vec![f(); 0]; | ^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL ~ d = vec![] as std::vec::Vec; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:37:5 + --> tests/ui/zero_repeat_side_effects.rs:39:5 | LL | let e = [println!("side effect"); 0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + let e: [(); 0] = []; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:41:5 + --> tests/ui/zero_repeat_side_effects.rs:43:5 | LL | let g = [{ f() }; 0]; | ^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + let g: [i32; 0] = []; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:45:10 + --> tests/ui/zero_repeat_side_effects.rs:47:10 | LL | drop(vec![f(); 0]); | ^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL ~ }); | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:49:5 + --> tests/ui/zero_repeat_side_effects.rs:51:5 | LL | vec![f(); 0]; | ^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL ~ vec![] as std::vec::Vec; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:51:5 + --> tests/ui/zero_repeat_side_effects.rs:53:5 | LL | [f(); 0]; | ^^^^^^^^ @@ -111,7 +111,7 @@ LL ~ [] as [i32; 0]; | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:105:10 + --> tests/ui/zero_repeat_side_effects.rs:107:10 | LL | foo(&[Some(f()); 0]); | ^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL ~ }); | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:107:10 + --> tests/ui/zero_repeat_side_effects.rs:109:10 | LL | foo(&[Some(Some(S::new())); 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL ~ }); | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:115:14 + --> tests/ui/zero_repeat_side_effects.rs:117:14 | LL | 0 => _ = [f(); 0], | ^^^^^^^^^^^^ @@ -153,7 +153,7 @@ LL ~ }, | error: expression with side effects as the initial value in a zero-sized array initializer - --> tests/ui/zero_repeat_side_effects.rs:122:14 + --> tests/ui/zero_repeat_side_effects.rs:124:14 | LL | 0 => a = [f(); 0], | ^^^^^^^^^^^^ diff --git a/tests/ui/zombie_processes.rs b/tests/ui/zombie_processes.rs index e81b5fd4f3e2..39acc7d92da5 100644 --- a/tests/ui/zombie_processes.rs +++ b/tests/ui/zombie_processes.rs @@ -1,5 +1,5 @@ #![warn(clippy::zombie_processes)] -#![allow(clippy::if_same_then_else, clippy::ifs_same_cond, clippy::needless_return)] +#![expect(clippy::if_same_then_else, clippy::ifs_same_cond, clippy::needless_return)] use std::process::{Child, Command, ExitStatus}; diff --git a/tests/ui/zombie_processes_fixable.fixed b/tests/ui/zombie_processes_fixable.fixed index 220abbfcfd7b..69638b0a706d 100644 --- a/tests/ui/zombie_processes_fixable.fixed +++ b/tests/ui/zombie_processes_fixable.fixed @@ -1,5 +1,5 @@ #![warn(clippy::zombie_processes)] -#![allow(clippy::needless_return)] +#![expect(clippy::needless_return)] use std::process::{Child, Command}; diff --git a/tests/ui/zombie_processes_fixable.rs b/tests/ui/zombie_processes_fixable.rs index 820a839cd461..bae768006411 100644 --- a/tests/ui/zombie_processes_fixable.rs +++ b/tests/ui/zombie_processes_fixable.rs @@ -1,5 +1,5 @@ #![warn(clippy::zombie_processes)] -#![allow(clippy::needless_return)] +#![expect(clippy::needless_return)] use std::process::{Child, Command}; diff --git a/tests/ui/{literal_string_with_formatting_args}.rs b/tests/ui/{literal_string_with_formatting_args}.rs index 3096558a516a..af69d9ebf2e8 100644 --- a/tests/ui/{literal_string_with_formatting_args}.rs +++ b/tests/ui/{literal_string_with_formatting_args}.rs @@ -37,7 +37,6 @@ // ``` #![crate_name = "foo"] -#![allow(unused)] #![warn(clippy::literal_string_with_formatting_args)] fn another_bad() { From b30ee469f6331eebdf4a6d7e10bfcc215f0811b9 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 06/11] Attributes cleanup in tests [17/20] --- tests/ui/single_char_pattern.fixed | 1 - tests/ui/single_char_pattern.rs | 1 - tests/ui/single_char_pattern.stderr | 70 +++++++++---------- tests/ui/single_component_path_imports.fixed | 3 - tests/ui/single_component_path_imports.rs | 3 - tests/ui/single_component_path_imports.stderr | 4 +- .../ui/single_component_path_imports_macro.rs | 1 - ...gle_component_path_imports_nested_first.rs | 2 - ...component_path_imports_nested_first.stderr | 6 +- ...ingle_component_path_imports_self_after.rs | 1 - ...ngle_component_path_imports_self_before.rs | 1 - tests/ui/single_match.fixed | 9 +-- tests/ui/single_match.rs | 9 +-- tests/ui/single_match.stderr | 62 ++++++++-------- tests/ui/single_match_else.fixed | 2 +- tests/ui/single_match_else.rs | 2 +- .../ui/single_match_else_deref_patterns.fixed | 12 +--- tests/ui/single_match_else_deref_patterns.rs | 12 +--- .../single_match_else_deref_patterns.stderr | 31 ++++---- tests/ui/single_range_in_vec_init.1.fixed | 2 +- tests/ui/single_range_in_vec_init.2.fixed | 2 +- tests/ui/single_range_in_vec_init.rs | 2 +- .../size_of_in_element_count/expressions.rs | 1 - .../expressions.stderr | 8 +-- .../ui/size_of_in_element_count/functions.rs | 2 +- tests/ui/size_of_ref.rs | 1 - tests/ui/size_of_ref.stderr | 6 +- tests/ui/skip_while_next.rs | 2 +- tests/ui/sliced_string_as_bytes.fixed | 1 - tests/ui/sliced_string_as_bytes.rs | 1 - tests/ui/sliced_string_as_bytes.stderr | 6 +- tests/ui/slow_vector_initialization.fixed | 4 +- tests/ui/slow_vector_initialization.rs | 4 +- tests/ui/slow_vector_initialization.stderr | 26 +++---- tests/ui/some_filter.fixed | 2 +- tests/ui/some_filter.rs | 2 +- tests/ui/stable_sort_primitive.fixed | 2 +- tests/ui/stable_sort_primitive.rs | 2 +- tests/ui/starts_ends_with.fixed | 3 +- tests/ui/starts_ends_with.rs | 3 +- tests/ui/starts_ends_with.stderr | 32 ++++----- tests/ui/std_instead_of_core.fixed | 3 +- tests/ui/std_instead_of_core.rs | 3 +- tests/ui/std_instead_of_core.stderr | 4 +- tests/ui/std_instead_of_core_unfixable.rs | 4 +- tests/ui/std_instead_of_core_unfixable.stderr | 6 +- tests/ui/string_lit_as_bytes.fixed | 2 +- tests/ui/string_lit_as_bytes.rs | 2 +- tests/ui/string_lit_chars_any.fixed | 2 +- tests/ui/string_lit_chars_any.rs | 2 +- tests/ui/string_slice.rs | 2 +- tests/ui/strlen_on_c_strings.fixed | 2 +- tests/ui/strlen_on_c_strings.rs | 2 +- tests/ui/struct_fields.rs | 1 - tests/ui/struct_fields.stderr | 52 +++++++------- tests/ui/suspicious_arithmetic_impl.rs | 2 +- tests/ui/suspicious_command_arg_space.fixed | 3 +- tests/ui/suspicious_command_arg_space.rs | 3 +- tests/ui/suspicious_command_arg_space.stderr | 4 +- tests/ui/suspicious_doc_comments.fixed | 1 - tests/ui/suspicious_doc_comments.rs | 1 - tests/ui/suspicious_doc_comments.stderr | 18 ++--- tests/ui/suspicious_doc_comments_unfixable.rs | 2 +- tests/ui/suspicious_else_formatting.rs | 8 +-- tests/ui/suspicious_map.rs | 2 +- tests/ui/suspicious_operation_groupings.fixed | 2 +- tests/ui/suspicious_operation_groupings.rs | 2 +- tests/ui/suspicious_splitn.rs | 1 - tests/ui/suspicious_splitn.stderr | 18 ++--- tests/ui/suspicious_to_owned.1.fixed | 5 +- tests/ui/suspicious_to_owned.2.fixed | 5 +- tests/ui/suspicious_to_owned.rs | 5 +- tests/ui/suspicious_to_owned.stderr | 12 ++-- tests/ui/suspicious_unary_op_formatting.rs | 2 +- tests/ui/suspicious_xor_used_as_pow.rs | 3 +- tests/ui/suspicious_xor_used_as_pow.stderr | 14 ++-- tests/ui/swap.fixed | 9 ++- tests/ui/swap.rs | 9 ++- tests/ui/swap.stderr | 39 ++++++----- 79 files changed, 274 insertions(+), 329 deletions(-) diff --git a/tests/ui/single_char_pattern.fixed b/tests/ui/single_char_pattern.fixed index 9bf9d6630441..2b1f403b1f2c 100644 --- a/tests/ui/single_char_pattern.fixed +++ b/tests/ui/single_char_pattern.fixed @@ -1,4 +1,3 @@ -#![allow(clippy::needless_raw_strings, clippy::needless_raw_string_hashes, unused_must_use)] #![warn(clippy::single_char_pattern)] use std::collections::HashSet; diff --git a/tests/ui/single_char_pattern.rs b/tests/ui/single_char_pattern.rs index 0560a848fe9d..a933e73edc10 100644 --- a/tests/ui/single_char_pattern.rs +++ b/tests/ui/single_char_pattern.rs @@ -1,4 +1,3 @@ -#![allow(clippy::needless_raw_strings, clippy::needless_raw_string_hashes, unused_must_use)] #![warn(clippy::single_char_pattern)] use std::collections::HashSet; diff --git a/tests/ui/single_char_pattern.stderr b/tests/ui/single_char_pattern.stderr index aa4ba28884a8..bf8bac0b00be 100644 --- a/tests/ui/single_char_pattern.stderr +++ b/tests/ui/single_char_pattern.stderr @@ -1,5 +1,5 @@ error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:7:13 + --> tests/ui/single_char_pattern.rs:6:13 | LL | x.split("x"); | ^^^ help: consider using a `char`: `'x'` @@ -8,205 +8,205 @@ LL | x.split("x"); = help: to override `-D warnings` add `#[allow(clippy::single_char_pattern)]` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:19:23 + --> tests/ui/single_char_pattern.rs:18:23 | LL | x.split_inclusive("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:21:16 + --> tests/ui/single_char_pattern.rs:20:16 | LL | x.contains("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:23:19 + --> tests/ui/single_char_pattern.rs:22:19 | LL | x.starts_with("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:25:17 + --> tests/ui/single_char_pattern.rs:24:17 | LL | x.ends_with("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:27:12 + --> tests/ui/single_char_pattern.rs:26:12 | LL | x.find("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:29:13 + --> tests/ui/single_char_pattern.rs:28:13 | LL | x.rfind("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:31:14 + --> tests/ui/single_char_pattern.rs:30:14 | LL | x.rsplit("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:33:24 + --> tests/ui/single_char_pattern.rs:32:24 | LL | x.split_terminator("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:35:25 + --> tests/ui/single_char_pattern.rs:34:25 | LL | x.rsplit_terminator("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:37:17 + --> tests/ui/single_char_pattern.rs:36:17 | LL | x.splitn(2, "x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:39:18 + --> tests/ui/single_char_pattern.rs:38:18 | LL | x.rsplitn(2, "x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:41:18 + --> tests/ui/single_char_pattern.rs:40:18 | LL | x.split_once("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:43:19 + --> tests/ui/single_char_pattern.rs:42:19 | LL | x.rsplit_once("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:45:15 + --> tests/ui/single_char_pattern.rs:44:15 | LL | x.matches("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:47:16 + --> tests/ui/single_char_pattern.rs:46:16 | LL | x.rmatches("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:49:21 + --> tests/ui/single_char_pattern.rs:48:21 | LL | x.match_indices("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:51:22 + --> tests/ui/single_char_pattern.rs:50:22 | LL | x.rmatch_indices("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:53:26 + --> tests/ui/single_char_pattern.rs:52:26 | LL | x.trim_start_matches("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:55:24 + --> tests/ui/single_char_pattern.rs:54:24 | LL | x.trim_end_matches("x"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:57:15 + --> tests/ui/single_char_pattern.rs:56:15 | LL | x.replace("x", "y"); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:59:16 + --> tests/ui/single_char_pattern.rs:58:16 | LL | x.replacen("x", "y", 3); | ^^^ help: consider using a `char`: `'x'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:62:13 + --> tests/ui/single_char_pattern.rs:61:13 | LL | x.split("\n"); | ^^^^ help: consider using a `char`: `'\n'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:64:13 + --> tests/ui/single_char_pattern.rs:63:13 | LL | x.split("'"); | ^^^ help: consider using a `char`: `'\''` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:66:13 + --> tests/ui/single_char_pattern.rs:65:13 | LL | x.split("\'"); | ^^^^ help: consider using a `char`: `'\''` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:69:13 + --> tests/ui/single_char_pattern.rs:68:13 | LL | x.split("\""); | ^^^^ help: consider using a `char`: `'"'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:75:31 + --> tests/ui/single_char_pattern.rs:74:31 | LL | x.replace(';', ",").split(","); // issue #2978 | ^^^ help: consider using a `char`: `','` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:78:19 + --> tests/ui/single_char_pattern.rs:77:19 | LL | x.starts_with("\x03"); // issue #2996 | ^^^^^^ help: consider using a `char`: `'\x03'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:87:13 + --> tests/ui/single_char_pattern.rs:86:13 | LL | x.split(r"a"); | ^^^^ help: consider using a `char`: `'a'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:89:13 + --> tests/ui/single_char_pattern.rs:88:13 | LL | x.split(r#"a"#); | ^^^^^^ help: consider using a `char`: `'a'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:91:13 + --> tests/ui/single_char_pattern.rs:90:13 | LL | x.split(r###"a"###); | ^^^^^^^^^^ help: consider using a `char`: `'a'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:93:13 + --> tests/ui/single_char_pattern.rs:92:13 | LL | x.split(r###"'"###); | ^^^^^^^^^^ help: consider using a `char`: `'\''` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:95:13 + --> tests/ui/single_char_pattern.rs:94:13 | LL | x.split(r###"#"###); | ^^^^^^^^^^ help: consider using a `char`: `'#'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:98:13 + --> tests/ui/single_char_pattern.rs:97:13 | LL | x.split(r#"\"#); | ^^^^^^ help: consider using a `char`: `'\\'` error: single-character string constant used as pattern - --> tests/ui/single_char_pattern.rs:100:13 + --> tests/ui/single_char_pattern.rs:99:13 | LL | x.split(r"\"); | ^^^^ help: consider using a `char`: `'\\'` diff --git a/tests/ui/single_component_path_imports.fixed b/tests/ui/single_component_path_imports.fixed index 180a55813b19..02a3d575e5b9 100644 --- a/tests/ui/single_component_path_imports.fixed +++ b/tests/ui/single_component_path_imports.fixed @@ -1,5 +1,4 @@ #![warn(clippy::single_component_path_imports)] -#![allow(unused_imports)] use core; @@ -31,13 +30,11 @@ fn main() { mod hello_mod { //~^ single_component_path_imports - #[allow(dead_code)] fn hello_mod() {} } mod hi_mod { use self::regex::{Regex, RegexSet}; use regex; - #[allow(dead_code)] fn hi_mod() {} } diff --git a/tests/ui/single_component_path_imports.rs b/tests/ui/single_component_path_imports.rs index 888c533c534c..efd425abc4bf 100644 --- a/tests/ui/single_component_path_imports.rs +++ b/tests/ui/single_component_path_imports.rs @@ -1,5 +1,4 @@ #![warn(clippy::single_component_path_imports)] -#![allow(unused_imports)] use core; @@ -32,13 +31,11 @@ fn main() { mod hello_mod { use regex; //~^ single_component_path_imports - #[allow(dead_code)] fn hello_mod() {} } mod hi_mod { use self::regex::{Regex, RegexSet}; use regex; - #[allow(dead_code)] fn hi_mod() {} } diff --git a/tests/ui/single_component_path_imports.stderr b/tests/ui/single_component_path_imports.stderr index f1c56b14358f..d0c950c96660 100644 --- a/tests/ui/single_component_path_imports.stderr +++ b/tests/ui/single_component_path_imports.stderr @@ -1,5 +1,5 @@ error: this import is redundant - --> tests/ui/single_component_path_imports.rs:6:1 + --> tests/ui/single_component_path_imports.rs:5:1 | LL | use regex; | ^^^^^^^^^^ help: remove it entirely @@ -8,7 +8,7 @@ LL | use regex; = help: to override `-D warnings` add `#[allow(clippy::single_component_path_imports)]` error: this import is redundant - --> tests/ui/single_component_path_imports.rs:33:5 + --> tests/ui/single_component_path_imports.rs:32:5 | LL | use regex; | ^^^^^^^^^^ help: remove it entirely diff --git a/tests/ui/single_component_path_imports_macro.rs b/tests/ui/single_component_path_imports_macro.rs index f655ea482d1c..991fcfbe8a3d 100644 --- a/tests/ui/single_component_path_imports_macro.rs +++ b/tests/ui/single_component_path_imports_macro.rs @@ -1,7 +1,6 @@ //@ check-pass #![warn(clippy::single_component_path_imports)] -#![allow(unused_imports)] // #7106: use statements exporting a macro within a crate should not trigger lint // #7923: normal `use` statements of macros should also not trigger the lint diff --git a/tests/ui/single_component_path_imports_nested_first.rs b/tests/ui/single_component_path_imports_nested_first.rs index 77213bc482c3..32043bacc240 100644 --- a/tests/ui/single_component_path_imports_nested_first.rs +++ b/tests/ui/single_component_path_imports_nested_first.rs @@ -1,5 +1,4 @@ #![warn(clippy::single_component_path_imports)] -#![allow(unused_imports)] //@no-rustfix use regex; //~^ single_component_path_imports @@ -18,6 +17,5 @@ mod root_nested_use_mod { //~^ single_component_path_imports //~| single_component_path_imports - #[allow(dead_code)] fn root_nested_use_mod() {} } diff --git a/tests/ui/single_component_path_imports_nested_first.stderr b/tests/ui/single_component_path_imports_nested_first.stderr index 8eec877860e7..59663f5a1e71 100644 --- a/tests/ui/single_component_path_imports_nested_first.stderr +++ b/tests/ui/single_component_path_imports_nested_first.stderr @@ -1,5 +1,5 @@ error: this import is redundant - --> tests/ui/single_component_path_imports_nested_first.rs:4:1 + --> tests/ui/single_component_path_imports_nested_first.rs:3:1 | LL | use regex; | ^^^^^^^^^^ help: remove it entirely @@ -8,7 +8,7 @@ LL | use regex; = help: to override `-D warnings` add `#[allow(clippy::single_component_path_imports)]` error: this import is redundant - --> tests/ui/single_component_path_imports_nested_first.rs:17:10 + --> tests/ui/single_component_path_imports_nested_first.rs:16:10 | LL | use {regex, serde}; | ^^^^^ @@ -16,7 +16,7 @@ LL | use {regex, serde}; = help: remove this import error: this import is redundant - --> tests/ui/single_component_path_imports_nested_first.rs:17:17 + --> tests/ui/single_component_path_imports_nested_first.rs:16:17 | LL | use {regex, serde}; | ^^^^^ diff --git a/tests/ui/single_component_path_imports_self_after.rs b/tests/ui/single_component_path_imports_self_after.rs index a0f2cf690809..f9e85555a262 100644 --- a/tests/ui/single_component_path_imports_self_after.rs +++ b/tests/ui/single_component_path_imports_self_after.rs @@ -1,7 +1,6 @@ //@ check-pass #![warn(clippy::single_component_path_imports)] -#![allow(unused_imports)] use self::regex::{Regex as xeger, RegexSet as tesxeger}; #[rustfmt::skip] diff --git a/tests/ui/single_component_path_imports_self_before.rs b/tests/ui/single_component_path_imports_self_before.rs index b80580da10c3..753fc67cdb29 100644 --- a/tests/ui/single_component_path_imports_self_before.rs +++ b/tests/ui/single_component_path_imports_self_before.rs @@ -1,7 +1,6 @@ //@ check-pass #![warn(clippy::single_component_path_imports)] -#![allow(unused_imports)] use regex; diff --git a/tests/ui/single_match.fixed b/tests/ui/single_match.fixed index fe28674ec18e..653c88c0f860 100644 --- a/tests/ui/single_match.fixed +++ b/tests/ui/single_match.fixed @@ -1,13 +1,6 @@ //@require-annotations-for-level: WARN #![warn(clippy::single_match)] -#![allow( - unused, - clippy::uninlined_format_args, - clippy::needless_ifs, - clippy::redundant_guards, - clippy::redundant_pattern_matching, - clippy::manual_unwrap_or_default -)] +#![allow(clippy::redundant_pattern_matching)] fn dummy() {} fn single_match() { diff --git a/tests/ui/single_match.rs b/tests/ui/single_match.rs index 0f558cb5f786..2b627781b9d0 100644 --- a/tests/ui/single_match.rs +++ b/tests/ui/single_match.rs @@ -1,13 +1,6 @@ //@require-annotations-for-level: WARN #![warn(clippy::single_match)] -#![allow( - unused, - clippy::uninlined_format_args, - clippy::needless_ifs, - clippy::redundant_guards, - clippy::redundant_pattern_matching, - clippy::manual_unwrap_or_default -)] +#![allow(clippy::redundant_pattern_matching)] fn dummy() {} fn single_match() { diff --git a/tests/ui/single_match.stderr b/tests/ui/single_match.stderr index ba8bc5af5a60..2cd9777a1ba9 100644 --- a/tests/ui/single_match.stderr +++ b/tests/ui/single_match.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:16:5 + --> tests/ui/single_match.rs:9:5 | LL | / match x { LL | | Some(y) => { @@ -19,7 +19,7 @@ LL ~ }; | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:25:5 + --> tests/ui/single_match.rs:18:5 | LL | / match x { ... | @@ -30,7 +30,7 @@ LL | | } = note: you might want to preserve the comments from inside the `match` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:36:5 + --> tests/ui/single_match.rs:29:5 | LL | / match z { LL | | (2..=3, 7..=9) => dummy(), @@ -39,7 +39,7 @@ LL | | }; | |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:66:5 + --> tests/ui/single_match.rs:59:5 | LL | / match x { LL | | Some(y) => dummy(), @@ -48,7 +48,7 @@ LL | | }; | |_____^ help: try: `if let Some(y) = x { dummy() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:72:5 + --> tests/ui/single_match.rs:65:5 | LL | / match y { LL | | Ok(y) => dummy(), @@ -57,7 +57,7 @@ LL | | }; | |_____^ help: try: `if let Ok(y) = y { dummy() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:80:5 + --> tests/ui/single_match.rs:73:5 | LL | / match c { LL | | Cow::Borrowed(..) => dummy(), @@ -66,7 +66,7 @@ LL | | }; | |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:102:5 + --> tests/ui/single_match.rs:95:5 | LL | / match x { LL | | "test" => println!(), @@ -75,7 +75,7 @@ LL | | } | |_____^ help: try: `if x == "test" { println!() }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:116:5 + --> tests/ui/single_match.rs:109:5 | LL | / match x { LL | | Foo::A => println!(), @@ -84,7 +84,7 @@ LL | | } | |_____^ help: try: `if x == Foo::A { println!() }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:123:5 + --> tests/ui/single_match.rs:116:5 | LL | / match x { LL | | FOO_C => println!(), @@ -93,7 +93,7 @@ LL | | } | |_____^ help: try: `if x == FOO_C { println!() }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:129:5 + --> tests/ui/single_match.rs:122:5 | LL | / match &&x { LL | | Foo::A => println!(), @@ -102,7 +102,7 @@ LL | | } | |_____^ help: try: `if x == Foo::A { println!() }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:136:5 + --> tests/ui/single_match.rs:129:5 | LL | / match &x { LL | | Foo::A => println!(), @@ -111,7 +111,7 @@ LL | | } | |_____^ help: try: `if x == &Foo::A { println!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:154:5 + --> tests/ui/single_match.rs:147:5 | LL | / match x { LL | | Bar::A => println!(), @@ -120,7 +120,7 @@ LL | | } | |_____^ help: try: `if let Bar::A = x { println!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:163:5 + --> tests/ui/single_match.rs:156:5 | LL | / match x { LL | | None => println!(), @@ -129,7 +129,7 @@ LL | | }; | |_____^ help: try: `if let None = x { println!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:186:5 + --> tests/ui/single_match.rs:179:5 | LL | / match x { LL | | (Some(_), _) => {}, @@ -138,7 +138,7 @@ LL | | } | |_____^ help: try: `if let (Some(_), _) = x {}` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:193:5 + --> tests/ui/single_match.rs:186:5 | LL | / match x { LL | | (Some(E::V), _) => todo!(), @@ -147,7 +147,7 @@ LL | | } | |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:200:5 + --> tests/ui/single_match.rs:193:5 | LL | / match (Some(42), Some(E::V), Some(42)) { LL | | (.., Some(E::V), _) => {}, @@ -156,7 +156,7 @@ LL | | } | |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:273:5 + --> tests/ui/single_match.rs:266:5 | LL | / match bar { LL | | Some(v) => unsafe { @@ -176,7 +176,7 @@ LL + } } | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:282:5 + --> tests/ui/single_match.rs:275:5 | LL | / match bar { LL | | #[rustfmt::skip] @@ -198,7 +198,7 @@ LL + } | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:363:5 + --> tests/ui/single_match.rs:356:5 | LL | / match Ok::<_, u32>(Some(A)) { LL | | Ok(Some(A)) => println!(), @@ -207,7 +207,7 @@ LL | | } | |_____^ help: try: `if let Ok(Some(A)) = Ok::<_, u32>(Some(A)) { println!() }` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:379:5 + --> tests/ui/single_match.rs:372:5 | LL | / match &Some(A) { LL | | Some(A | B) => println!(), @@ -216,7 +216,7 @@ LL | | } | |_____^ help: try: `if let Some(A | B) = &Some(A) { println!() }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:387:5 + --> tests/ui/single_match.rs:380:5 | LL | / match &s[0..3] { LL | | b"foo" => println!(), @@ -225,7 +225,7 @@ LL | | } | |_____^ help: try: `if &s[0..3] == b"foo" { println!() }` error: this pattern is irrefutable, `match` is useless - --> tests/ui/single_match.rs:402:5 + --> tests/ui/single_match.rs:395:5 | LL | / match DATA { LL | | DATA => println!(), @@ -234,7 +234,7 @@ LL | | } | |_____^ help: try: `println!();` error: this pattern is irrefutable, `match` is useless - --> tests/ui/single_match.rs:408:5 + --> tests/ui/single_match.rs:401:5 | LL | / match CONST_I32 { LL | | CONST_I32 => println!(), @@ -243,7 +243,7 @@ LL | | } | |_____^ help: try: `println!();` error: this pattern is irrefutable, `match` is useless - --> tests/ui/single_match.rs:415:5 + --> tests/ui/single_match.rs:408:5 | LL | / match i { LL | | i => { @@ -263,7 +263,7 @@ LL + } | error: this pattern is irrefutable, `match` is useless - --> tests/ui/single_match.rs:424:5 + --> tests/ui/single_match.rs:417:5 | LL | / match i { LL | | i => {}, @@ -272,7 +272,7 @@ LL | | } | |_____^ help: `match` expression can be removed error: this pattern is irrefutable, `match` is useless - --> tests/ui/single_match.rs:430:5 + --> tests/ui/single_match.rs:423:5 | LL | / match i { LL | | i => (), @@ -281,7 +281,7 @@ LL | | } | |_____^ help: `match` expression can be removed error: this pattern is irrefutable, `match` is useless - --> tests/ui/single_match.rs:436:5 + --> tests/ui/single_match.rs:429:5 | LL | / match CONST_I32 { LL | | CONST_I32 => println!(), @@ -290,7 +290,7 @@ LL | | } | |_____^ help: try: `println!();` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:444:5 + --> tests/ui/single_match.rs:437:5 | LL | / match x.pop() { LL | | // bla @@ -302,7 +302,7 @@ LL | | } = note: you might want to preserve the comments from inside the `match` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:453:5 + --> tests/ui/single_match.rs:446:5 | LL | / match x.pop() { LL | | // bla @@ -322,7 +322,7 @@ LL + } | error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` - --> tests/ui/single_match.rs:479:5 + --> tests/ui/single_match.rs:472:5 | LL | / match mac!(some) { LL | | Some(u) => println!("{u}"), @@ -331,7 +331,7 @@ LL | | } | |_____^ help: try: `if let Some(u) = mac!(some) { println!("{u}") }` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match.rs:487:5 + --> tests/ui/single_match.rs:480:5 | LL | / match mac!(str) { LL | | "foo" => println!("eq"), diff --git a/tests/ui/single_match_else.fixed b/tests/ui/single_match_else.fixed index fde13fb90dbb..db14fdc097d3 100644 --- a/tests/ui/single_match_else.fixed +++ b/tests/ui/single_match_else.fixed @@ -2,7 +2,7 @@ //@require-annotations-for-level: WARN #![warn(clippy::single_match_else)] -#![allow(unused, clippy::needless_return, clippy::no_effect, clippy::uninlined_format_args)] +#![expect(clippy::needless_return)] extern crate proc_macros; use proc_macros::with_span; diff --git a/tests/ui/single_match_else.rs b/tests/ui/single_match_else.rs index ca282200067c..45225e260ae7 100644 --- a/tests/ui/single_match_else.rs +++ b/tests/ui/single_match_else.rs @@ -2,7 +2,7 @@ //@require-annotations-for-level: WARN #![warn(clippy::single_match_else)] -#![allow(unused, clippy::needless_return, clippy::no_effect, clippy::uninlined_format_args)] +#![expect(clippy::needless_return)] extern crate proc_macros; use proc_macros::with_span; diff --git a/tests/ui/single_match_else_deref_patterns.fixed b/tests/ui/single_match_else_deref_patterns.fixed index 1743ae6bf5a7..381a9efd7c1c 100644 --- a/tests/ui/single_match_else_deref_patterns.fixed +++ b/tests/ui/single_match_else_deref_patterns.fixed @@ -1,13 +1,7 @@ #![feature(deref_patterns)] -#![allow( - incomplete_features, - clippy::eq_op, - clippy::op_ref, - clippy::deref_addrof, - clippy::borrow_deref_ref, - clippy::needless_ifs -)] -#![deny(clippy::single_match_else)] +#![warn(clippy::single_match_else)] +#![allow(clippy::eq_op, clippy::needless_ifs, clippy::op_ref)] +#![expect(clippy::borrow_deref_ref, clippy::deref_addrof)] fn string() { if *"" == *"" {} diff --git a/tests/ui/single_match_else_deref_patterns.rs b/tests/ui/single_match_else_deref_patterns.rs index d5cb8a24a609..dbed5d38a6a3 100644 --- a/tests/ui/single_match_else_deref_patterns.rs +++ b/tests/ui/single_match_else_deref_patterns.rs @@ -1,13 +1,7 @@ #![feature(deref_patterns)] -#![allow( - incomplete_features, - clippy::eq_op, - clippy::op_ref, - clippy::deref_addrof, - clippy::borrow_deref_ref, - clippy::needless_ifs -)] -#![deny(clippy::single_match_else)] +#![warn(clippy::single_match_else)] +#![allow(clippy::eq_op, clippy::needless_ifs, clippy::op_ref)] +#![expect(clippy::borrow_deref_ref, clippy::deref_addrof)] fn string() { match *"" { diff --git a/tests/ui/single_match_else_deref_patterns.stderr b/tests/ui/single_match_else_deref_patterns.stderr index a47df55459be..b55f57681f57 100644 --- a/tests/ui/single_match_else_deref_patterns.stderr +++ b/tests/ui/single_match_else_deref_patterns.stderr @@ -1,5 +1,5 @@ error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:13:5 + --> tests/ui/single_match_else_deref_patterns.rs:7:5 | LL | / match *"" { LL | | @@ -13,7 +13,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::single_match)]` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:19:5 + --> tests/ui/single_match_else_deref_patterns.rs:13:5 | LL | / match *&*&*&*"" { LL | | @@ -25,7 +25,7 @@ LL | | } = note: you might want to preserve the comments from inside the `match` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:25:5 + --> tests/ui/single_match_else_deref_patterns.rs:19:5 | LL | / match ***&&"" { LL | | @@ -37,7 +37,7 @@ LL | | } = note: you might want to preserve the comments from inside the `match` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:31:5 + --> tests/ui/single_match_else_deref_patterns.rs:25:5 | LL | / match *&*&*"" { LL | | @@ -49,7 +49,7 @@ LL | | } = note: you might want to preserve the comments from inside the `match` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:37:5 + --> tests/ui/single_match_else_deref_patterns.rs:31:5 | LL | / match **&&*"" { LL | | @@ -61,7 +61,7 @@ LL | | } = note: you might want to preserve the comments from inside the `match` error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:45:5 + --> tests/ui/single_match_else_deref_patterns.rs:39:5 | LL | / match &&&1 { LL | | &&&2 => unreachable!(), @@ -70,11 +70,8 @@ LL | | _ => { LL | | } | |_____^ | -note: the lint level is defined here - --> tests/ui/single_match_else_deref_patterns.rs:10:9 - | -LL | #![deny(clippy::single_match_else)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::single-match-else` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::single_match_else)]` help: try | LL ~ if &&&1 == &&&2 { unreachable!() } else { @@ -83,7 +80,7 @@ LL + } | error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:52:5 + --> tests/ui/single_match_else_deref_patterns.rs:46:5 | LL | / match &&&1 { LL | | &&2 => unreachable!(), @@ -100,7 +97,7 @@ LL + } | error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:59:5 + --> tests/ui/single_match_else_deref_patterns.rs:53:5 | LL | / match &&1 { LL | | &&2 => unreachable!(), @@ -117,7 +114,7 @@ LL + } | error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:66:5 + --> tests/ui/single_match_else_deref_patterns.rs:60:5 | LL | / match &&&1 { LL | | &2 => unreachable!(), @@ -134,7 +131,7 @@ LL + } | error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:73:5 + --> tests/ui/single_match_else_deref_patterns.rs:67:5 | LL | / match &&1 { LL | | &2 => unreachable!(), @@ -151,7 +148,7 @@ LL + } | error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:80:5 + --> tests/ui/single_match_else_deref_patterns.rs:74:5 | LL | / match &&&1 { LL | | 2 => unreachable!(), @@ -168,7 +165,7 @@ LL + } | error: you seem to be trying to use `match` for an equality check. Consider using `if` - --> tests/ui/single_match_else_deref_patterns.rs:87:5 + --> tests/ui/single_match_else_deref_patterns.rs:81:5 | LL | / match &&1 { LL | | 2 => unreachable!(), diff --git a/tests/ui/single_range_in_vec_init.1.fixed b/tests/ui/single_range_in_vec_init.1.fixed index 0af91907ad05..8b48da3e3167 100644 --- a/tests/ui/single_range_in_vec_init.1.fixed +++ b/tests/ui/single_range_in_vec_init.1.fixed @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::useless_vec, unused)] #![warn(clippy::single_range_in_vec_init)] +#![expect(clippy::no_effect, clippy::useless_vec)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/single_range_in_vec_init.2.fixed b/tests/ui/single_range_in_vec_init.2.fixed index fd6b91360aeb..db8ab64f1e6f 100644 --- a/tests/ui/single_range_in_vec_init.2.fixed +++ b/tests/ui/single_range_in_vec_init.2.fixed @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::useless_vec, unused)] #![warn(clippy::single_range_in_vec_init)] +#![expect(clippy::no_effect, clippy::useless_vec)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/single_range_in_vec_init.rs b/tests/ui/single_range_in_vec_init.rs index 1cc2b894c034..2a685c100825 100644 --- a/tests/ui/single_range_in_vec_init.rs +++ b/tests/ui/single_range_in_vec_init.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::useless_vec, unused)] #![warn(clippy::single_range_in_vec_init)] +#![expect(clippy::no_effect, clippy::useless_vec)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/size_of_in_element_count/expressions.rs b/tests/ui/size_of_in_element_count/expressions.rs index 3fe4d923441d..9d4fa69ed90b 100644 --- a/tests/ui/size_of_in_element_count/expressions.rs +++ b/tests/ui/size_of_in_element_count/expressions.rs @@ -1,5 +1,4 @@ #![warn(clippy::size_of_in_element_count)] -#![allow(clippy::ptr_offset_with_cast)] use std::mem::{size_of, size_of_val}; use std::ptr::{copy, copy_nonoverlapping, write_bytes}; diff --git a/tests/ui/size_of_in_element_count/expressions.stderr b/tests/ui/size_of_in_element_count/expressions.stderr index 74be0d7773df..c85c818679f2 100644 --- a/tests/ui/size_of_in_element_count/expressions.stderr +++ b/tests/ui/size_of_in_element_count/expressions.stderr @@ -1,5 +1,5 @@ error: found a count of bytes instead of a count of elements of `T` - --> tests/ui/size_of_in_element_count/expressions.rs:15:62 + --> tests/ui/size_of_in_element_count/expressions.rs:14:62 | LL | unsafe { copy_nonoverlapping(x.as_ptr(), y.as_mut_ptr(), size_of::() * SIZE) }; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | unsafe { copy_nonoverlapping(x.as_ptr(), y.as_mut_ptr(), size_of:: = help: to override `-D warnings` add `#[allow(clippy::size_of_in_element_count)]` error: found a count of bytes instead of a count of elements of `T` - --> tests/ui/size_of_in_element_count/expressions.rs:19:62 + --> tests/ui/size_of_in_element_count/expressions.rs:18:62 | LL | unsafe { copy_nonoverlapping(x.as_ptr(), y.as_mut_ptr(), HALF_SIZE * size_of_val(&x[0]) * 2) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | unsafe { copy_nonoverlapping(x.as_ptr(), y.as_mut_ptr(), HALF_SIZE * si = help: use a count of elements instead of a count of bytes, it already gets multiplied by the size of the type error: found a count of bytes instead of a count of elements of `T` - --> tests/ui/size_of_in_element_count/expressions.rs:23:47 + --> tests/ui/size_of_in_element_count/expressions.rs:22:47 | LL | unsafe { copy(x.as_ptr(), y.as_mut_ptr(), DOUBLE_SIZE * size_of::() / 2) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | unsafe { copy(x.as_ptr(), y.as_mut_ptr(), DOUBLE_SIZE * size_of::( = help: use a count of elements instead of a count of bytes, it already gets multiplied by the size of the type error: found a count of bytes instead of a count of elements of `T` - --> tests/ui/size_of_in_element_count/expressions.rs:33:47 + --> tests/ui/size_of_in_element_count/expressions.rs:32:47 | LL | unsafe { copy(x.as_ptr(), y.as_mut_ptr(), DOUBLE_SIZE / (2 / size_of::())) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/size_of_in_element_count/functions.rs b/tests/ui/size_of_in_element_count/functions.rs index afd12edec1ed..a8be9af099f3 100644 --- a/tests/ui/size_of_in_element_count/functions.rs +++ b/tests/ui/size_of_in_element_count/functions.rs @@ -1,5 +1,5 @@ #![warn(clippy::size_of_in_element_count)] -#![allow(clippy::ptr_offset_with_cast)] +#![expect(clippy::ptr_offset_with_cast)] use std::mem::{size_of, size_of_val}; use std::ptr::{ diff --git a/tests/ui/size_of_ref.rs b/tests/ui/size_of_ref.rs index 9a6a9419f681..068f3bd51439 100644 --- a/tests/ui/size_of_ref.rs +++ b/tests/ui/size_of_ref.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::size_of_ref)] use std::mem::size_of_val; diff --git a/tests/ui/size_of_ref.stderr b/tests/ui/size_of_ref.stderr index 46af9f55deaf..79b0ec837e2f 100644 --- a/tests/ui/size_of_ref.stderr +++ b/tests/ui/size_of_ref.stderr @@ -1,5 +1,5 @@ error: argument to `size_of_val()` is a reference to a reference - --> tests/ui/size_of_ref.rs:13:5 + --> tests/ui/size_of_ref.rs:12:5 | LL | size_of_val(&&x); | ^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | size_of_val(&&x); = help: to override `-D warnings` add `#[allow(clippy::size_of_ref)]` error: argument to `size_of_val()` is a reference to a reference - --> tests/ui/size_of_ref.rs:16:5 + --> tests/ui/size_of_ref.rs:15:5 | LL | size_of_val(&y); | ^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | size_of_val(&y); = help: dereference the argument to `size_of_val()` to get the size of the value instead of the size of the reference-type error: argument to `size_of_val()` is a reference to a reference - --> tests/ui/size_of_ref.rs:28:9 + --> tests/ui/size_of_ref.rs:27:9 | LL | std::mem::size_of_val(&self) + (std::mem::size_of::() * self.data.capacity()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/skip_while_next.rs b/tests/ui/skip_while_next.rs index 6dbb6a2ebb9a..7a176edaef10 100644 --- a/tests/ui/skip_while_next.rs +++ b/tests/ui/skip_while_next.rs @@ -1,7 +1,7 @@ //@aux-build:option_helpers.rs #![warn(clippy::skip_while_next)] -#![allow(clippy::disallowed_names, clippy::useless_vec)] +#![expect(clippy::disallowed_names, clippy::useless_vec)] extern crate option_helpers; use option_helpers::IteratorFalsePositives; diff --git a/tests/ui/sliced_string_as_bytes.fixed b/tests/ui/sliced_string_as_bytes.fixed index b5576188b83f..69347ea299cb 100644 --- a/tests/ui/sliced_string_as_bytes.fixed +++ b/tests/ui/sliced_string_as_bytes.fixed @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::sliced_string_as_bytes)] use std::ops::{Index, Range}; diff --git a/tests/ui/sliced_string_as_bytes.rs b/tests/ui/sliced_string_as_bytes.rs index 58b8d9290294..15e5fd575c71 100644 --- a/tests/ui/sliced_string_as_bytes.rs +++ b/tests/ui/sliced_string_as_bytes.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::sliced_string_as_bytes)] use std::ops::{Index, Range}; diff --git a/tests/ui/sliced_string_as_bytes.stderr b/tests/ui/sliced_string_as_bytes.stderr index ae7f02781f4b..3e4989ceae83 100644 --- a/tests/ui/sliced_string_as_bytes.stderr +++ b/tests/ui/sliced_string_as_bytes.stderr @@ -1,5 +1,5 @@ error: calling `as_bytes` after slicing a string - --> tests/ui/sliced_string_as_bytes.rs:28:17 + --> tests/ui/sliced_string_as_bytes.rs:27:17 | LL | let bytes = s[1..5].as_bytes(); | ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]` @@ -8,13 +8,13 @@ LL | let bytes = s[1..5].as_bytes(); = help: to override `-D warnings` add `#[allow(clippy::sliced_string_as_bytes)]` error: calling `as_bytes` after slicing a string - --> tests/ui/sliced_string_as_bytes.rs:30:17 + --> tests/ui/sliced_string_as_bytes.rs:29:17 | LL | let bytes = string[1..].as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]` error: calling `as_bytes` after slicing a string - --> tests/ui/sliced_string_as_bytes.rs:32:17 + --> tests/ui/sliced_string_as_bytes.rs:31:17 | LL | let bytes = "consectetur adipiscing"[..=5].as_bytes(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]` diff --git a/tests/ui/slow_vector_initialization.fixed b/tests/ui/slow_vector_initialization.fixed index a13be693e4ec..8ef967882b65 100644 --- a/tests/ui/slow_vector_initialization.fixed +++ b/tests/ui/slow_vector_initialization.fixed @@ -1,4 +1,6 @@ -#![allow(clippy::useless_vec, clippy::manual_repeat_n)] +#![warn(clippy::slow_vector_initialization)] +#![allow(clippy::useless_vec)] +#![expect(clippy::manual_repeat_n)] use std::iter::repeat; diff --git a/tests/ui/slow_vector_initialization.rs b/tests/ui/slow_vector_initialization.rs index eda96d0a0f82..637bbe09d684 100644 --- a/tests/ui/slow_vector_initialization.rs +++ b/tests/ui/slow_vector_initialization.rs @@ -1,4 +1,6 @@ -#![allow(clippy::useless_vec, clippy::manual_repeat_n)] +#![warn(clippy::slow_vector_initialization)] +#![allow(clippy::useless_vec)] +#![expect(clippy::manual_repeat_n)] use std::iter::repeat; diff --git a/tests/ui/slow_vector_initialization.stderr b/tests/ui/slow_vector_initialization.stderr index 320f2cacf61b..2876c6e1e534 100644 --- a/tests/ui/slow_vector_initialization.stderr +++ b/tests/ui/slow_vector_initialization.stderr @@ -1,5 +1,5 @@ error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:10:20 + --> tests/ui/slow_vector_initialization.rs:12:20 | LL | let mut vec1 = Vec::with_capacity(len); | ____________________^ @@ -11,7 +11,7 @@ LL | | vec1.extend(repeat(0).take(len)); = help: to override `-D warnings` add `#[allow(clippy::slow_vector_initialization)]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:16:20 + --> tests/ui/slow_vector_initialization.rs:18:20 | LL | let mut vec2 = Vec::with_capacity(len - 10); | ____________________^ @@ -20,7 +20,7 @@ LL | | vec2.extend(repeat(0).take(len - 10)); | |_________________________________________^ help: consider replacing this with: `vec![0; len - 10]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:25:20 + --> tests/ui/slow_vector_initialization.rs:27:20 | LL | let mut vec4 = Vec::with_capacity(len); | ____________________^ @@ -29,7 +29,7 @@ LL | | vec4.extend(repeat(0).take(vec4.capacity())); | |________________________________________________^ help: consider replacing this with: `vec![0; len]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:37:27 + --> tests/ui/slow_vector_initialization.rs:39:27 | LL | let mut resized_vec = Vec::with_capacity(30); | ___________________________^ @@ -38,7 +38,7 @@ LL | | resized_vec.resize(30, 0); | |_____________________________^ help: consider replacing this with: `vec![0; 30]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:42:26 + --> tests/ui/slow_vector_initialization.rs:44:26 | LL | let mut extend_vec = Vec::with_capacity(30); | __________________________^ @@ -47,7 +47,7 @@ LL | | extend_vec.extend(repeat(0).take(30)); | |_________________________________________^ help: consider replacing this with: `vec![0; 30]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:51:20 + --> tests/ui/slow_vector_initialization.rs:53:20 | LL | let mut vec1 = Vec::with_capacity(len); | ____________________^ @@ -56,7 +56,7 @@ LL | | vec1.resize(len, 0); | |_______________________^ help: consider replacing this with: `vec![0; len]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:61:20 + --> tests/ui/slow_vector_initialization.rs:63:20 | LL | let mut vec3 = Vec::with_capacity(len - 10); | ____________________^ @@ -65,7 +65,7 @@ LL | | vec3.resize(len - 10, 0); | |____________________________^ help: consider replacing this with: `vec![0; len - 10]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:66:20 + --> tests/ui/slow_vector_initialization.rs:68:20 | LL | let mut vec4 = Vec::with_capacity(len); | ____________________^ @@ -74,7 +74,7 @@ LL | | vec4.resize(vec4.capacity(), 0); | |___________________________________^ help: consider replacing this with: `vec![0; len]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:72:12 + --> tests/ui/slow_vector_initialization.rs:74:12 | LL | vec1 = Vec::with_capacity(10); | ____________^ @@ -83,7 +83,7 @@ LL | | vec1.resize(10, 0); | |______________________^ help: consider replacing this with: `vec![0; 10]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:81:20 + --> tests/ui/slow_vector_initialization.rs:83:20 | LL | let mut vec1 = Vec::new(); | ____________________^ @@ -92,7 +92,7 @@ LL | | vec1.resize(len, 0); | |_______________________^ help: consider replacing this with: `vec![0; len]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:87:20 + --> tests/ui/slow_vector_initialization.rs:89:20 | LL | let mut vec3 = Vec::new(); | ____________________^ @@ -101,7 +101,7 @@ LL | | vec3.resize(len - 10, 0); | |____________________________^ help: consider replacing this with: `vec![0; len - 10]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:93:12 + --> tests/ui/slow_vector_initialization.rs:95:12 | LL | vec1 = Vec::new(); | ____________^ @@ -110,7 +110,7 @@ LL | | vec1.resize(10, 0); | |______________________^ help: consider replacing this with: `vec![0; 10]` error: slow zero-filling initialization - --> tests/ui/slow_vector_initialization.rs:98:12 + --> tests/ui/slow_vector_initialization.rs:100:12 | LL | vec1 = vec![]; | ____________^ diff --git a/tests/ui/some_filter.fixed b/tests/ui/some_filter.fixed index a214dec920d4..938dc8514e2e 100644 --- a/tests/ui/some_filter.fixed +++ b/tests/ui/some_filter.fixed @@ -1,5 +1,5 @@ #![warn(clippy::some_filter)] -#![allow(clippy::const_is_empty)] +#![expect(clippy::const_is_empty)] macro_rules! unchanged { ($result:expr) => { diff --git a/tests/ui/some_filter.rs b/tests/ui/some_filter.rs index eec797536a8f..a12141735666 100644 --- a/tests/ui/some_filter.rs +++ b/tests/ui/some_filter.rs @@ -1,5 +1,5 @@ #![warn(clippy::some_filter)] -#![allow(clippy::const_is_empty)] +#![expect(clippy::const_is_empty)] macro_rules! unchanged { ($result:expr) => { diff --git a/tests/ui/stable_sort_primitive.fixed b/tests/ui/stable_sort_primitive.fixed index b4870ebad2b3..a29bc8e7c360 100644 --- a/tests/ui/stable_sort_primitive.fixed +++ b/tests/ui/stable_sort_primitive.fixed @@ -1,5 +1,5 @@ #![warn(clippy::stable_sort_primitive)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] fn main() { // positive examples diff --git a/tests/ui/stable_sort_primitive.rs b/tests/ui/stable_sort_primitive.rs index b3fe64efd620..848898c56e0b 100644 --- a/tests/ui/stable_sort_primitive.rs +++ b/tests/ui/stable_sort_primitive.rs @@ -1,5 +1,5 @@ #![warn(clippy::stable_sort_primitive)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] fn main() { // positive examples diff --git a/tests/ui/starts_ends_with.fixed b/tests/ui/starts_ends_with.fixed index f2fab9217604..df88bb1e0d00 100644 --- a/tests/ui/starts_ends_with.fixed +++ b/tests/ui/starts_ends_with.fixed @@ -1,5 +1,4 @@ -#![allow(clippy::needless_ifs, dead_code, unused_must_use, clippy::double_ended_iterator_last)] - +#![warn(clippy::chars_last_cmp, clippy::chars_next_cmp)] fn main() {} #[allow(clippy::unnecessary_operation)] diff --git a/tests/ui/starts_ends_with.rs b/tests/ui/starts_ends_with.rs index 1460d77a094d..600905e96a1f 100644 --- a/tests/ui/starts_ends_with.rs +++ b/tests/ui/starts_ends_with.rs @@ -1,5 +1,4 @@ -#![allow(clippy::needless_ifs, dead_code, unused_must_use, clippy::double_ended_iterator_last)] - +#![warn(clippy::chars_last_cmp, clippy::chars_next_cmp)] fn main() {} #[allow(clippy::unnecessary_operation)] diff --git a/tests/ui/starts_ends_with.stderr b/tests/ui/starts_ends_with.stderr index bcb38f2beb7b..f73af93a7a83 100644 --- a/tests/ui/starts_ends_with.stderr +++ b/tests/ui/starts_ends_with.stderr @@ -1,5 +1,5 @@ error: you should use the `starts_with` method - --> tests/ui/starts_ends_with.rs:7:5 + --> tests/ui/starts_ends_with.rs:6:5 | LL | "".chars().next() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')` @@ -8,31 +8,31 @@ LL | "".chars().next() == Some(' '); = help: to override `-D warnings` add `#[allow(clippy::chars_next_cmp)]` error: you should use the `starts_with` method - --> tests/ui/starts_ends_with.rs:9:5 + --> tests/ui/starts_ends_with.rs:8:5 | LL | Some(' ') != "".chars().next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')` error: you should use the `starts_with` method - --> tests/ui/starts_ends_with.rs:13:5 + --> tests/ui/starts_ends_with.rs:12:5 | LL | "".chars().next() == Some('\n'); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with('\n')` error: you should use the `starts_with` method - --> tests/ui/starts_ends_with.rs:15:5 + --> tests/ui/starts_ends_with.rs:14:5 | LL | Some('\n') != "".chars().next(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with('\n')` error: you should use the `starts_with` method - --> tests/ui/starts_ends_with.rs:21:8 + --> tests/ui/starts_ends_with.rs:20:8 | LL | if s.chars().next().unwrap() == 'f' { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.starts_with('f')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:26:8 + --> tests/ui/starts_ends_with.rs:25:8 | LL | if s.chars().next_back().unwrap() == 'o' { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` @@ -41,61 +41,61 @@ LL | if s.chars().next_back().unwrap() == 'o' { = help: to override `-D warnings` add `#[allow(clippy::chars_last_cmp)]` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:31:8 + --> tests/ui/starts_ends_with.rs:30:8 | LL | if s.chars().last().unwrap() == 'o' { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `s.ends_with('o')` error: you should use the `starts_with` method - --> tests/ui/starts_ends_with.rs:36:8 + --> tests/ui/starts_ends_with.rs:35:8 | LL | if s.chars().next().unwrap() != 'f' { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.starts_with('f')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:41:8 + --> tests/ui/starts_ends_with.rs:40:8 | LL | if s.chars().next_back().unwrap() != 'o' { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('o')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:46:8 + --> tests/ui/starts_ends_with.rs:45:8 | LL | if s.chars().last().unwrap() != '\n' { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('\n')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:55:5 + --> tests/ui/starts_ends_with.rs:54:5 | LL | "".chars().last() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:57:5 + --> tests/ui/starts_ends_with.rs:56:5 | LL | Some(' ') != "".chars().last(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:59:5 + --> tests/ui/starts_ends_with.rs:58:5 | LL | "".chars().next_back() == Some(' '); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with(' ')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:61:5 + --> tests/ui/starts_ends_with.rs:60:5 | LL | Some(' ') != "".chars().next_back(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with(' ')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:65:5 + --> tests/ui/starts_ends_with.rs:64:5 | LL | "".chars().last() == Some('\n'); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with('\n')` error: you should use the `ends_with` method - --> tests/ui/starts_ends_with.rs:67:5 + --> tests/ui/starts_ends_with.rs:66:5 | LL | Some('\n') != "".chars().last(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with('\n')` diff --git a/tests/ui/std_instead_of_core.fixed b/tests/ui/std_instead_of_core.fixed index c27cec558242..73faa421bfa3 100644 --- a/tests/ui/std_instead_of_core.fixed +++ b/tests/ui/std_instead_of_core.fixed @@ -1,7 +1,7 @@ //@aux-build:proc_macro_derive.rs #![warn(clippy::std_instead_of_core)] -#![allow(unused_imports, deprecated)] +#![expect(deprecated)] extern crate alloc; @@ -69,7 +69,6 @@ fn alloc_instead_of_core() { mod std_in_proc_macro_derive { #[warn(clippy::alloc_instead_of_core)] - #[allow(unused)] #[derive(ImplStructWithStdDisplay)] struct B {} } diff --git a/tests/ui/std_instead_of_core.rs b/tests/ui/std_instead_of_core.rs index 7d53f7fc3072..61e6d76a4a06 100644 --- a/tests/ui/std_instead_of_core.rs +++ b/tests/ui/std_instead_of_core.rs @@ -1,7 +1,7 @@ //@aux-build:proc_macro_derive.rs #![warn(clippy::std_instead_of_core)] -#![allow(unused_imports, deprecated)] +#![expect(deprecated)] extern crate alloc; @@ -69,7 +69,6 @@ fn alloc_instead_of_core() { mod std_in_proc_macro_derive { #[warn(clippy::alloc_instead_of_core)] - #[allow(unused)] #[derive(ImplStructWithStdDisplay)] struct B {} } diff --git a/tests/ui/std_instead_of_core.stderr b/tests/ui/std_instead_of_core.stderr index a5f8fbbe37cb..e3ddc0414be1 100644 --- a/tests/ui/std_instead_of_core.stderr +++ b/tests/ui/std_instead_of_core.stderr @@ -86,13 +86,13 @@ LL | use alloc::slice::from_ref; = help: to override `-D warnings` add `#[allow(clippy::alloc_instead_of_core)]` error: used import from `std` instead of `core` - --> tests/ui/std_instead_of_core.rs:81:9 + --> tests/ui/std_instead_of_core.rs:80:9 | LL | std::intrinsics::copy(a, b, 1); | ^^^ help: consider importing the item from `core`: `core` error: used import from `std` instead of `core` - --> tests/ui/std_instead_of_core.rs:90:17 + --> tests/ui/std_instead_of_core.rs:89:17 | LL | fn msrv_1_77(_: std::net::IpAddr) {} | ^^^ help: consider importing the item from `core`: `core` diff --git a/tests/ui/std_instead_of_core_unfixable.rs b/tests/ui/std_instead_of_core_unfixable.rs index 5e71159ac6c5..737a1dad1ce5 100644 --- a/tests/ui/std_instead_of_core_unfixable.rs +++ b/tests/ui/std_instead_of_core_unfixable.rs @@ -1,6 +1,4 @@ -#![warn(clippy::std_instead_of_core)] -#![warn(clippy::std_instead_of_alloc)] -#![allow(unused_imports)] +#![warn(clippy::std_instead_of_alloc, clippy::std_instead_of_core)] #[rustfmt::skip] fn issue14982() { diff --git a/tests/ui/std_instead_of_core_unfixable.stderr b/tests/ui/std_instead_of_core_unfixable.stderr index 147b46022126..bacce013e202 100644 --- a/tests/ui/std_instead_of_core_unfixable.stderr +++ b/tests/ui/std_instead_of_core_unfixable.stderr @@ -1,5 +1,5 @@ error: used import from `std` instead of `core` - --> tests/ui/std_instead_of_core_unfixable.rs:7:43 + --> tests/ui/std_instead_of_core_unfixable.rs:5:43 | LL | use std::{collections::HashMap, hash::Hash}; | ^^^^ @@ -9,7 +9,7 @@ LL | use std::{collections::HashMap, hash::Hash}; = help: to override `-D warnings` add `#[allow(clippy::std_instead_of_core)]` error: used import from `std` instead of `core` - --> tests/ui/std_instead_of_core_unfixable.rs:13:22 + --> tests/ui/std_instead_of_core_unfixable.rs:11:22 | LL | use std::{error::Error, vec::Vec, fs::File}; | ^^^^^ @@ -17,7 +17,7 @@ LL | use std::{error::Error, vec::Vec, fs::File}; = help: consider importing the item from `core` error: used import from `std` instead of `alloc` - --> tests/ui/std_instead_of_core_unfixable.rs:13:34 + --> tests/ui/std_instead_of_core_unfixable.rs:11:34 | LL | use std::{error::Error, vec::Vec, fs::File}; | ^^^ diff --git a/tests/ui/string_lit_as_bytes.fixed b/tests/ui/string_lit_as_bytes.fixed index 2a86dffbc762..a913951961ba 100644 --- a/tests/ui/string_lit_as_bytes.fixed +++ b/tests/ui/string_lit_as_bytes.fixed @@ -1,7 +1,7 @@ //@aux-build:macro_rules.rs -#![allow(clippy::needless_raw_string_hashes, dead_code, unused_variables)] #![warn(clippy::string_lit_as_bytes)] +#![expect(clippy::needless_raw_string_hashes)] #[macro_use] extern crate macro_rules; diff --git a/tests/ui/string_lit_as_bytes.rs b/tests/ui/string_lit_as_bytes.rs index 785d8f1e0f6b..2e7f47dfcf65 100644 --- a/tests/ui/string_lit_as_bytes.rs +++ b/tests/ui/string_lit_as_bytes.rs @@ -1,7 +1,7 @@ //@aux-build:macro_rules.rs -#![allow(clippy::needless_raw_string_hashes, dead_code, unused_variables)] #![warn(clippy::string_lit_as_bytes)] +#![expect(clippy::needless_raw_string_hashes)] #[macro_use] extern crate macro_rules; diff --git a/tests/ui/string_lit_chars_any.fixed b/tests/ui/string_lit_chars_any.fixed index cf05a2c2e835..e1dd36df5ec6 100644 --- a/tests/ui/string_lit_chars_any.fixed +++ b/tests/ui/string_lit_chars_any.fixed @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::eq_op, clippy::needless_raw_string_hashes, clippy::no_effect, unused)] #![warn(clippy::string_lit_chars_any)] +#![expect(clippy::eq_op, clippy::no_effect)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/string_lit_chars_any.rs b/tests/ui/string_lit_chars_any.rs index 22cfb784ed7d..43197a438fa2 100644 --- a/tests/ui/string_lit_chars_any.rs +++ b/tests/ui/string_lit_chars_any.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::eq_op, clippy::needless_raw_string_hashes, clippy::no_effect, unused)] #![warn(clippy::string_lit_chars_any)] +#![expect(clippy::eq_op, clippy::no_effect)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/string_slice.rs b/tests/ui/string_slice.rs index 0acc48c1f412..b67d84bbea89 100644 --- a/tests/ui/string_slice.rs +++ b/tests/ui/string_slice.rs @@ -1,5 +1,5 @@ #![warn(clippy::string_slice)] -#![allow(clippy::no_effect)] +#![expect(clippy::no_effect)] use std::borrow::Cow; diff --git a/tests/ui/strlen_on_c_strings.fixed b/tests/ui/strlen_on_c_strings.fixed index 6604da70874d..3f88a7373d15 100644 --- a/tests/ui/strlen_on_c_strings.fixed +++ b/tests/ui/strlen_on_c_strings.fixed @@ -1,5 +1,5 @@ #![warn(clippy::strlen_on_c_strings)] -#![allow(clippy::manual_c_str_literals, clippy::boxed_local)] +#![expect(clippy::boxed_local, clippy::manual_c_str_literals)] use libc::strlen; use std::ffi::{CStr, CString}; diff --git a/tests/ui/strlen_on_c_strings.rs b/tests/ui/strlen_on_c_strings.rs index 11fbdf585064..e20d985d6465 100644 --- a/tests/ui/strlen_on_c_strings.rs +++ b/tests/ui/strlen_on_c_strings.rs @@ -1,5 +1,5 @@ #![warn(clippy::strlen_on_c_strings)] -#![allow(clippy::manual_c_str_literals, clippy::boxed_local)] +#![expect(clippy::boxed_local, clippy::manual_c_str_literals)] use libc::strlen; use std::ffi::{CStr, CString}; diff --git a/tests/ui/struct_fields.rs b/tests/ui/struct_fields.rs index e7ff2e6573b2..be26e69ac7e4 100644 --- a/tests/ui/struct_fields.rs +++ b/tests/ui/struct_fields.rs @@ -1,7 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::struct_field_names)] -#![allow(unused)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/struct_fields.stderr b/tests/ui/struct_fields.stderr index a5ff1b125907..254498ad2eeb 100644 --- a/tests/ui/struct_fields.stderr +++ b/tests/ui/struct_fields.stderr @@ -1,5 +1,5 @@ error: field name ends with the struct's name - --> tests/ui/struct_fields.rs:10:5 + --> tests/ui/struct_fields.rs:9:5 | LL | field_data1: u8, | ^^^^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | field_data1: u8, = help: to override `-D warnings` add `#[allow(clippy::struct_field_names)]` error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:20:5 + --> tests/ui/struct_fields.rs:19:5 | LL | data2_field: u8, | ^^^^^^^^^^^^^^^ error: all fields have the same postfix: `data` - --> tests/ui/struct_fields.rs:25:1 + --> tests/ui/struct_fields.rs:24:1 | LL | / struct StructData { LL | | @@ -27,7 +27,7 @@ LL | | } = help: remove the postfixes error: all fields have the same prefix: `data` - --> tests/ui/struct_fields.rs:32:1 + --> tests/ui/struct_fields.rs:31:1 | LL | / struct DataStruct { LL | | @@ -40,7 +40,7 @@ LL | | } = help: remove the prefixes error: all fields have the same prefix: `some_data` - --> tests/ui/struct_fields.rs:39:1 + --> tests/ui/struct_fields.rs:38:1 | LL | / struct DoublePrefix { LL | | @@ -53,7 +53,7 @@ LL | | } = help: remove the prefixes error: all fields have the same postfix: `some_data` - --> tests/ui/struct_fields.rs:46:1 + --> tests/ui/struct_fields.rs:45:1 | LL | / struct DoublePostfix { LL | | @@ -66,7 +66,7 @@ LL | | } = help: remove the postfixes error: all fields have the same postfix: `someData` - --> tests/ui/struct_fields.rs:54:1 + --> tests/ui/struct_fields.rs:53:1 | LL | / struct NotSnakeCase { LL | | @@ -79,7 +79,7 @@ LL | | } = help: remove the postfixes error: all fields have the same prefix: `someData` - --> tests/ui/struct_fields.rs:61:1 + --> tests/ui/struct_fields.rs:60:1 | LL | / struct NotSnakeCase2 { LL | | @@ -92,7 +92,7 @@ LL | | } = help: remove the prefixes error: all fields have the same prefix: `prefix` - --> tests/ui/struct_fields.rs:74:1 + --> tests/ui/struct_fields.rs:73:1 | LL | / struct NonCaps { LL | | @@ -105,7 +105,7 @@ LL | | } = help: remove the prefixes error: all fields have the same prefix: `_type` - --> tests/ui/struct_fields.rs:124:5 + --> tests/ui/struct_fields.rs:123:5 | LL | / struct DoLint { LL | | @@ -119,7 +119,7 @@ LL | | } = help: remove the prefixes error: all fields have the same prefix: `__type` - --> tests/ui/struct_fields.rs:132:5 + --> tests/ui/struct_fields.rs:131:5 | LL | / struct DoLint2 { LL | | @@ -133,7 +133,7 @@ LL | | } = help: remove the prefixes error: all fields have the same prefix: `___type` - --> tests/ui/struct_fields.rs:140:5 + --> tests/ui/struct_fields.rs:139:5 | LL | / struct DoLint3 { LL | | @@ -147,7 +147,7 @@ LL | | } = help: remove the prefixes error: all fields have the same postfix: `_` - --> tests/ui/struct_fields.rs:148:5 + --> tests/ui/struct_fields.rs:147:5 | LL | / struct DoLint4 { LL | | @@ -161,7 +161,7 @@ LL | | } = help: remove the postfixes error: all fields have the same postfix: `__` - --> tests/ui/struct_fields.rs:156:5 + --> tests/ui/struct_fields.rs:155:5 | LL | / struct DoLint5 { LL | | @@ -175,7 +175,7 @@ LL | | } = help: remove the postfixes error: all fields have the same postfix: `___` - --> tests/ui/struct_fields.rs:164:5 + --> tests/ui/struct_fields.rs:163:5 | LL | / struct DoLint6 { LL | | @@ -189,7 +189,7 @@ LL | | } = help: remove the postfixes error: all fields have the same postfix: `type` - --> tests/ui/struct_fields.rs:172:5 + --> tests/ui/struct_fields.rs:171:5 | LL | / struct DoLintToo { LL | | @@ -202,13 +202,13 @@ LL | | } = help: remove the postfixes error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:210:5 + --> tests/ui/struct_fields.rs:209:5 | LL | proxy: i32, | ^^^^^^^^^^ error: all fields have the same prefix: `some` - --> tests/ui/struct_fields.rs:226:13 + --> tests/ui/struct_fields.rs:225:13 | LL | / struct MacroStruct { LL | | @@ -225,7 +225,7 @@ LL | mk_struct!(); = note: this error originates in the macro `mk_struct` (in Nightly builds, run with -Z macro-backtrace for more info) error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:239:17 + --> tests/ui/struct_fields.rs:238:17 | LL | macrobaz_a: i32, | ^^^^^^^^^^^^^^^ @@ -236,7 +236,7 @@ LL | mk_struct2!(); = note: this error originates in the macro `mk_struct2` (in Nightly builds, run with -Z macro-backtrace for more info) error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:251:17 + --> tests/ui/struct_fields.rs:250:17 | LL | $field: i32, | ^^^^^^^^^^^ @@ -247,7 +247,7 @@ LL | mk_struct_with_names!(Foo, foo); = note: this error originates in the macro `mk_struct_with_names` (in Nightly builds, run with -Z macro-backtrace for more info) error: all fields have the same prefix: `some` - --> tests/ui/struct_fields.rs:291:13 + --> tests/ui/struct_fields.rs:290:13 | LL | / struct $struct_name { LL | | @@ -264,31 +264,31 @@ LL | mk_struct_full_def!(PrefixData, some_data, some_meta, some_other); = note: this error originates in the macro `mk_struct_full_def` (in Nightly builds, run with -Z macro-backtrace for more info) error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:339:5 + --> tests/ui/struct_fields.rs:338:5 | LL | use_foo: bool, | ^^^^^^^^^^^^^ error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:341:5 + --> tests/ui/struct_fields.rs:340:5 | LL | use_bar: bool, | ^^^^^^^^^^^^^ error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:343:5 + --> tests/ui/struct_fields.rs:342:5 | LL | use_baz: bool, | ^^^^^^^^^^^^^ error: field name starts with the struct's name - --> tests/ui/struct_fields.rs:349:5 + --> tests/ui/struct_fields.rs:348:5 | LL | pub_struct_field_named_after_struct: bool, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: all fields have the same prefix: `field` - --> tests/ui/struct_fields.rs:354:1 + --> tests/ui/struct_fields.rs:353:1 | LL | / pub struct PubStructFieldPrefix { LL | | diff --git a/tests/ui/suspicious_arithmetic_impl.rs b/tests/ui/suspicious_arithmetic_impl.rs index 9798d2049c62..f6a7a20f4848 100644 --- a/tests/ui/suspicious_arithmetic_impl.rs +++ b/tests/ui/suspicious_arithmetic_impl.rs @@ -1,5 +1,5 @@ -#![allow(clippy::legacy_numeric_constants)] #![warn(clippy::suspicious_arithmetic_impl)] +#![expect(clippy::legacy_numeric_constants)] use std::ops::{ Add, AddAssign, BitAnd, BitOr, BitOrAssign, BitXor, Div, DivAssign, Mul, MulAssign, Rem, Shl, Shr, Sub, }; diff --git a/tests/ui/suspicious_command_arg_space.fixed b/tests/ui/suspicious_command_arg_space.fixed index 0a0d90f75e57..5eae8e80add3 100644 --- a/tests/ui/suspicious_command_arg_space.fixed +++ b/tests/ui/suspicious_command_arg_space.fixed @@ -1,4 +1,5 @@ -#![allow(clippy::zombie_processes)] +#![warn(clippy::suspicious_command_arg_space)] +#![expect(clippy::zombie_processes)] fn main() { // Things it should warn about: std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap(); diff --git a/tests/ui/suspicious_command_arg_space.rs b/tests/ui/suspicious_command_arg_space.rs index 78bdfbdf0cb6..70547336773b 100644 --- a/tests/ui/suspicious_command_arg_space.rs +++ b/tests/ui/suspicious_command_arg_space.rs @@ -1,4 +1,5 @@ -#![allow(clippy::zombie_processes)] +#![warn(clippy::suspicious_command_arg_space)] +#![expect(clippy::zombie_processes)] fn main() { // Things it should warn about: std::process::Command::new("echo").arg("-n hello").spawn().unwrap(); diff --git a/tests/ui/suspicious_command_arg_space.stderr b/tests/ui/suspicious_command_arg_space.stderr index 8952a3ffe4b8..0509a7854803 100644 --- a/tests/ui/suspicious_command_arg_space.stderr +++ b/tests/ui/suspicious_command_arg_space.stderr @@ -1,5 +1,5 @@ error: single argument that looks like it should be multiple arguments - --> tests/ui/suspicious_command_arg_space.rs:4:44 + --> tests/ui/suspicious_command_arg_space.rs:5:44 | LL | std::process::Command::new("echo").arg("-n hello").spawn().unwrap(); | ^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap | error: single argument that looks like it should be multiple arguments - --> tests/ui/suspicious_command_arg_space.rs:7:43 + --> tests/ui/suspicious_command_arg_space.rs:8:43 | LL | std::process::Command::new("cat").arg("--number file").spawn().unwrap(); | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/suspicious_doc_comments.fixed b/tests/ui/suspicious_doc_comments.fixed index 3faa4b21ee41..c7d288095db3 100644 --- a/tests/ui/suspicious_doc_comments.fixed +++ b/tests/ui/suspicious_doc_comments.fixed @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::suspicious_doc_comments)] #![allow(clippy::empty_line_after_doc_comments)] diff --git a/tests/ui/suspicious_doc_comments.rs b/tests/ui/suspicious_doc_comments.rs index 4af6ed850c2b..fdd93bae8f84 100644 --- a/tests/ui/suspicious_doc_comments.rs +++ b/tests/ui/suspicious_doc_comments.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::suspicious_doc_comments)] #![allow(clippy::empty_line_after_doc_comments)] diff --git a/tests/ui/suspicious_doc_comments.stderr b/tests/ui/suspicious_doc_comments.stderr index df04d08537c9..bd04f5d23f3f 100644 --- a/tests/ui/suspicious_doc_comments.stderr +++ b/tests/ui/suspicious_doc_comments.stderr @@ -1,5 +1,5 @@ error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:6:1 + --> tests/ui/suspicious_doc_comments.rs:5:1 | LL | ///! Fake module documentation. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + //! Fake module documentation. | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:11:5 + --> tests/ui/suspicious_doc_comments.rs:10:5 | LL | ///! This module contains useful functions. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + //! This module contains useful functions. | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:24:5 + --> tests/ui/suspicious_doc_comments.rs:23:5 | LL | / /**! This module contains useful functions. LL | | */ @@ -38,7 +38,7 @@ LL + */ | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:39:5 + --> tests/ui/suspicious_doc_comments.rs:38:5 | LL | / ///! This module LL | | @@ -55,7 +55,7 @@ LL ~ //! useful functions. | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:48:5 + --> tests/ui/suspicious_doc_comments.rs:47:5 | LL | / ///! a LL | | @@ -70,7 +70,7 @@ LL ~ //! b | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:57:5 + --> tests/ui/suspicious_doc_comments.rs:56:5 | LL | ///! a | ^^^^^^ @@ -82,7 +82,7 @@ LL + //! a | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:64:5 + --> tests/ui/suspicious_doc_comments.rs:63:5 | LL | / ///! a ... | @@ -98,7 +98,7 @@ LL ~ //! b | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:77:5 + --> tests/ui/suspicious_doc_comments.rs:76:5 | LL | ///! Very cool macro | ^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL + //! Very cool macro | error: this is an outer doc comment and does not apply to the parent module or crate - --> tests/ui/suspicious_doc_comments.rs:85:5 + --> tests/ui/suspicious_doc_comments.rs:84:5 | LL | ///! Huh. | ^^^^^^^^^ diff --git a/tests/ui/suspicious_doc_comments_unfixable.rs b/tests/ui/suspicious_doc_comments_unfixable.rs index 17c7cc15b170..aa75c079692c 100644 --- a/tests/ui/suspicious_doc_comments_unfixable.rs +++ b/tests/ui/suspicious_doc_comments_unfixable.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::empty_line_after_doc_comments)] #![warn(clippy::suspicious_doc_comments)] +#![expect(clippy::empty_line_after_doc_comments)] //@no-rustfix ///! a //~^ suspicious_doc_comments diff --git a/tests/ui/suspicious_else_formatting.rs b/tests/ui/suspicious_else_formatting.rs index 8574cf1c20a1..71fd9aac5fda 100644 --- a/tests/ui/suspicious_else_formatting.rs +++ b/tests/ui/suspicious_else_formatting.rs @@ -1,11 +1,11 @@ //@aux-build:proc_macro_suspicious_else_formatting.rs -#![warn(clippy::suspicious_else_formatting, clippy::possible_missing_else)] -#![allow( +#![warn(clippy::possible_missing_else, clippy::suspicious_else_formatting)] +#![expect( clippy::if_same_then_else, clippy::let_unit_value, - clippy::needless_ifs, - clippy::needless_else + clippy::needless_else, + clippy::needless_ifs )] extern crate proc_macro_suspicious_else_formatting; diff --git a/tests/ui/suspicious_map.rs b/tests/ui/suspicious_map.rs index 86e48e29bb9e..46bb3da56785 100644 --- a/tests/ui/suspicious_map.rs +++ b/tests/ui/suspicious_map.rs @@ -1,5 +1,5 @@ -#![allow(clippy::map_with_unused_argument_over_ranges)] #![warn(clippy::suspicious_map)] +#![expect(clippy::map_with_unused_argument_over_ranges)] fn main() { let _ = (0..3).map(|x| x + 2).count(); diff --git a/tests/ui/suspicious_operation_groupings.fixed b/tests/ui/suspicious_operation_groupings.fixed index fa680e537d30..4c4daf561cf3 100644 --- a/tests/ui/suspicious_operation_groupings.fixed +++ b/tests/ui/suspicious_operation_groupings.fixed @@ -1,7 +1,7 @@ //@compile-flags: -Zdeduplicate-diagnostics=yes #![warn(clippy::suspicious_operation_groupings)] -#![allow(dead_code, unused_parens, clippy::eq_op, clippy::manual_midpoint)] +#![expect(clippy::eq_op, clippy::manual_midpoint)] struct Vec3 { x: f64, diff --git a/tests/ui/suspicious_operation_groupings.rs b/tests/ui/suspicious_operation_groupings.rs index 4ffee640e8bd..f153972a3064 100644 --- a/tests/ui/suspicious_operation_groupings.rs +++ b/tests/ui/suspicious_operation_groupings.rs @@ -1,7 +1,7 @@ //@compile-flags: -Zdeduplicate-diagnostics=yes #![warn(clippy::suspicious_operation_groupings)] -#![allow(dead_code, unused_parens, clippy::eq_op, clippy::manual_midpoint)] +#![expect(clippy::eq_op, clippy::manual_midpoint)] struct Vec3 { x: f64, diff --git a/tests/ui/suspicious_splitn.rs b/tests/ui/suspicious_splitn.rs index 535f62c6bede..4eab716bd882 100644 --- a/tests/ui/suspicious_splitn.rs +++ b/tests/ui/suspicious_splitn.rs @@ -1,5 +1,4 @@ #![warn(clippy::suspicious_splitn)] -#![allow(clippy::needless_splitn)] fn main() { let _ = "a,b,c".splitn(3, ','); diff --git a/tests/ui/suspicious_splitn.stderr b/tests/ui/suspicious_splitn.stderr index 910c905bc990..6ae19520673e 100644 --- a/tests/ui/suspicious_splitn.stderr +++ b/tests/ui/suspicious_splitn.stderr @@ -1,5 +1,5 @@ error: `splitn` called with `0` splits - --> tests/ui/suspicious_splitn.rs:10:13 + --> tests/ui/suspicious_splitn.rs:9:13 | LL | let _ = "a,b".splitn(0, ','); | ^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | let _ = "a,b".splitn(0, ','); = help: to override `-D warnings` add `#[allow(clippy::suspicious_splitn)]` error: `rsplitn` called with `0` splits - --> tests/ui/suspicious_splitn.rs:13:13 + --> tests/ui/suspicious_splitn.rs:12:13 | LL | let _ = "a,b".rsplitn(0, ','); | ^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let _ = "a,b".rsplitn(0, ','); = note: the resulting iterator will always return `None` error: `splitn` called with `1` split - --> tests/ui/suspicious_splitn.rs:16:13 + --> tests/ui/suspicious_splitn.rs:15:13 | LL | let _ = "a,b".splitn(1, ','); | ^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | let _ = "a,b".splitn(1, ','); = note: the resulting iterator will always return the entire string followed by `None` error: `splitn` called with `0` splits - --> tests/ui/suspicious_splitn.rs:19:13 + --> tests/ui/suspicious_splitn.rs:18:13 | LL | let _ = [0, 1, 2].splitn(0, |&x| x == 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL | let _ = [0, 1, 2].splitn(0, |&x| x == 1); = note: the resulting iterator will always return `None` error: `splitn_mut` called with `0` splits - --> tests/ui/suspicious_splitn.rs:22:13 + --> tests/ui/suspicious_splitn.rs:21:13 | LL | let _ = [0, 1, 2].splitn_mut(0, |&x| x == 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | let _ = [0, 1, 2].splitn_mut(0, |&x| x == 1); = note: the resulting iterator will always return `None` error: `splitn` called with `1` split - --> tests/ui/suspicious_splitn.rs:25:13 + --> tests/ui/suspicious_splitn.rs:24:13 | LL | let _ = [0, 1, 2].splitn(1, |&x| x == 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | let _ = [0, 1, 2].splitn(1, |&x| x == 1); = note: the resulting iterator will always return the entire slice followed by `None` error: `rsplitn_mut` called with `1` split - --> tests/ui/suspicious_splitn.rs:28:13 + --> tests/ui/suspicious_splitn.rs:27:13 | LL | let _ = [0, 1, 2].rsplitn_mut(1, |&x| x == 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -57,7 +57,7 @@ LL | let _ = [0, 1, 2].rsplitn_mut(1, |&x| x == 1); = note: the resulting iterator will always return the entire slice followed by `None` error: `splitn` called with `1` split - --> tests/ui/suspicious_splitn.rs:32:13 + --> tests/ui/suspicious_splitn.rs:31:13 | LL | let _ = "a,b".splitn(X + 1, ','); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | let _ = "a,b".splitn(X + 1, ','); = note: the resulting iterator will always return the entire string followed by `None` error: `splitn` called with `0` splits - --> tests/ui/suspicious_splitn.rs:35:13 + --> tests/ui/suspicious_splitn.rs:34:13 | LL | let _ = "a,b".splitn(X, ','); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/suspicious_to_owned.1.fixed b/tests/ui/suspicious_to_owned.1.fixed index 6fd536a38ed1..0b025e618894 100644 --- a/tests/ui/suspicious_to_owned.1.fixed +++ b/tests/ui/suspicious_to_owned.1.fixed @@ -1,6 +1,5 @@ -#![warn(clippy::suspicious_to_owned)] -#![warn(clippy::implicit_clone)] -#![allow(clippy::redundant_clone)] +#![warn(clippy::implicit_clone, clippy::suspicious_to_owned)] +#![expect(clippy::redundant_clone)] use std::borrow::Cow; use std::ffi::{CStr, c_char}; diff --git a/tests/ui/suspicious_to_owned.2.fixed b/tests/ui/suspicious_to_owned.2.fixed index 841adf8ea274..203a6368d798 100644 --- a/tests/ui/suspicious_to_owned.2.fixed +++ b/tests/ui/suspicious_to_owned.2.fixed @@ -1,6 +1,5 @@ -#![warn(clippy::suspicious_to_owned)] -#![warn(clippy::implicit_clone)] -#![allow(clippy::redundant_clone)] +#![warn(clippy::implicit_clone, clippy::suspicious_to_owned)] +#![expect(clippy::redundant_clone)] use std::borrow::Cow; use std::ffi::{CStr, c_char}; diff --git a/tests/ui/suspicious_to_owned.rs b/tests/ui/suspicious_to_owned.rs index f59b3fd6ed0c..c843ff6514b6 100644 --- a/tests/ui/suspicious_to_owned.rs +++ b/tests/ui/suspicious_to_owned.rs @@ -1,6 +1,5 @@ -#![warn(clippy::suspicious_to_owned)] -#![warn(clippy::implicit_clone)] -#![allow(clippy::redundant_clone)] +#![warn(clippy::implicit_clone, clippy::suspicious_to_owned)] +#![expect(clippy::redundant_clone)] use std::borrow::Cow; use std::ffi::{CStr, c_char}; diff --git a/tests/ui/suspicious_to_owned.stderr b/tests/ui/suspicious_to_owned.stderr index 5fda1ed1cc9c..ae6cbfeb94dd 100644 --- a/tests/ui/suspicious_to_owned.stderr +++ b/tests/ui/suspicious_to_owned.stderr @@ -1,5 +1,5 @@ error: this `to_owned` call clones the `Cow<'_, str>` itself and does not cause its contents to become owned - --> tests/ui/suspicious_to_owned.rs:16:13 + --> tests/ui/suspicious_to_owned.rs:15:13 | LL | let _ = cow.to_owned(); | ^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL + let _ = cow.clone(); | error: this `to_owned` call clones the `Cow<'_, [char; 3]>` itself and does not cause its contents to become owned - --> tests/ui/suspicious_to_owned.rs:28:13 + --> tests/ui/suspicious_to_owned.rs:27:13 | LL | let _ = cow.to_owned(); | ^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL + let _ = cow.clone(); | error: this `to_owned` call clones the `Cow<'_, Vec>` itself and does not cause its contents to become owned - --> tests/ui/suspicious_to_owned.rs:40:13 + --> tests/ui/suspicious_to_owned.rs:39:13 | LL | let _ = cow.to_owned(); | ^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + let _ = cow.clone(); | error: this `to_owned` call clones the `Cow<'_, str>` itself and does not cause its contents to become owned - --> tests/ui/suspicious_to_owned.rs:52:13 + --> tests/ui/suspicious_to_owned.rs:51:13 | LL | let _ = cow.to_owned(); | ^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL + let _ = cow.clone(); | error: implicitly cloning a `String` by calling `to_owned` on its dereferenced type - --> tests/ui/suspicious_to_owned.rs:68:13 + --> tests/ui/suspicious_to_owned.rs:67:13 | LL | let _ = String::from(moo).to_owned(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `String::from(moo).clone()` @@ -74,7 +74,7 @@ LL | let _ = String::from(moo).to_owned(); = help: to override `-D warnings` add `#[allow(clippy::implicit_clone)]` error: implicitly cloning a `Vec` by calling `to_owned` on its dereferenced type - --> tests/ui/suspicious_to_owned.rs:71:13 + --> tests/ui/suspicious_to_owned.rs:70:13 | LL | let _ = moos_vec.to_owned(); | ^^^^^^^^^^^^^^^^^^^ help: consider using: `moos_vec.clone()` diff --git a/tests/ui/suspicious_unary_op_formatting.rs b/tests/ui/suspicious_unary_op_formatting.rs index 19f8b231925b..7a5d710c1459 100644 --- a/tests/ui/suspicious_unary_op_formatting.rs +++ b/tests/ui/suspicious_unary_op_formatting.rs @@ -1,5 +1,5 @@ #![warn(clippy::suspicious_unary_op_formatting)] -#![allow(clippy::needless_ifs)] +#![expect(clippy::needless_ifs)] #[rustfmt::skip] fn main() { diff --git a/tests/ui/suspicious_xor_used_as_pow.rs b/tests/ui/suspicious_xor_used_as_pow.rs index 40a8d8c366ba..55ca85480b55 100644 --- a/tests/ui/suspicious_xor_used_as_pow.rs +++ b/tests/ui/suspicious_xor_used_as_pow.rs @@ -1,6 +1,5 @@ -#![allow(unused)] #![warn(clippy::suspicious_xor_used_as_pow)] -#![allow(clippy::eq_op)] +#![expect(clippy::eq_op)] //@no-rustfix macro_rules! macro_test { () => { diff --git a/tests/ui/suspicious_xor_used_as_pow.stderr b/tests/ui/suspicious_xor_used_as_pow.stderr index efeafdb94acb..2b6570bb0adf 100644 --- a/tests/ui/suspicious_xor_used_as_pow.stderr +++ b/tests/ui/suspicious_xor_used_as_pow.stderr @@ -1,5 +1,5 @@ error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:21:13 + --> tests/ui/suspicious_xor_used_as_pow.rs:20:13 | LL | let _ = 2 ^ 5; | ^^^^^ @@ -13,7 +13,7 @@ LL + let _ = 2.pow(5); | error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:24:13 + --> tests/ui/suspicious_xor_used_as_pow.rs:23:13 | LL | let _ = 2i32 ^ 9i32; | ^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ = 2i32.pow(9i32); | error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:27:13 + --> tests/ui/suspicious_xor_used_as_pow.rs:26:13 | LL | let _ = 2i32 ^ 2i32; | ^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + let _ = 2i32.pow(2i32); | error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:30:13 + --> tests/ui/suspicious_xor_used_as_pow.rs:29:13 | LL | let _ = 50i32 ^ 3i32; | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + let _ = 50i32.pow(3i32); | error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:33:13 + --> tests/ui/suspicious_xor_used_as_pow.rs:32:13 | LL | let _ = 5i32 ^ 8i32; | ^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + let _ = 5i32.pow(8i32); | error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:36:13 + --> tests/ui/suspicious_xor_used_as_pow.rs:35:13 | LL | let _ = 2i32 ^ 32i32; | ^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + let _ = 2i32.pow(32i32); | error: `^` is not the exponentiation operator - --> tests/ui/suspicious_xor_used_as_pow.rs:13:9 + --> tests/ui/suspicious_xor_used_as_pow.rs:12:9 | LL | 1 ^ 2 // should warn even if inside macro | ^^^^^ diff --git a/tests/ui/swap.fixed b/tests/ui/swap.fixed index 0d968e96ff79..98f2d0c74603 100644 --- a/tests/ui/swap.fixed +++ b/tests/ui/swap.fixed @@ -1,12 +1,11 @@ //@aux-build: macro_rules.rs -#![allow( +#![warn(clippy::almost_swapped, clippy::manual_swap)] +#![expect( clippy::disallowed_names, - clippy::no_effect, - clippy::redundant_clone, clippy::let_and_return, - clippy::useless_vec, - clippy::redundant_locals + clippy::redundant_locals, + clippy::useless_vec )] struct Foo(u32); diff --git a/tests/ui/swap.rs b/tests/ui/swap.rs index c78c320332fb..a37753a00794 100644 --- a/tests/ui/swap.rs +++ b/tests/ui/swap.rs @@ -1,12 +1,11 @@ //@aux-build: macro_rules.rs -#![allow( +#![warn(clippy::almost_swapped, clippy::manual_swap)] +#![expect( clippy::disallowed_names, - clippy::no_effect, - clippy::redundant_clone, clippy::let_and_return, - clippy::useless_vec, - clippy::redundant_locals + clippy::redundant_locals, + clippy::useless_vec )] struct Foo(u32); diff --git a/tests/ui/swap.stderr b/tests/ui/swap.stderr index e730be40e349..1fd1737d7aaf 100644 --- a/tests/ui/swap.stderr +++ b/tests/ui/swap.stderr @@ -1,5 +1,5 @@ error: this looks like you are swapping `bar.a` and `bar.b` manually - --> tests/ui/swap.rs:23:5 + --> tests/ui/swap.rs:22:5 | LL | / let temp = bar.a; LL | | @@ -12,7 +12,7 @@ LL | | bar.b = temp; = help: to override `-D warnings` add `#[allow(clippy::manual_swap)]` error: this looks like you are swapping elements of `foo` manually - --> tests/ui/swap.rs:36:5 + --> tests/ui/swap.rs:35:5 | LL | / let temp = foo[0]; LL | | @@ -21,7 +21,7 @@ LL | | foo[1] = temp; | |__________________^ help: try: `foo.swap(0, 1);` error: this looks like you are swapping elements of `foo` manually - --> tests/ui/swap.rs:46:5 + --> tests/ui/swap.rs:45:5 | LL | / let temp = foo[0]; LL | | @@ -30,7 +30,7 @@ LL | | foo[1] = temp; | |__________________^ help: try: `foo.swap(0, 1);` error: this looks like you are swapping elements of `foo` manually - --> tests/ui/swap.rs:66:5 + --> tests/ui/swap.rs:65:5 | LL | / let temp = foo[0]; LL | | @@ -39,7 +39,7 @@ LL | | foo[1] = temp; | |__________________^ help: try: `foo.swap(0, 1);` error: this looks like you are swapping `a` and `b` manually - --> tests/ui/swap.rs:78:5 + --> tests/ui/swap.rs:77:5 | LL | / a ^= b; LL | | @@ -48,7 +48,7 @@ LL | | a ^= b; | |___________^ help: try: `std::mem::swap(&mut a, &mut b);` error: this looks like you are swapping `bar.a` and `bar.b` manually - --> tests/ui/swap.rs:87:5 + --> tests/ui/swap.rs:86:5 | LL | / bar.a ^= bar.b; LL | | @@ -57,7 +57,7 @@ LL | | bar.a ^= bar.b; | |___________________^ help: try: `std::mem::swap(&mut bar.a, &mut bar.b);` error: this looks like you are swapping elements of `foo` manually - --> tests/ui/swap.rs:96:5 + --> tests/ui/swap.rs:95:5 | LL | / foo[0] ^= foo[1]; LL | | @@ -66,7 +66,7 @@ LL | | foo[0] ^= foo[1]; | |_____________________^ help: try: `foo.swap(0, 1);` error: this looks like you are swapping `foo[0][1]` and `bar[1][0]` manually - --> tests/ui/swap.rs:126:5 + --> tests/ui/swap.rs:125:5 | LL | / let temp = foo[0][1]; LL | | @@ -77,7 +77,7 @@ LL | | bar[1][0] = temp; = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `a` and `b` manually - --> tests/ui/swap.rs:142:7 + --> tests/ui/swap.rs:141:7 | LL | ; let t = a; | _______^ @@ -89,7 +89,7 @@ LL | | b = t; = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `c.0` and `a` manually - --> tests/ui/swap.rs:153:7 + --> tests/ui/swap.rs:152:7 | LL | ; let t = c.0; | _______^ @@ -101,7 +101,7 @@ LL | | a = t; = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `b` and `a` manually - --> tests/ui/swap.rs:183:5 + --> tests/ui/swap.rs:182:5 | LL | / let t = b; LL | | @@ -112,7 +112,7 @@ LL | | a = t; = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> tests/ui/swap.rs:138:5 + --> tests/ui/swap.rs:137:5 | LL | / a = b; LL | | @@ -120,10 +120,11 @@ LL | | b = a; | |_________^ help: try: `std::mem::swap(&mut a, &mut b)` | = note: or maybe you should use `std::mem::replace`? - = note: `#[deny(clippy::almost_swapped)]` on by default + = note: `-D clippy::almost-swapped` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::almost_swapped)]` error: this looks like you are trying to swap `c.0` and `a` - --> tests/ui/swap.rs:149:5 + --> tests/ui/swap.rs:148:5 | LL | / c.0 = a; LL | | @@ -133,7 +134,7 @@ LL | | a = c.0; = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> tests/ui/swap.rs:158:5 + --> tests/ui/swap.rs:157:5 | LL | / let a = b; LL | | @@ -143,7 +144,7 @@ LL | | let b = a; = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `d` and `c` - --> tests/ui/swap.rs:164:5 + --> tests/ui/swap.rs:163:5 | LL | / d = c; LL | | @@ -153,7 +154,7 @@ LL | | c = d; = note: or maybe you should use `std::mem::replace`? error: this looks like you are trying to swap `a` and `b` - --> tests/ui/swap.rs:169:5 + --> tests/ui/swap.rs:168:5 | LL | / let a = b; LL | | @@ -163,7 +164,7 @@ LL | | b = a; = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping `s.0.x` and `s.0.y` manually - --> tests/ui/swap.rs:219:5 + --> tests/ui/swap.rs:218:5 | LL | / let t = s.0.x; LL | | @@ -174,7 +175,7 @@ LL | | s.0.y = t; = note: or maybe you should use `std::mem::replace`? error: this looks like you are swapping elements of `test_slice!(foo)` manually - --> tests/ui/swap.rs:253:5 + --> tests/ui/swap.rs:252:5 | LL | / let temp = test_slice!(foo)[0]; LL | | From f6e7838964ccb44c855524e061cf4304066621b5 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 07/11] Attributes cleanup in tests [18/20] --- tests/ui/temporary_assignment.rs | 1 - tests/ui/temporary_assignment.stderr | 8 +- tests/ui/tests_outside_test_module.rs | 1 - tests/ui/tests_outside_test_module.stderr | 2 +- tests/ui/toplevel_ref_arg.fixed | 2 +- tests/ui/toplevel_ref_arg.rs | 2 +- tests/ui/toplevel_ref_arg_non_rustfix.rs | 1 - tests/ui/toplevel_ref_arg_non_rustfix.stderr | 4 +- tests/ui/trailing_empty_array.rs | 2 +- tests/ui/trailing_zeros.fixed | 1 - tests/ui/trailing_zeros.rs | 1 - tests/ui/trailing_zeros.stderr | 4 +- tests/ui/trait_duplication_in_bounds.fixed | 3 +- tests/ui/trait_duplication_in_bounds.rs | 3 +- tests/ui/trait_duplication_in_bounds.stderr | 29 ++-- .../trait_duplication_in_bounds_unfixable.rs | 4 +- ...ait_duplication_in_bounds_unfixable.stderr | 7 +- tests/ui/transmute.rs | 17 +- tests/ui/transmute.stderr | 34 ++-- tests/ui/transmute_collection.rs | 2 +- tests/ui/transmute_int_to_non_zero.fixed | 1 - tests/ui/transmute_int_to_non_zero.rs | 1 - tests/ui/transmute_int_to_non_zero.stderr | 20 +-- tests/ui/transmute_null_to_fn.rs | 4 +- tests/ui/transmute_null_to_fn.stderr | 12 +- tests/ui/transmute_ptr_to_ptr.fixed | 1 - tests/ui/transmute_ptr_to_ptr.rs | 1 - tests/ui/transmute_ptr_to_ptr.stderr | 40 ++--- tests/ui/transmute_ptr_to_ref.fixed | 6 +- tests/ui/transmute_ptr_to_ref.rs | 6 +- tests/ui/transmute_ptr_to_ref.stderr | 82 +++++----- tests/ui/transmute_ref_to_ref.fixed | 4 +- tests/ui/transmute_ref_to_ref.rs | 4 +- tests/ui/transmute_ref_to_ref.stderr | 7 +- tests/ui/transmute_ref_to_ref_no_std.fixed | 4 +- tests/ui/transmute_ref_to_ref_no_std.rs | 4 +- tests/ui/transmute_ref_to_ref_no_std.stderr | 7 +- tests/ui/transmute_undefined_repr.rs | 7 +- tests/ui/transmute_undefined_repr.stderr | 24 +-- .../transmutes_expressible_as_ptr_casts.fixed | 12 +- .../ui/transmutes_expressible_as_ptr_casts.rs | 12 +- ...transmutes_expressible_as_ptr_casts.stderr | 18 +-- tests/ui/transmuting_null.rs | 5 +- tests/ui/transmuting_null.stderr | 16 +- tests/ui/trim_split_whitespace.fixed | 3 +- tests/ui/trim_split_whitespace.rs | 3 +- tests/ui/trim_split_whitespace.stderr | 16 +- tests/ui/trivially_copy_pass_by_ref.fixed | 12 +- tests/ui/trivially_copy_pass_by_ref.rs | 12 +- tests/ui/trivially_copy_pass_by_ref.stderr | 43 +++-- tests/ui/try_err.fixed | 8 +- tests/ui/try_err.rs | 8 +- tests/ui/try_err.stderr | 29 ++-- tests/ui/tuple_array_conversions.rs | 2 +- tests/ui/type_complexity.rs | 2 +- tests/ui/type_repetition_in_bounds.rs | 8 +- tests/ui/type_repetition_in_bounds.stderr | 21 ++- tests/ui/unconditional_recursion.rs | 6 +- tests/ui/unicode.fixed | 5 +- tests/ui/unicode.rs | 5 +- tests/ui/unicode.stderr | 20 +-- tests/ui/uninhabited_references.rs | 1 - tests/ui/uninhabited_references.stderr | 8 +- tests/ui/uninit.rs | 3 +- tests/ui/uninit.stderr | 9 +- tests/ui/uninlined_format_args.fixed | 5 +- tests/ui/uninlined_format_args.rs | 5 +- tests/ui/uninlined_format_args.stderr | 150 +++++++++--------- ...nlined_format_args_panic.edition2018.fixed | 1 - ...lined_format_args_panic.edition2018.stderr | 2 +- ...nlined_format_args_panic.edition2021.fixed | 1 - ...lined_format_args_panic.edition2021.stderr | 18 +-- ...nlined_format_args_panic.edition2024.fixed | 1 - ...lined_format_args_panic.edition2024.stderr | 18 +-- tests/ui/uninlined_format_args_panic.rs | 1 - tests/ui/unit_arg.rs | 10 +- tests/ui/unit_arg.stderr | 26 +-- tests/ui/unit_arg_fixable.fixed | 2 - tests/ui/unit_arg_fixable.rs | 2 - tests/ui/unit_arg_fixable.stderr | 20 +-- tests/ui/unit_cmp.rs | 7 +- tests/ui/unit_cmp.stderr | 16 +- tests/ui/unit_hash.fixed | 1 - tests/ui/unit_hash.rs | 1 - tests/ui/unit_hash.stderr | 6 +- tests/ui/unit_return_expecting_ord.rs | 3 +- tests/ui/unit_return_expecting_ord.stderr | 12 +- tests/ui/unnecessary_cast.fixed | 10 +- tests/ui/unnecessary_cast.rs | 10 +- tests/ui/unnecessary_cast.stderr | 100 ++++++------ tests/ui/unnecessary_clippy_cfg.rs | 2 +- tests/ui/unnecessary_filter_map.rs | 4 +- tests/ui/unnecessary_filter_map.stderr | 10 +- 93 files changed, 491 insertions(+), 603 deletions(-) diff --git a/tests/ui/temporary_assignment.rs b/tests/ui/temporary_assignment.rs index ac9ed5d05f8f..fae3be08b49e 100644 --- a/tests/ui/temporary_assignment.rs +++ b/tests/ui/temporary_assignment.rs @@ -1,5 +1,4 @@ #![warn(clippy::temporary_assignment)] -#![allow(clippy::needless_lifetimes)] use std::ops::{Deref, DerefMut}; diff --git a/tests/ui/temporary_assignment.stderr b/tests/ui/temporary_assignment.stderr index 5f6a54003630..7f8c859110c7 100644 --- a/tests/ui/temporary_assignment.stderr +++ b/tests/ui/temporary_assignment.stderr @@ -1,5 +1,5 @@ error: assignment to temporary - --> tests/ui/temporary_assignment.rs:48:5 + --> tests/ui/temporary_assignment.rs:47:5 | LL | Struct { field: 0 }.field = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | Struct { field: 0 }.field = 1; = help: to override `-D warnings` add `#[allow(clippy::temporary_assignment)]` error: assignment to temporary - --> tests/ui/temporary_assignment.rs:51:5 + --> tests/ui/temporary_assignment.rs:50:5 | LL | / MultiStruct { LL | | @@ -18,13 +18,13 @@ LL | | .field = 1; | |______________^ error: assignment to temporary - --> tests/ui/temporary_assignment.rs:57:5 + --> tests/ui/temporary_assignment.rs:56:5 | LL | ArrayStruct { array: [0] }.array[0] = 1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: assignment to temporary - --> tests/ui/temporary_assignment.rs:60:5 + --> tests/ui/temporary_assignment.rs:59:5 | LL | (0, 0).0 = 1; | ^^^^^^^^^^^^ diff --git a/tests/ui/tests_outside_test_module.rs b/tests/ui/tests_outside_test_module.rs index 35126c46af08..0088cbd920e9 100644 --- a/tests/ui/tests_outside_test_module.rs +++ b/tests/ui/tests_outside_test_module.rs @@ -1,5 +1,4 @@ //@require-annotations-for-level: WARN -#![allow(unused)] #![warn(clippy::tests_outside_test_module)] fn main() { diff --git a/tests/ui/tests_outside_test_module.stderr b/tests/ui/tests_outside_test_module.stderr index 8602a63cc7a4..09feae6bf2aa 100644 --- a/tests/ui/tests_outside_test_module.stderr +++ b/tests/ui/tests_outside_test_module.stderr @@ -1,5 +1,5 @@ error: this function marked with #[test] is outside a #[cfg(test)] module - --> tests/ui/tests_outside_test_module.rs:11:1 + --> tests/ui/tests_outside_test_module.rs:10:1 | LL | fn my_test() {} | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/toplevel_ref_arg.fixed b/tests/ui/toplevel_ref_arg.fixed index 11d4eaaefda0..d143a3cd625c 100644 --- a/tests/ui/toplevel_ref_arg.fixed +++ b/tests/ui/toplevel_ref_arg.fixed @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::toplevel_ref_arg)] -#![allow(clippy::uninlined_format_args, unused, clippy::useless_vec)] +#![expect(clippy::uninlined_format_args, clippy::useless_vec)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/toplevel_ref_arg.rs b/tests/ui/toplevel_ref_arg.rs index 957dd542f5a9..73d7b736f8a2 100644 --- a/tests/ui/toplevel_ref_arg.rs +++ b/tests/ui/toplevel_ref_arg.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::toplevel_ref_arg)] -#![allow(clippy::uninlined_format_args, unused, clippy::useless_vec)] +#![expect(clippy::uninlined_format_args, clippy::useless_vec)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/toplevel_ref_arg_non_rustfix.rs b/tests/ui/toplevel_ref_arg_non_rustfix.rs index 87c84a7ee14a..33f33d287a15 100644 --- a/tests/ui/toplevel_ref_arg_non_rustfix.rs +++ b/tests/ui/toplevel_ref_arg_non_rustfix.rs @@ -1,7 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::toplevel_ref_arg)] -#![allow(unused)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/toplevel_ref_arg_non_rustfix.stderr b/tests/ui/toplevel_ref_arg_non_rustfix.stderr index e17b2536874e..828919b59ce2 100644 --- a/tests/ui/toplevel_ref_arg_non_rustfix.stderr +++ b/tests/ui/toplevel_ref_arg_non_rustfix.stderr @@ -1,5 +1,5 @@ error: `ref` directly on a function parameter does not prevent taking ownership of the passed argument. Consider using a reference type instead - --> tests/ui/toplevel_ref_arg_non_rustfix.rs:9:15 + --> tests/ui/toplevel_ref_arg_non_rustfix.rs:8:15 | LL | fn the_answer(ref mut x: u8) { | ^^^^^^^^^ @@ -8,7 +8,7 @@ LL | fn the_answer(ref mut x: u8) { = help: to override `-D warnings` add `#[allow(clippy::toplevel_ref_arg)]` error: `ref` directly on a function parameter does not prevent taking ownership of the passed argument. Consider using a reference type instead - --> tests/ui/toplevel_ref_arg_non_rustfix.rs:21:24 + --> tests/ui/toplevel_ref_arg_non_rustfix.rs:20:24 | LL | fn fun_example(ref _x: usize) {} | ^^^^^^ diff --git a/tests/ui/trailing_empty_array.rs b/tests/ui/trailing_empty_array.rs index a8c3ffdb0dab..c0ee31e55f60 100644 --- a/tests/ui/trailing_empty_array.rs +++ b/tests/ui/trailing_empty_array.rs @@ -1,5 +1,5 @@ #![warn(clippy::trailing_empty_array)] -#![allow(clippy::repr_packed_without_abi)] +#![expect(clippy::repr_packed_without_abi)] // Do lint: diff --git a/tests/ui/trailing_zeros.fixed b/tests/ui/trailing_zeros.fixed index 8c30b062fb18..cd4cd0f8cacb 100644 --- a/tests/ui/trailing_zeros.fixed +++ b/tests/ui/trailing_zeros.fixed @@ -1,4 +1,3 @@ -#![allow(unused_parens)] #![warn(clippy::verbose_bit_mask)] fn main() { diff --git a/tests/ui/trailing_zeros.rs b/tests/ui/trailing_zeros.rs index 369a31557392..c5038b612f6d 100644 --- a/tests/ui/trailing_zeros.rs +++ b/tests/ui/trailing_zeros.rs @@ -1,4 +1,3 @@ -#![allow(unused_parens)] #![warn(clippy::verbose_bit_mask)] fn main() { diff --git a/tests/ui/trailing_zeros.stderr b/tests/ui/trailing_zeros.stderr index 6f3e7aa1d762..de951e2e75a2 100644 --- a/tests/ui/trailing_zeros.stderr +++ b/tests/ui/trailing_zeros.stderr @@ -1,5 +1,5 @@ error: bit mask could be simplified with a call to `trailing_zeros` - --> tests/ui/trailing_zeros.rs:6:13 + --> tests/ui/trailing_zeros.rs:5:13 | LL | let _ = (x & 0b1111 == 0); | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4` @@ -8,7 +8,7 @@ LL | let _ = (x & 0b1111 == 0); = help: to override `-D warnings` add `#[allow(clippy::verbose_bit_mask)]` error: bit mask could be simplified with a call to `trailing_zeros` - --> tests/ui/trailing_zeros.rs:9:13 + --> tests/ui/trailing_zeros.rs:8:13 | LL | let _ = x & 0b1_1111 == 0; | ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 5` diff --git a/tests/ui/trait_duplication_in_bounds.fixed b/tests/ui/trait_duplication_in_bounds.fixed index 959f5db11265..658880e81e2e 100644 --- a/tests/ui/trait_duplication_in_bounds.fixed +++ b/tests/ui/trait_duplication_in_bounds.fixed @@ -1,5 +1,4 @@ -#![deny(clippy::trait_duplication_in_bounds)] -#![allow(unused)] +#![warn(clippy::trait_duplication_in_bounds)] #![feature(const_trait_impl)] use std::any::Any; diff --git a/tests/ui/trait_duplication_in_bounds.rs b/tests/ui/trait_duplication_in_bounds.rs index 9bfecf40fc03..046a8ad8e597 100644 --- a/tests/ui/trait_duplication_in_bounds.rs +++ b/tests/ui/trait_duplication_in_bounds.rs @@ -1,5 +1,4 @@ -#![deny(clippy::trait_duplication_in_bounds)] -#![allow(unused)] +#![warn(clippy::trait_duplication_in_bounds)] #![feature(const_trait_impl)] use std::any::Any; diff --git a/tests/ui/trait_duplication_in_bounds.stderr b/tests/ui/trait_duplication_in_bounds.stderr index 93488ea8e74d..fb3887d22517 100644 --- a/tests/ui/trait_duplication_in_bounds.stderr +++ b/tests/ui/trait_duplication_in_bounds.stderr @@ -1,71 +1,68 @@ error: these bounds contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:7:15 + --> tests/ui/trait_duplication_in_bounds.rs:6:15 | LL | fn bad_foo(arg0: T, argo1: U) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` | -note: the lint level is defined here - --> tests/ui/trait_duplication_in_bounds.rs:1:9 - | -LL | #![deny(clippy::trait_duplication_in_bounds)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::trait-duplication-in-bounds` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::trait_duplication_in_bounds)]` error: these where clauses contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:14:8 + --> tests/ui/trait_duplication_in_bounds.rs:13:8 | LL | T: Clone + Clone + Clone + Copy, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: these bounds contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:43:26 + --> tests/ui/trait_duplication_in_bounds.rs:42:26 | LL | trait BadSelfTraitBound: Clone + Clone + Clone { | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone` error: these where clauses contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:51:15 + --> tests/ui/trait_duplication_in_bounds.rs:50:15 | LL | Self: Clone + Clone + Clone; | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone` error: these bounds contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:66:24 + --> tests/ui/trait_duplication_in_bounds.rs:65:24 | LL | trait BadTraitBound { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: these where clauses contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:74:12 + --> tests/ui/trait_duplication_in_bounds.rs:73:12 | LL | T: Clone + Clone + Clone + Copy, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: these bounds contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:108:19 + --> tests/ui/trait_duplication_in_bounds.rs:107:19 | LL | fn bad_generic + GenericTrait + GenericTrait>(arg0: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `GenericTrait + GenericTrait` error: these bounds contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:117:22 + --> tests/ui/trait_duplication_in_bounds.rs:116:22 | LL | fn qualified_path(arg0: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::clone::Clone + foo::Clone` error: this trait bound is already specified in trait declaration - --> tests/ui/trait_duplication_in_bounds.rs:126:33 + --> tests/ui/trait_duplication_in_bounds.rs:125:33 | LL | fn bad_trait_object(arg0: &(dyn Any + Send + Send)) { | ^^^^^^^^^^^^^^^^^ help: try: `Any + Send` error: these bounds contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:173:36 + --> tests/ui/trait_duplication_in_bounds.rs:172:36 | LL | const fn const_trait_bounds_bad() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[const] ConstTrait` error: these where clauses contain repeated elements - --> tests/ui/trait_duplication_in_bounds.rs:180:8 + --> tests/ui/trait_duplication_in_bounds.rs:179:8 | LL | T: IntoIterator + IntoIterator, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `IntoIterator` diff --git a/tests/ui/trait_duplication_in_bounds_unfixable.rs b/tests/ui/trait_duplication_in_bounds_unfixable.rs index cf72ed844a78..a519fb3651ef 100644 --- a/tests/ui/trait_duplication_in_bounds_unfixable.rs +++ b/tests/ui/trait_duplication_in_bounds_unfixable.rs @@ -1,5 +1,5 @@ -#![deny(clippy::trait_duplication_in_bounds)] -#![allow(clippy::multiple_bound_locations)] +#![warn(clippy::trait_duplication_in_bounds)] +#![expect(clippy::multiple_bound_locations)] use std::collections::BTreeMap; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; diff --git a/tests/ui/trait_duplication_in_bounds_unfixable.stderr b/tests/ui/trait_duplication_in_bounds_unfixable.stderr index 546d39518e1f..2a6c82efa92d 100644 --- a/tests/ui/trait_duplication_in_bounds_unfixable.stderr +++ b/tests/ui/trait_duplication_in_bounds_unfixable.stderr @@ -5,11 +5,8 @@ LL | fn bad_foo(arg0: T, arg1: Z) | ^^^^^ | = help: consider removing this trait bound -note: the lint level is defined here - --> tests/ui/trait_duplication_in_bounds_unfixable.rs:1:9 - | -LL | #![deny(clippy::trait_duplication_in_bounds)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::trait-duplication-in-bounds` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::trait_duplication_in_bounds)]` error: this trait bound is already specified in the where clause --> tests/ui/trait_duplication_in_bounds_unfixable.rs:7:23 diff --git a/tests/ui/transmute.rs b/tests/ui/transmute.rs index afb79deac20f..36d794cedea1 100644 --- a/tests/ui/transmute.rs +++ b/tests/ui/transmute.rs @@ -1,13 +1,12 @@ #![feature(f128)] #![feature(f16)] -#![allow( - dead_code, - clippy::borrow_as_ptr, - unnecessary_transmutes, - integer_to_ptr_transmutes, - clippy::needless_lifetimes, - clippy::missing_transmute_annotations +#![warn( + clippy::crosspointer_transmute, + clippy::transmute_bytes_to_str, + clippy::transmute_int_to_bool, + clippy::useless_transmute )] +#![expect(integer_to_ptr_transmutes, clippy::needless_lifetimes)] //@no-rustfix extern crate core; @@ -23,7 +22,6 @@ fn my_vec() -> MyVec { } #[allow(clippy::needless_lifetimes, clippy::transmute_ptr_to_ptr)] -#[warn(clippy::useless_transmute)] unsafe fn _generic<'a, T, U: 'a>(t: &'a T) { unsafe { // FIXME: should lint @@ -42,7 +40,6 @@ unsafe fn _generic<'a, T, U: 'a>(t: &'a T) { } } -#[warn(clippy::useless_transmute)] fn useless() { unsafe { let _: Vec = core::mem::transmute(my_vec()); @@ -88,7 +85,6 @@ fn useless() { struct Usize(usize); -#[warn(clippy::crosspointer_transmute)] fn crosspointer() { let mut int: Usize = Usize(0); let int_const_ptr: *const Usize = &int as *const Usize; @@ -109,7 +105,6 @@ fn crosspointer() { } } -#[warn(clippy::transmute_int_to_bool)] fn int_to_bool() { let _: bool = unsafe { std::mem::transmute(0_u8) }; //~^ transmute_int_to_bool diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index 6f9a0b717fc9..0232d9ac04bb 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -1,5 +1,5 @@ error: transmute from a reference to a pointer - --> tests/ui/transmute.rs:34:27 + --> tests/ui/transmute.rs:32:27 | LL | let _: *const T = core::mem::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T` @@ -8,49 +8,49 @@ LL | let _: *const T = core::mem::transmute(t); = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]` error: transmute from a reference to a pointer - --> tests/ui/transmute.rs:37:25 + --> tests/ui/transmute.rs:35:25 | LL | let _: *mut T = core::mem::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T` error: transmute from a reference to a pointer - --> tests/ui/transmute.rs:40:27 + --> tests/ui/transmute.rs:38:27 | LL | let _: *const U = core::mem::transmute(t); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U` error: transmute from a type (`std::vec::Vec`) to itself - --> tests/ui/transmute.rs:48:27 + --> tests/ui/transmute.rs:45:27 | LL | let _: Vec = core::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> tests/ui/transmute.rs:51:27 + --> tests/ui/transmute.rs:48:27 | LL | let _: Vec = core::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> tests/ui/transmute.rs:54:27 + --> tests/ui/transmute.rs:51:27 | LL | let _: Vec = std::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> tests/ui/transmute.rs:57:27 + --> tests/ui/transmute.rs:54:27 | LL | let _: Vec = std::mem::transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`std::vec::Vec`) to itself - --> tests/ui/transmute.rs:60:27 + --> tests/ui/transmute.rs:57:27 | LL | let _: Vec = my_transmute(my_vec()); | ^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`) - --> tests/ui/transmute.rs:98:24 + --> tests/ui/transmute.rs:94:24 | LL | let _: Usize = core::mem::transmute(int_const_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,25 +59,25 @@ LL | let _: Usize = core::mem::transmute(int_const_ptr); = help: to override `-D warnings` add `#[allow(clippy::crosspointer_transmute)]` error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`) - --> tests/ui/transmute.rs:101:24 + --> tests/ui/transmute.rs:97:24 | LL | let _: Usize = core::mem::transmute(int_mut_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`) - --> tests/ui/transmute.rs:104:31 + --> tests/ui/transmute.rs:100:31 | LL | let _: *const Usize = core::mem::transmute(my_int()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`) - --> tests/ui/transmute.rs:107:29 + --> tests/ui/transmute.rs:103:29 | LL | let _: *mut Usize = core::mem::transmute(my_int()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from a `u8` to a `bool` - --> tests/ui/transmute.rs:114:28 + --> tests/ui/transmute.rs:109:28 | LL | let _: bool = unsafe { std::mem::transmute(0_u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0` @@ -86,7 +86,7 @@ LL | let _: bool = unsafe { std::mem::transmute(0_u8) }; = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_bool)]` error: transmute from a `&[u8]` to a `&str` - --> tests/ui/transmute.rs:121:28 + --> tests/ui/transmute.rs:116:28 | LL | let _: &str = unsafe { std::mem::transmute(B) }; | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(B).unwrap()` @@ -95,19 +95,19 @@ LL | let _: &str = unsafe { std::mem::transmute(B) }; = help: to override `-D warnings` add `#[allow(clippy::transmute_bytes_to_str)]` error: transmute from a `&mut [u8]` to a `&mut str` - --> tests/ui/transmute.rs:124:32 + --> tests/ui/transmute.rs:119:32 | LL | let _: &mut str = unsafe { std::mem::transmute(mb) }; | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()` error: transmute from a `&[u8]` to a `&str` - --> tests/ui/transmute.rs:127:30 + --> tests/ui/transmute.rs:122:30 | LL | const _: &str = unsafe { std::mem::transmute(B) }; | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_unchecked(B)` error: transmute from a `&[u8]` to a `&str` - --> tests/ui/transmute.rs:139:23 + --> tests/ui/transmute.rs:134:23 | LL | let _: &str = std::mem::transmute(take_ref!(b)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(take_ref!(b)).unwrap()` diff --git a/tests/ui/transmute_collection.rs b/tests/ui/transmute_collection.rs index 74d7f5e38bf8..31f62776467d 100644 --- a/tests/ui/transmute_collection.rs +++ b/tests/ui/transmute_collection.rs @@ -1,5 +1,5 @@ #![warn(clippy::unsound_collection_transmute)] -#![allow(clippy::missing_transmute_annotations)] +#![expect(clippy::missing_transmute_annotations)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; use std::mem::{MaybeUninit, transmute}; diff --git a/tests/ui/transmute_int_to_non_zero.fixed b/tests/ui/transmute_int_to_non_zero.fixed index 273090fef387..3072cd32f390 100644 --- a/tests/ui/transmute_int_to_non_zero.fixed +++ b/tests/ui/transmute_int_to_non_zero.fixed @@ -1,5 +1,4 @@ #![warn(clippy::transmute_int_to_non_zero)] -#![allow(clippy::missing_transmute_annotations)] use core::num::NonZero; diff --git a/tests/ui/transmute_int_to_non_zero.rs b/tests/ui/transmute_int_to_non_zero.rs index f27bc9b42d42..446d3e632418 100644 --- a/tests/ui/transmute_int_to_non_zero.rs +++ b/tests/ui/transmute_int_to_non_zero.rs @@ -1,5 +1,4 @@ #![warn(clippy::transmute_int_to_non_zero)] -#![allow(clippy::missing_transmute_annotations)] use core::num::NonZero; diff --git a/tests/ui/transmute_int_to_non_zero.stderr b/tests/ui/transmute_int_to_non_zero.stderr index 995ab11a5bc9..f43505c9e55f 100644 --- a/tests/ui/transmute_int_to_non_zero.stderr +++ b/tests/ui/transmute_int_to_non_zero.stderr @@ -1,5 +1,5 @@ error: transmute from a `u8` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:19:35 + --> tests/ui/transmute_int_to_non_zero.rs:18:35 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u8)` @@ -8,55 +8,55 @@ LL | let _: NonZero = unsafe { std::mem::transmute(int_u8) }; = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_non_zero)]` error: transmute from a `u16` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:22:36 + --> tests/ui/transmute_int_to_non_zero.rs:21:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u16) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u16)` error: transmute from a `u32` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:25:36 + --> tests/ui/transmute_int_to_non_zero.rs:24:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u32)` error: transmute from a `u64` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:28:36 + --> tests/ui/transmute_int_to_non_zero.rs:27:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u64) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u64)` error: transmute from a `u128` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:31:37 + --> tests/ui/transmute_int_to_non_zero.rs:30:37 | LL | let _: NonZero = unsafe { std::mem::transmute(int_u128) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_u128)` error: transmute from a `i8` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:34:35 + --> tests/ui/transmute_int_to_non_zero.rs:33:35 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i8)` error: transmute from a `i16` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:37:36 + --> tests/ui/transmute_int_to_non_zero.rs:36:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i16) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i16)` error: transmute from a `i32` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:40:36 + --> tests/ui/transmute_int_to_non_zero.rs:39:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i32)` error: transmute from a `i64` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:43:36 + --> tests/ui/transmute_int_to_non_zero.rs:42:36 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i64) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i64)` error: transmute from a `i128` to a `NonZero` - --> tests/ui/transmute_int_to_non_zero.rs:46:37 + --> tests/ui/transmute_int_to_non_zero.rs:45:37 | LL | let _: NonZero = unsafe { std::mem::transmute(int_i128) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZero::new_unchecked(int_i128)` diff --git a/tests/ui/transmute_null_to_fn.rs b/tests/ui/transmute_null_to_fn.rs index 9ce097d124ab..f7ba6b6e7805 100644 --- a/tests/ui/transmute_null_to_fn.rs +++ b/tests/ui/transmute_null_to_fn.rs @@ -1,7 +1,5 @@ -#![allow(dead_code)] #![warn(clippy::transmute_null_to_fn)] -#![allow(clippy::zero_ptr, clippy::missing_transmute_annotations)] -#![allow(clippy::manual_dangling_ptr)] +#![expect(clippy::manual_dangling_ptr, clippy::zero_ptr)] // Easy to lint because these only span one line. fn one_liners() { diff --git a/tests/ui/transmute_null_to_fn.stderr b/tests/ui/transmute_null_to_fn.stderr index b5b0d4ecc7c0..04ce23ca955a 100644 --- a/tests/ui/transmute_null_to_fn.stderr +++ b/tests/ui/transmute_null_to_fn.stderr @@ -1,5 +1,5 @@ error: transmuting a known null pointer into a function pointer - --> tests/ui/transmute_null_to_fn.rs:9:23 + --> tests/ui/transmute_null_to_fn.rs:7:23 | LL | let _: fn() = std::mem::transmute(0 as *const ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior @@ -9,7 +9,7 @@ LL | let _: fn() = std::mem::transmute(0 as *const ()); = help: to override `-D warnings` add `#[allow(clippy::transmute_null_to_fn)]` error: transmuting a known null pointer into a function pointer - --> tests/ui/transmute_null_to_fn.rs:12:23 + --> tests/ui/transmute_null_to_fn.rs:10:23 | LL | let _: fn() = std::mem::transmute(std::ptr::null::<()>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior @@ -17,7 +17,7 @@ LL | let _: fn() = std::mem::transmute(std::ptr::null::<()>()); = help: try wrapping your function pointer type in `Option` instead, and using `None` as a null pointer value error: transmuting a known null pointer into a function pointer - --> tests/ui/transmute_null_to_fn.rs:23:23 + --> tests/ui/transmute_null_to_fn.rs:21:23 | LL | let _: fn() = std::mem::transmute(ZPTR); | ^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior @@ -25,7 +25,7 @@ LL | let _: fn() = std::mem::transmute(ZPTR); = help: try wrapping your function pointer type in `Option` instead, and using `None` as a null pointer value error: transmuting a known null pointer into a function pointer - --> tests/ui/transmute_null_to_fn.rs:33:23 + --> tests/ui/transmute_null_to_fn.rs:31:23 | LL | let _: fn() = std::mem::transmute(0 as *const u8 as *const ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior @@ -33,7 +33,7 @@ LL | let _: fn() = std::mem::transmute(0 as *const u8 as *const ()); = help: try wrapping your function pointer type in `Option` instead, and using `None` as a null pointer value error: transmuting a known null pointer into a function pointer - --> tests/ui/transmute_null_to_fn.rs:36:23 + --> tests/ui/transmute_null_to_fn.rs:34:23 | LL | let _: fn() = std::mem::transmute(std::ptr::null::<()>() as *const u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior @@ -41,7 +41,7 @@ LL | let _: fn() = std::mem::transmute(std::ptr::null::<()>() as *const = help: try wrapping your function pointer type in `Option` instead, and using `None` as a null pointer value error: transmuting a known null pointer into a function pointer - --> tests/ui/transmute_null_to_fn.rs:39:23 + --> tests/ui/transmute_null_to_fn.rs:37:23 | LL | let _: fn() = std::mem::transmute(ZPTR as *const u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior diff --git a/tests/ui/transmute_ptr_to_ptr.fixed b/tests/ui/transmute_ptr_to_ptr.fixed index caba277db754..1fc0c315435b 100644 --- a/tests/ui/transmute_ptr_to_ptr.fixed +++ b/tests/ui/transmute_ptr_to_ptr.fixed @@ -1,5 +1,4 @@ #![warn(clippy::transmute_ptr_to_ptr)] -#![allow(clippy::borrow_as_ptr, clippy::missing_transmute_annotations)] use std::mem::transmute; diff --git a/tests/ui/transmute_ptr_to_ptr.rs b/tests/ui/transmute_ptr_to_ptr.rs index b3c2baf29c36..d2fc34db21f0 100644 --- a/tests/ui/transmute_ptr_to_ptr.rs +++ b/tests/ui/transmute_ptr_to_ptr.rs @@ -1,5 +1,4 @@ #![warn(clippy::transmute_ptr_to_ptr)] -#![allow(clippy::borrow_as_ptr, clippy::missing_transmute_annotations)] use std::mem::transmute; diff --git a/tests/ui/transmute_ptr_to_ptr.stderr b/tests/ui/transmute_ptr_to_ptr.stderr index ba9e6df6c2d7..aef67239eaf2 100644 --- a/tests/ui/transmute_ptr_to_ptr.stderr +++ b/tests/ui/transmute_ptr_to_ptr.stderr @@ -1,5 +1,5 @@ error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:39:29 + --> tests/ui/transmute_ptr_to_ptr.rs:38:29 | LL | let _: *const f32 = transmute(ptr); | ^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _: *const f32 = ptr.cast::(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:42:27 + --> tests/ui/transmute_ptr_to_ptr.rs:41:27 | LL | let _: *mut f32 = transmute(mut_ptr); | ^^^^^^^^^^^^^^^^^^ @@ -25,37 +25,37 @@ LL + let _: *mut f32 = mut_ptr.cast::(); | error: transmute from a reference to a reference - --> tests/ui/transmute_ptr_to_ptr.rs:46:23 + --> tests/ui/transmute_ptr_to_ptr.rs:45:23 | LL | let _: &f32 = transmute(&1u32); | ^^^^^^^^^^^^^^^^ help: try: `&*(&1u32 as *const u32 as *const f32)` error: transmute from a reference to a reference - --> tests/ui/transmute_ptr_to_ptr.rs:49:23 + --> tests/ui/transmute_ptr_to_ptr.rs:48:23 | LL | let _: &f32 = transmute(&1f64); | ^^^^^^^^^^^^^^^^ help: try: `&*(&1f64 as *const f64 as *const f32)` error: transmute from a reference to a reference - --> tests/ui/transmute_ptr_to_ptr.rs:54:27 + --> tests/ui/transmute_ptr_to_ptr.rs:53:27 | LL | let _: &mut f32 = transmute(&mut 1u32); | ^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(&mut 1u32 as *mut u32 as *mut f32)` error: transmute from a reference to a reference - --> tests/ui/transmute_ptr_to_ptr.rs:57:37 + --> tests/ui/transmute_ptr_to_ptr.rs:56:37 | LL | let _: &GenericParam = transmute(&GenericParam { t: 1u32 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam as *const GenericParam)` error: transmute from a reference to a reference - --> tests/ui/transmute_ptr_to_ptr.rs:61:27 + --> tests/ui/transmute_ptr_to_ptr.rs:60:27 | LL | let u8_ref: &u8 = transmute(u64_ref); | ^^^^^^^^^^^^^^^^^^ help: try: `&*(u64_ref as *const u64 as *const u8)` error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:64:29 + --> tests/ui/transmute_ptr_to_ptr.rs:63:29 | LL | let _: *const u32 = transmute(mut_ptr); | ^^^^^^^^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL + let _: *const u32 = mut_ptr.cast_const(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:67:27 + --> tests/ui/transmute_ptr_to_ptr.rs:66:27 | LL | let _: *mut u32 = transmute(ptr); | ^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL + let _: *mut u32 = ptr.cast_mut(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:81:29 + --> tests/ui/transmute_ptr_to_ptr.rs:80:29 | LL | let _: *const f32 = transmute(Ptr(ptr)); | ^^^^^^^^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL + let _: *const f32 = Ptr(ptr).0.cast::(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:83:29 + --> tests/ui/transmute_ptr_to_ptr.rs:82:29 | LL | let _: *const f32 = transmute(PtrNamed { ptr }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL + let _: *const f32 = PtrNamed { ptr }.ptr.cast::(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:85:27 + --> tests/ui/transmute_ptr_to_ptr.rs:84:27 | LL | let _: *mut u32 = transmute(Ptr(ptr)); | ^^^^^^^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ LL + let _: *mut u32 = Ptr(ptr).0.cast_mut(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:91:14 + --> tests/ui/transmute_ptr_to_ptr.rs:90:14 | LL | unsafe { transmute(v) } | ^^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL + unsafe { v as *const &() } | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:108:28 + --> tests/ui/transmute_ptr_to_ptr.rs:107:28 | LL | let _: *const i8 = transmute(ptr); | ^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL + let _: *const i8 = ptr as *const i8; | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:110:28 + --> tests/ui/transmute_ptr_to_ptr.rs:109:28 | LL | let _: *const i8 = transmute(Ptr8(ptr)); | ^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ LL + let _: *const i8 = Ptr8(ptr).0 as *const i8; | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:118:28 + --> tests/ui/transmute_ptr_to_ptr.rs:117:28 | LL | let _: *const i8 = transmute(ptr); | ^^^^^^^^^^^^^^ @@ -163,7 +163,7 @@ LL + let _: *const i8 = ptr.cast::(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:126:26 + --> tests/ui/transmute_ptr_to_ptr.rs:125:26 | LL | let _: *mut u8 = transmute(ptr); | ^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL + let _: *mut u8 = ptr as *mut u8; | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:128:28 + --> tests/ui/transmute_ptr_to_ptr.rs:127:28 | LL | let _: *const u8 = transmute(mut_ptr); | ^^^^^^^^^^^^^^^^^^ @@ -187,7 +187,7 @@ LL + let _: *const u8 = mut_ptr as *const u8; | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:136:26 + --> tests/ui/transmute_ptr_to_ptr.rs:135:26 | LL | let _: *mut u8 = transmute(ptr); | ^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL + let _: *mut u8 = ptr.cast_mut(); | error: transmute from a pointer to a pointer - --> tests/ui/transmute_ptr_to_ptr.rs:138:28 + --> tests/ui/transmute_ptr_to_ptr.rs:137:28 | LL | let _: *const u8 = transmute(mut_ptr); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/transmute_ptr_to_ref.fixed b/tests/ui/transmute_ptr_to_ref.fixed index 8de47031a400..2044c3b14acb 100644 --- a/tests/ui/transmute_ptr_to_ref.fixed +++ b/tests/ui/transmute_ptr_to_ref.fixed @@ -1,9 +1,5 @@ #![warn(clippy::transmute_ptr_to_ref)] -#![allow( - clippy::match_single_binding, - clippy::unnecessary_cast, - clippy::missing_transmute_annotations -)] +#![allow(clippy::missing_transmute_annotations, clippy::unnecessary_cast)] fn ptr_to_ref(p: *const T, m: *mut T, o: *const U, om: *mut U) { unsafe { diff --git a/tests/ui/transmute_ptr_to_ref.rs b/tests/ui/transmute_ptr_to_ref.rs index 52fe669de935..3982a6929cf6 100644 --- a/tests/ui/transmute_ptr_to_ref.rs +++ b/tests/ui/transmute_ptr_to_ref.rs @@ -1,9 +1,5 @@ #![warn(clippy::transmute_ptr_to_ref)] -#![allow( - clippy::match_single_binding, - clippy::unnecessary_cast, - clippy::missing_transmute_annotations -)] +#![allow(clippy::missing_transmute_annotations, clippy::unnecessary_cast)] fn ptr_to_ref(p: *const T, m: *mut T, o: *const U, om: *mut U) { unsafe { diff --git a/tests/ui/transmute_ptr_to_ref.stderr b/tests/ui/transmute_ptr_to_ref.stderr index c0f0ca916761..138eb9440544 100644 --- a/tests/ui/transmute_ptr_to_ref.stderr +++ b/tests/ui/transmute_ptr_to_ref.stderr @@ -1,5 +1,5 @@ error: transmute from a pointer type (`*const T`) to a reference type (`&T`) - --> tests/ui/transmute_ptr_to_ref.rs:10:21 + --> tests/ui/transmute_ptr_to_ref.rs:6:21 | LL | let _: &T = std::mem::transmute(p); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*p` @@ -8,241 +8,241 @@ LL | let _: &T = std::mem::transmute(p); = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ref)]` error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) - --> tests/ui/transmute_ptr_to_ref.rs:14:25 + --> tests/ui/transmute_ptr_to_ref.rs:10:25 | LL | let _: &mut T = std::mem::transmute(m); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *m` error: transmute from a pointer type (`*mut T`) to a reference type (`&T`) - --> tests/ui/transmute_ptr_to_ref.rs:18:21 + --> tests/ui/transmute_ptr_to_ref.rs:14:21 | LL | let _: &T = std::mem::transmute(m); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*m` error: transmute from a pointer type (`*mut T`) to a reference type (`&mut T`) - --> tests/ui/transmute_ptr_to_ref.rs:22:25 + --> tests/ui/transmute_ptr_to_ref.rs:18:25 | LL | let _: &mut T = std::mem::transmute(p as *mut T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(p as *mut T)` error: transmute from a pointer type (`*const U`) to a reference type (`&T`) - --> tests/ui/transmute_ptr_to_ref.rs:26:21 + --> tests/ui/transmute_ptr_to_ref.rs:22:21 | LL | let _: &T = std::mem::transmute(o); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(o as *const T)` error: transmute from a pointer type (`*mut U`) to a reference type (`&mut T`) - --> tests/ui/transmute_ptr_to_ref.rs:30:25 + --> tests/ui/transmute_ptr_to_ref.rs:26:25 | LL | let _: &mut T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&mut *(om as *mut T)` error: transmute from a pointer type (`*mut U`) to a reference type (`&T`) - --> tests/ui/transmute_ptr_to_ref.rs:34:21 + --> tests/ui/transmute_ptr_to_ref.rs:30:21 | LL | let _: &T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)` error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) - --> tests/ui/transmute_ptr_to_ref.rs:46:32 + --> tests/ui/transmute_ptr_to_ref.rs:42:32 | LL | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::>()` error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) - --> tests/ui/transmute_ptr_to_ref.rs:49:33 + --> tests/ui/transmute_ptr_to_ref.rs:45:33 | LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*raw.cast::>()` error: transmute from a pointer type (`*const i32`) to a reference type (`&u8`) - --> tests/ui/transmute_ptr_to_ref.rs:54:14 + --> tests/ui/transmute_ptr_to_ref.rs:50:14 | LL | unsafe { std::mem::transmute::<_, Bar>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const u8)` error: transmute from a pointer type (`*const u32`) to a reference type (`&i32`) - --> tests/ui/transmute_ptr_to_ref.rs:82:23 + --> tests/ui/transmute_ptr_to_ref.rs:78:23 | LL | let _: &i32 = std::mem::transmute(w); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(w.0 as *const i32)` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:84:23 + --> tests/ui/transmute_ptr_to_ref.rs:80:23 | LL | let _: &u32 = std::mem::transmute(w); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*w.0` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:86:24 + --> tests/ui/transmute_ptr_to_ref.rs:82:24 | LL | let _: &&u32 = core::mem::transmute(x); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.ptr.cast::<&u32>()` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:91:17 + --> tests/ui/transmute_ptr_to_ref.rs:87:17 | LL | let _ = std::mem::transmute::<_, &u32>(w); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*w.0.cast::()` error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&str]`) - --> tests/ui/transmute_ptr_to_ref.rs:93:26 + --> tests/ui/transmute_ptr_to_ref.rs:89:26 | LL | let _: &[&str] = core::mem::transmute(v); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(v.0 as *const [&str])` error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[i32]`) - --> tests/ui/transmute_ptr_to_ref.rs:95:17 + --> tests/ui/transmute_ptr_to_ref.rs:91:17 | LL | let _ = std::mem::transmute::<_, &[i32]>(u); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(u.0 as *const [i32])` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:97:24 + --> tests/ui/transmute_ptr_to_ref.rs:93:24 | LL | let _: &&u32 = std::mem::transmute(y); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.0.cast::<&u32>()` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:99:23 + --> tests/ui/transmute_ptr_to_ref.rs:95:23 | LL | let _: &u32 = std::mem::transmute(w + w); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(w + w).0` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:107:18 + --> tests/ui/transmute_ptr_to_ref.rs:103:18 | LL | 0 => std::mem::transmute(x), | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:109:18 + --> tests/ui/transmute_ptr_to_ref.rs:105:18 | LL | 1 => std::mem::transmute(y), | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&u32>()` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:111:18 + --> tests/ui/transmute_ptr_to_ref.rs:107:18 | LL | 2 => std::mem::transmute::<_, &&'b u32>(x), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:113:18 + --> tests/ui/transmute_ptr_to_ref.rs:109:18 | LL | _ => std::mem::transmute::<_, &&'b u32>(y), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*y.cast::<&'b u32>()` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:124:23 + --> tests/ui/transmute_ptr_to_ref.rs:120:23 | LL | let _: &u32 = std::mem::transmute(a); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:126:23 + --> tests/ui/transmute_ptr_to_ref.rs:122:23 | LL | let _: &u32 = std::mem::transmute::<_, &u32>(a); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a.cast::()` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:129:18 + --> tests/ui/transmute_ptr_to_ref.rs:125:18 | LL | 0 => std::mem::transmute(x), | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&u32>()` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:131:18 + --> tests/ui/transmute_ptr_to_ref.rs:127:18 | LL | _ => std::mem::transmute::<_, &&'b u32>(x), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*x.cast::<&'b u32>()` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:142:23 + --> tests/ui/transmute_ptr_to_ref.rs:138:23 | LL | let _: &u32 = std::mem::transmute(a); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*a` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:144:23 + --> tests/ui/transmute_ptr_to_ref.rs:140:23 | LL | let _: &u32 = std::mem::transmute::<_, &u32>(a); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a as *const u32)` error: transmute from a pointer type (`*const u32`) to a reference type (`&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:146:17 + --> tests/ui/transmute_ptr_to_ref.rs:142:17 | LL | let _ = std::mem::transmute::<_, &u32>(Ptr(a)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(Ptr(a).0 as *const u32)` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:149:18 + --> tests/ui/transmute_ptr_to_ref.rs:145:18 | LL | 0 => std::mem::transmute(x), | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &u32)` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:151:18 + --> tests/ui/transmute_ptr_to_ref.rs:147:18 | LL | 1 => std::mem::transmute::<_, &&'b u32>(x), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(x as *const () as *const &'b u32)` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:153:18 + --> tests/ui/transmute_ptr_to_ref.rs:149:18 | LL | 2 => std::mem::transmute(y), | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(y.0 as *const () as *const &u32)` error: transmute from a pointer type (`*const &u32`) to a reference type (`&&u32`) - --> tests/ui/transmute_ptr_to_ref.rs:155:18 + --> tests/ui/transmute_ptr_to_ref.rs:151:18 | LL | _ => std::mem::transmute::<_, &&'b u32>(y), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(y.0 as *const () as *const &'b u32)` error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[u32]`) - --> tests/ui/transmute_ptr_to_ref.rs:165:17 + --> tests/ui/transmute_ptr_to_ref.rs:161:17 | LL | let _ = core::mem::transmute::<_, &[u32]>(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(ptr as *const [u32])` error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[u32]`) - --> tests/ui/transmute_ptr_to_ref.rs:167:25 + --> tests/ui/transmute_ptr_to_ref.rs:163:25 | LL | let _: &[u32] = core::mem::transmute(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(ptr as *const [u32])` error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&[u8]]`) - --> tests/ui/transmute_ptr_to_ref.rs:171:17 + --> tests/ui/transmute_ptr_to_ref.rs:167:17 | LL | let _ = core::mem::transmute::<_, &[&[u8]]>(a_s_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&[u8]])` error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&[u8]]`) - --> tests/ui/transmute_ptr_to_ref.rs:173:27 + --> tests/ui/transmute_ptr_to_ref.rs:169:27 | LL | let _: &[&[u8]] = core::mem::transmute(a_s_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&[u8]])` error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[i32]`) - --> tests/ui/transmute_ptr_to_ref.rs:177:17 + --> tests/ui/transmute_ptr_to_ref.rs:173:17 | LL | let _ = core::mem::transmute::<_, &[i32]>(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(ptr as *const [i32])` error: transmute from a pointer type (`*const [i32]`) to a reference type (`&[i32]`) - --> tests/ui/transmute_ptr_to_ref.rs:179:25 + --> tests/ui/transmute_ptr_to_ref.rs:175:25 | LL | let _: &[i32] = core::mem::transmute(ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*ptr` error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&str]`) - --> tests/ui/transmute_ptr_to_ref.rs:183:17 + --> tests/ui/transmute_ptr_to_ref.rs:179:17 | LL | let _ = core::mem::transmute::<_, &[&str]>(a_s_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&str])` error: transmute from a pointer type (`*const [&str]`) to a reference type (`&[&str]`) - --> tests/ui/transmute_ptr_to_ref.rs:185:26 + --> tests/ui/transmute_ptr_to_ref.rs:181:26 | LL | let _: &[&str] = core::mem::transmute(a_s_ptr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(a_s_ptr as *const [&str])` diff --git a/tests/ui/transmute_ref_to_ref.fixed b/tests/ui/transmute_ref_to_ref.fixed index 0ec59ea810ae..e369e18d77ec 100644 --- a/tests/ui/transmute_ref_to_ref.fixed +++ b/tests/ui/transmute_ref_to_ref.fixed @@ -1,5 +1,5 @@ -#![deny(clippy::transmute_ptr_to_ptr)] -#![allow(dead_code, clippy::missing_transmute_annotations, clippy::cast_slice_different_sizes)] +#![warn(clippy::transmute_ptr_to_ptr)] +#![allow(clippy::cast_slice_different_sizes)] fn main() { unsafe { diff --git a/tests/ui/transmute_ref_to_ref.rs b/tests/ui/transmute_ref_to_ref.rs index 78f3d1fe0bb2..35177b40fbca 100644 --- a/tests/ui/transmute_ref_to_ref.rs +++ b/tests/ui/transmute_ref_to_ref.rs @@ -1,5 +1,5 @@ -#![deny(clippy::transmute_ptr_to_ptr)] -#![allow(dead_code, clippy::missing_transmute_annotations, clippy::cast_slice_different_sizes)] +#![warn(clippy::transmute_ptr_to_ptr)] +#![allow(clippy::cast_slice_different_sizes)] fn main() { unsafe { diff --git a/tests/ui/transmute_ref_to_ref.stderr b/tests/ui/transmute_ref_to_ref.stderr index 13ee64574f7b..222a5d7e8071 100644 --- a/tests/ui/transmute_ref_to_ref.stderr +++ b/tests/ui/transmute_ref_to_ref.stderr @@ -4,11 +4,8 @@ error: transmute from a reference to a reference LL | let bools: &[bool] = unsafe { std::mem::transmute(single_u64) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(single_u64 as *const [u64] as *const [bool])` | -note: the lint level is defined here - --> tests/ui/transmute_ref_to_ref.rs:1:9 - | -LL | #![deny(clippy::transmute_ptr_to_ptr)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]` error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref.rs:11:33 diff --git a/tests/ui/transmute_ref_to_ref_no_std.fixed b/tests/ui/transmute_ref_to_ref_no_std.fixed index 3a1c75f16854..319d305b5c1c 100644 --- a/tests/ui/transmute_ref_to_ref_no_std.fixed +++ b/tests/ui/transmute_ref_to_ref_no_std.fixed @@ -1,5 +1,5 @@ -#![deny(clippy::transmute_ptr_to_ptr)] -#![allow(dead_code, clippy::missing_transmute_annotations, clippy::cast_slice_different_sizes)] +#![warn(clippy::transmute_ptr_to_ptr)] +#![allow(clippy::cast_slice_different_sizes)] #![feature(lang_items)] #![no_std] diff --git a/tests/ui/transmute_ref_to_ref_no_std.rs b/tests/ui/transmute_ref_to_ref_no_std.rs index 7ed885bbbb07..1f6d01b7e6eb 100644 --- a/tests/ui/transmute_ref_to_ref_no_std.rs +++ b/tests/ui/transmute_ref_to_ref_no_std.rs @@ -1,5 +1,5 @@ -#![deny(clippy::transmute_ptr_to_ptr)] -#![allow(dead_code, clippy::missing_transmute_annotations, clippy::cast_slice_different_sizes)] +#![warn(clippy::transmute_ptr_to_ptr)] +#![allow(clippy::cast_slice_different_sizes)] #![feature(lang_items)] #![no_std] diff --git a/tests/ui/transmute_ref_to_ref_no_std.stderr b/tests/ui/transmute_ref_to_ref_no_std.stderr index 136a9b21fb9e..7c9b37f319cc 100644 --- a/tests/ui/transmute_ref_to_ref_no_std.stderr +++ b/tests/ui/transmute_ref_to_ref_no_std.stderr @@ -4,11 +4,8 @@ error: transmute from a reference to a reference LL | let bools: &[bool] = unsafe { core::mem::transmute(single_u64) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(single_u64 as *const [u64] as *const [bool])` | -note: the lint level is defined here - --> tests/ui/transmute_ref_to_ref_no_std.rs:1:9 - | -LL | #![deny(clippy::transmute_ptr_to_ptr)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]` error: transmute from a reference to a reference --> tests/ui/transmute_ref_to_ref_no_std.rs:23:33 diff --git a/tests/ui/transmute_undefined_repr.rs b/tests/ui/transmute_undefined_repr.rs index a449d6a4302f..4a92f24af7ce 100644 --- a/tests/ui/transmute_undefined_repr.rs +++ b/tests/ui/transmute_undefined_repr.rs @@ -1,10 +1,5 @@ #![warn(clippy::transmute_undefined_repr)] -#![allow( - clippy::unit_arg, - clippy::transmute_ptr_to_ref, - clippy::useless_transmute, - clippy::missing_transmute_annotations -)] +#![expect(clippy::transmute_ptr_to_ref, clippy::unit_arg)] use core::any::TypeId; use core::ffi::c_void; diff --git a/tests/ui/transmute_undefined_repr.stderr b/tests/ui/transmute_undefined_repr.stderr index a259ef784c78..4e208843f374 100644 --- a/tests/ui/transmute_undefined_repr.stderr +++ b/tests/ui/transmute_undefined_repr.stderr @@ -1,5 +1,5 @@ error: transmute from `Ty2` which has an undefined layout - --> tests/ui/transmute_undefined_repr.rs:34:33 + --> tests/ui/transmute_undefined_repr.rs:29:33 | LL | let _: Ty2C = transmute(value::>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | let _: Ty2C = transmute(value::>()); = help: to override `-D warnings` add `#[allow(clippy::transmute_undefined_repr)]` error: transmute into `Ty2` which has an undefined layout - --> tests/ui/transmute_undefined_repr.rs:38:32 + --> tests/ui/transmute_undefined_repr.rs:33:32 | LL | let _: Ty2 = transmute(value::>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmute from `Ty>` to `Ty2`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:47:32 + --> tests/ui/transmute_undefined_repr.rs:42:32 | LL | let _: Ty2 = transmute(value::>>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | let _: Ty2 = transmute(value::>>()); = note: two instances of the same generic type (`Ty2`) may have different layouts error: transmute from `Ty2` to `Ty>`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:51:36 + --> tests/ui/transmute_undefined_repr.rs:46:36 | LL | let _: Ty> = transmute(value::>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL | let _: Ty> = transmute(value::>()); = note: two instances of the same generic type (`Ty2`) may have different layouts error: transmute from `Ty<&Ty2>` to `&Ty2`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:58:33 + --> tests/ui/transmute_undefined_repr.rs:53:33 | LL | let _: &Ty2 = transmute(value::>>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | let _: &Ty2 = transmute(value::>>()); = note: two instances of the same generic type (`Ty2`) may have different layouts error: transmute from `&Ty2` to `Ty<&Ty2>`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:62:37 + --> tests/ui/transmute_undefined_repr.rs:57:37 | LL | let _: Ty<&Ty2> = transmute(value::<&Ty2>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | let _: Ty<&Ty2> = transmute(value::<&Ty2>()); = note: two instances of the same generic type (`Ty2`) may have different layouts error: transmute from `std::boxed::Box>` to `&mut Ty2`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:91:45 + --> tests/ui/transmute_undefined_repr.rs:86:45 | LL | let _: &'static mut Ty2 = transmute(value::>>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +54,7 @@ LL | let _: &'static mut Ty2 = transmute(value::` to `std::boxed::Box>`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:95:37 + --> tests/ui/transmute_undefined_repr.rs:90:37 | LL | let _: Box> = transmute(value::<&'static mut Ty2>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -62,7 +62,7 @@ LL | let _: Box> = transmute(value::<&'static mut Ty2` which has an undefined layout - --> tests/ui/transmute_undefined_repr.rs:191:39 + --> tests/ui/transmute_undefined_repr.rs:186:39 | LL | let _: *const Ty2 = transmute(value::<*const Ty2C>>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ LL | let _: *const Ty2 = transmute(value::<*const Ty2C` has an undefined layout error: transmute from `*const Ty2` which has an undefined layout - --> tests/ui/transmute_undefined_repr.rs:195:50 + --> tests/ui/transmute_undefined_repr.rs:190:50 | LL | let _: *const Ty2C> = transmute(value::<*const Ty2>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -78,7 +78,7 @@ LL | let _: *const Ty2C> = transmute(value::<*const T = note: the contained type `Ty2` has an undefined layout error: transmute from `std::vec::Vec>` to `std::vec::Vec>`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:241:35 + --> tests/ui/transmute_undefined_repr.rs:236:35 | LL | let _: Vec> = transmute(value::>>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL | let _: Vec> = transmute(value::>>()); = note: two instances of the same generic type (`Vec`) may have different layouts error: transmute from `std::vec::Vec>` to `std::vec::Vec>`, both of which have an undefined layout - --> tests/ui/transmute_undefined_repr.rs:245:35 + --> tests/ui/transmute_undefined_repr.rs:240:35 | LL | let _: Vec> = transmute(value::>>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/transmutes_expressible_as_ptr_casts.fixed b/tests/ui/transmutes_expressible_as_ptr_casts.fixed index f332e02a2d32..726fb9e908dc 100644 --- a/tests/ui/transmutes_expressible_as_ptr_casts.fixed +++ b/tests/ui/transmutes_expressible_as_ptr_casts.fixed @@ -1,9 +1,11 @@ -#![warn(clippy::transmutes_expressible_as_ptr_casts)] -// These two warnings currently cover the cases transmutes_expressible_as_ptr_casts +// The last two warnings currently cover the cases transmutes_expressible_as_ptr_casts // would otherwise be responsible for -#![warn(clippy::useless_transmute)] -#![warn(clippy::transmute_ptr_to_ptr)] -#![allow(unused, clippy::borrow_as_ptr, clippy::missing_transmute_annotations)] +#![warn( + clippy::transmute_ptr_to_ptr, + clippy::transmutes_expressible_as_ptr_casts, + clippy::useless_transmute +)] +#![expect(clippy::missing_transmute_annotations)] #![allow(function_casts_as_integer)] use std::mem::{size_of, transmute}; diff --git a/tests/ui/transmutes_expressible_as_ptr_casts.rs b/tests/ui/transmutes_expressible_as_ptr_casts.rs index c29a42ddca53..c280326269b2 100644 --- a/tests/ui/transmutes_expressible_as_ptr_casts.rs +++ b/tests/ui/transmutes_expressible_as_ptr_casts.rs @@ -1,9 +1,11 @@ -#![warn(clippy::transmutes_expressible_as_ptr_casts)] -// These two warnings currently cover the cases transmutes_expressible_as_ptr_casts +// The last two warnings currently cover the cases transmutes_expressible_as_ptr_casts // would otherwise be responsible for -#![warn(clippy::useless_transmute)] -#![warn(clippy::transmute_ptr_to_ptr)] -#![allow(unused, clippy::borrow_as_ptr, clippy::missing_transmute_annotations)] +#![warn( + clippy::transmute_ptr_to_ptr, + clippy::transmutes_expressible_as_ptr_casts, + clippy::useless_transmute +)] +#![expect(clippy::missing_transmute_annotations)] #![allow(function_casts_as_integer)] use std::mem::{size_of, transmute}; diff --git a/tests/ui/transmutes_expressible_as_ptr_casts.stderr b/tests/ui/transmutes_expressible_as_ptr_casts.stderr index 5ddc3de6a039..bc0f0109886a 100644 --- a/tests/ui/transmutes_expressible_as_ptr_casts.stderr +++ b/tests/ui/transmutes_expressible_as_ptr_casts.stderr @@ -1,5 +1,5 @@ error: transmute from a pointer to a pointer - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:20:38 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:22:38 | LL | let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + let _ptr_i8_transmute = unsafe { ptr_i32.cast::() }; | error: transmute from a pointer to a pointer - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:27:46 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:29:46 | LL | let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + let _ptr_to_unsized_transmute = unsafe { slice_ptr as *const [u32] }; | error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:34:50 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:36:50 | LL | let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, usize>(ptr_i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize` @@ -34,7 +34,7 @@ LL | let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, us = help: to override `-D warnings` add `#[allow(clippy::transmutes_expressible_as_ptr_casts)]` error: transmute from a reference to a pointer - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:41:41 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:43:41 | LL | let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; 4]>(array_ref) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]` @@ -43,31 +43,31 @@ LL | let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]` error: transmute from `fn(usize) -> u8` to `*const usize` which could be expressed as a pointer cast instead - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:50:41 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:52:41 | LL | let _usize_ptr_transmute = unsafe { transmute:: u8, *const usize>(foo) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize` error: transmute from `fn(usize) -> u8` to `usize` which could be expressed as a pointer cast instead - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:55:49 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:57:49 | LL | let _usize_from_fn_ptr_transmute = unsafe { transmute:: u8, usize>(foo) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize` error: transmute from `*const u32` to `usize` which could be expressed as a pointer cast instead - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:59:36 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:61:36 | LL | let _usize_from_ref = unsafe { transmute::<*const u32, usize>(&1u32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&1u32 as *const u32 as usize` error: transmute from a reference to a pointer - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:71:14 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:73:14 | LL | unsafe { transmute::<&[i32; 1], *const u8>(in_param) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `in_param as *const [i32; 1] as *const u8` error: transmute from `fn()` to `*const u8` which could be expressed as a pointer cast instead - --> tests/ui/transmutes_expressible_as_ptr_casts.rs:90:28 + --> tests/ui/transmutes_expressible_as_ptr_casts.rs:92:28 | LL | let _x: u8 = unsafe { *std::mem::transmute::(f) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(f as *const u8)` diff --git a/tests/ui/transmuting_null.rs b/tests/ui/transmuting_null.rs index c2de798ab308..b6ff746e9822 100644 --- a/tests/ui/transmuting_null.rs +++ b/tests/ui/transmuting_null.rs @@ -1,9 +1,6 @@ -#![allow(dead_code)] #![warn(clippy::transmuting_null)] -#![allow(clippy::zero_ptr)] +#![expect(clippy::manual_dangling_ptr, clippy::zero_ptr)] #![allow(clippy::transmute_ptr_to_ref)] -#![allow(clippy::eq_op, clippy::missing_transmute_annotations)] -#![allow(clippy::manual_dangling_ptr)] // Easy to lint because these only span one line. fn one_liners() { diff --git a/tests/ui/transmuting_null.stderr b/tests/ui/transmuting_null.stderr index 3c6c28f31d0d..c19dfcf9926b 100644 --- a/tests/ui/transmuting_null.stderr +++ b/tests/ui/transmuting_null.stderr @@ -1,5 +1,5 @@ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:11:23 + --> tests/ui/transmuting_null.rs:8:23 | LL | let _: &u64 = std::mem::transmute(0 as *const u64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,43 +8,43 @@ LL | let _: &u64 = std::mem::transmute(0 as *const u64); = help: to override `-D warnings` add `#[allow(clippy::transmuting_null)]` error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:14:23 + --> tests/ui/transmuting_null.rs:11:23 | LL | let _: &u64 = std::mem::transmute(std::ptr::null::()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:25:23 + --> tests/ui/transmuting_null.rs:22:23 | LL | let _: &u64 = std::mem::transmute(ZPTR); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:35:23 + --> tests/ui/transmuting_null.rs:32:23 | LL | let _: &u64 = std::mem::transmute(u64::MIN as *const u64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:42:23 + --> tests/ui/transmuting_null.rs:39:23 | LL | let _: &u64 = std::mem::transmute({ 0 as *const u64 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:45:23 + --> tests/ui/transmuting_null.rs:42:23 | LL | let _: &u64 = std::mem::transmute(const { u64::MIN as *const u64 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:52:23 + --> tests/ui/transmuting_null.rs:49:23 | LL | let _: &u64 = std::mem::transmute(std::ptr::without_provenance::(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: transmuting a known null pointer into a reference - --> tests/ui/transmuting_null.rs:55:23 + --> tests/ui/transmuting_null.rs:52:23 | LL | let _: &u64 = std::mem::transmute(std::ptr::without_provenance_mut::(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/trim_split_whitespace.fixed b/tests/ui/trim_split_whitespace.fixed index 434e91b7d953..b5f3dd0ffde0 100644 --- a/tests/ui/trim_split_whitespace.fixed +++ b/tests/ui/trim_split_whitespace.fixed @@ -1,5 +1,5 @@ #![warn(clippy::trim_split_whitespace)] -#![allow(clippy::let_unit_value)] +#![expect(clippy::let_unit_value)] struct Custom; impl Custom { @@ -39,7 +39,6 @@ impl std::ops::Deref for DerefStrAndCustomSplit { } } impl DerefStrAndCustomSplit { - #[allow(dead_code)] fn split_whitespace(self) {} } diff --git a/tests/ui/trim_split_whitespace.rs b/tests/ui/trim_split_whitespace.rs index b939ecdfba85..80a113367f08 100644 --- a/tests/ui/trim_split_whitespace.rs +++ b/tests/ui/trim_split_whitespace.rs @@ -1,5 +1,5 @@ #![warn(clippy::trim_split_whitespace)] -#![allow(clippy::let_unit_value)] +#![expect(clippy::let_unit_value)] struct Custom; impl Custom { @@ -39,7 +39,6 @@ impl std::ops::Deref for DerefStrAndCustomSplit { } } impl DerefStrAndCustomSplit { - #[allow(dead_code)] fn split_whitespace(self) {} } diff --git a/tests/ui/trim_split_whitespace.stderr b/tests/ui/trim_split_whitespace.stderr index f242dd802115..9ad0be5d4181 100644 --- a/tests/ui/trim_split_whitespace.stderr +++ b/tests/ui/trim_split_whitespace.stderr @@ -1,5 +1,5 @@ error: found call to `str::trim` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:61:23 + --> tests/ui/trim_split_whitespace.rs:60:23 | LL | let _ = " A B C ".trim().split_whitespace(); // should trigger lint | ^^^^^^^ help: remove `trim()` @@ -8,43 +8,43 @@ LL | let _ = " A B C ".trim().split_whitespace(); // should trigger lint = help: to override `-D warnings` add `#[allow(clippy::trim_split_whitespace)]` error: found call to `str::trim_start` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:64:23 + --> tests/ui/trim_split_whitespace.rs:63:23 | LL | let _ = " A B C ".trim_start().split_whitespace(); // should trigger lint | ^^^^^^^^^^^^^ help: remove `trim_start()` error: found call to `str::trim_end` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:67:23 + --> tests/ui/trim_split_whitespace.rs:66:23 | LL | let _ = " A B C ".trim_end().split_whitespace(); // should trigger lint | ^^^^^^^^^^^ help: remove `trim_end()` error: found call to `str::trim` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:72:37 + --> tests/ui/trim_split_whitespace.rs:71:37 | LL | let _ = (" A B C ").to_string().trim().split_whitespace(); // should trigger lint | ^^^^^^^ help: remove `trim()` error: found call to `str::trim_start` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:75:37 + --> tests/ui/trim_split_whitespace.rs:74:37 | LL | let _ = (" A B C ").to_string().trim_start().split_whitespace(); // should trigger lint | ^^^^^^^^^^^^^ help: remove `trim_start()` error: found call to `str::trim_end` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:78:37 + --> tests/ui/trim_split_whitespace.rs:77:37 | LL | let _ = (" A B C ").to_string().trim_end().split_whitespace(); // should trigger lint | ^^^^^^^^^^^ help: remove `trim_end()` error: found call to `str::trim` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:87:15 + --> tests/ui/trim_split_whitespace.rs:86:15 | LL | let _ = s.trim().split_whitespace(); // should trigger lint | ^^^^^^^ help: remove `trim()` error: found call to `str::trim` before `str::split_whitespace` - --> tests/ui/trim_split_whitespace.rs:97:15 + --> tests/ui/trim_split_whitespace.rs:96:15 | LL | let _ = s.trim().split_whitespace(); // should trigger lint | ^^^^^^^ help: remove `trim()` diff --git a/tests/ui/trivially_copy_pass_by_ref.fixed b/tests/ui/trivially_copy_pass_by_ref.fixed index 1a07f119398a..637941ce950f 100644 --- a/tests/ui/trivially_copy_pass_by_ref.fixed +++ b/tests/ui/trivially_copy_pass_by_ref.fixed @@ -1,14 +1,8 @@ //@normalize-stderr-test: "\(\d+ byte\)" -> "(N byte)" //@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: N byte)" -#![deny(clippy::trivially_copy_pass_by_ref)] -#![allow( - clippy::disallowed_names, - clippy::extra_unused_lifetimes, - clippy::needless_lifetimes, - clippy::needless_pass_by_ref_mut, - clippy::redundant_field_names, - clippy::uninlined_format_args -)] +#![warn(clippy::trivially_copy_pass_by_ref)] +#![allow(clippy::extra_unused_lifetimes)] +#![expect(clippy::disallowed_names, clippy::needless_lifetimes)] #[derive(Copy, Clone)] struct Foo(u32); diff --git a/tests/ui/trivially_copy_pass_by_ref.rs b/tests/ui/trivially_copy_pass_by_ref.rs index 07b1842bbf85..9cdfc32ec03c 100644 --- a/tests/ui/trivially_copy_pass_by_ref.rs +++ b/tests/ui/trivially_copy_pass_by_ref.rs @@ -1,14 +1,8 @@ //@normalize-stderr-test: "\(\d+ byte\)" -> "(N byte)" //@normalize-stderr-test: "\(limit: \d+ byte\)" -> "(limit: N byte)" -#![deny(clippy::trivially_copy_pass_by_ref)] -#![allow( - clippy::disallowed_names, - clippy::extra_unused_lifetimes, - clippy::needless_lifetimes, - clippy::needless_pass_by_ref_mut, - clippy::redundant_field_names, - clippy::uninlined_format_args -)] +#![warn(clippy::trivially_copy_pass_by_ref)] +#![allow(clippy::extra_unused_lifetimes)] +#![expect(clippy::disallowed_names, clippy::needless_lifetimes)] #[derive(Copy, Clone)] struct Foo(u32); diff --git a/tests/ui/trivially_copy_pass_by_ref.stderr b/tests/ui/trivially_copy_pass_by_ref.stderr index 36247d3fe0b1..0a8bb545b5dd 100644 --- a/tests/ui/trivially_copy_pass_by_ref.stderr +++ b/tests/ui/trivially_copy_pass_by_ref.stderr @@ -1,113 +1,110 @@ error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:54:11 + --> tests/ui/trivially_copy_pass_by_ref.rs:48:11 | LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `u32` | -note: the lint level is defined here - --> tests/ui/trivially_copy_pass_by_ref.rs:3:9 - | -LL | #![deny(clippy::trivially_copy_pass_by_ref)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::trivially_copy_pass_by_ref)]` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:54:20 + --> tests/ui/trivially_copy_pass_by_ref.rs:48:20 | LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Foo` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:54:29 + --> tests/ui/trivially_copy_pass_by_ref.rs:48:29 | LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Baz` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:64:12 + --> tests/ui/trivially_copy_pass_by_ref.rs:58:12 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} | ^^^^^ help: consider passing by value instead: `self` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:64:22 + --> tests/ui/trivially_copy_pass_by_ref.rs:58:22 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `u32` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:64:31 + --> tests/ui/trivially_copy_pass_by_ref.rs:58:31 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Foo` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:64:40 + --> tests/ui/trivially_copy_pass_by_ref.rs:58:40 | LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Baz` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:70:16 + --> tests/ui/trivially_copy_pass_by_ref.rs:64:16 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `u32` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:70:25 + --> tests/ui/trivially_copy_pass_by_ref.rs:64:25 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Foo` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:70:34 + --> tests/ui/trivially_copy_pass_by_ref.rs:64:34 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Baz` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:75:35 + --> tests/ui/trivially_copy_pass_by_ref.rs:69:35 | LL | fn bad_issue7518(self, other: &Self) {} | ^^^^^ help: consider passing by value instead: `Self` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:88:16 + --> tests/ui/trivially_copy_pass_by_ref.rs:82:16 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `u32` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:88:25 + --> tests/ui/trivially_copy_pass_by_ref.rs:82:25 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Foo` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:88:34 + --> tests/ui/trivially_copy_pass_by_ref.rs:82:34 | LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} | ^^^^ help: consider passing by value instead: `Baz` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:95:33 + --> tests/ui/trivially_copy_pass_by_ref.rs:89:33 | LL | fn trait_method(&self, foo: &Foo); | ^^^^ help: consider passing by value instead: `Foo` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:133:21 + --> tests/ui/trivially_copy_pass_by_ref.rs:127:21 | LL | fn foo_never(x: &i32) { | ^^^^ help: consider passing by value instead: `i32` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:139:15 + --> tests/ui/trivially_copy_pass_by_ref.rs:133:15 | LL | fn foo(x: &i32) { | ^^^^ help: consider passing by value instead: `i32` error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) - --> tests/ui/trivially_copy_pass_by_ref.rs:165:36 + --> tests/ui/trivially_copy_pass_by_ref.rs:159:36 | LL | fn unrelated_lifetimes<'a, 'b>(_x: &'a u32, y: &'b u32) -> &'b u32 { | ^^^^^^^ help: consider passing by value instead: `u32` diff --git a/tests/ui/try_err.fixed b/tests/ui/try_err.fixed index bec366f4fd60..415cf50b1dda 100644 --- a/tests/ui/try_err.fixed +++ b/tests/ui/try_err.fixed @@ -1,11 +1,7 @@ //@aux-build:proc_macros.rs #![feature(try_blocks)] -#![deny(clippy::try_err)] -#![allow( - clippy::unnecessary_wraps, - clippy::needless_question_mark, - clippy::needless_return_with_question_mark -)] +#![warn(clippy::try_err)] +#![allow(clippy::needless_return_with_question_mark)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/try_err.rs b/tests/ui/try_err.rs index 9c10acd2ce0a..362d1a63b82c 100644 --- a/tests/ui/try_err.rs +++ b/tests/ui/try_err.rs @@ -1,11 +1,7 @@ //@aux-build:proc_macros.rs #![feature(try_blocks)] -#![deny(clippy::try_err)] -#![allow( - clippy::unnecessary_wraps, - clippy::needless_question_mark, - clippy::needless_return_with_question_mark -)] +#![warn(clippy::try_err)] +#![allow(clippy::needless_return_with_question_mark)] extern crate proc_macros; use proc_macros::{external, inline_macros}; diff --git a/tests/ui/try_err.stderr b/tests/ui/try_err.stderr index 3ca51e9d8891..0b4c5ec0c5a1 100644 --- a/tests/ui/try_err.stderr +++ b/tests/ui/try_err.stderr @@ -1,35 +1,32 @@ error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:22:9 + --> tests/ui/try_err.rs:18:9 | LL | Err(err)?; | ^^^^^^^^^ help: try: `return Err(err)` | -note: the lint level is defined here - --> tests/ui/try_err.rs:3:9 - | -LL | #![deny(clippy::try_err)] - | ^^^^^^^^^^^^^^^ + = note: `-D clippy::try-err` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::try_err)]` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:33:9 + --> tests/ui/try_err.rs:29:9 | LL | Err(err)?; | ^^^^^^^^^ help: try: `return Err(err.into())` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:54:17 + --> tests/ui/try_err.rs:50:17 | LL | Err(err)?; | ^^^^^^^^^ help: try: `return Err(err)` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:74:17 + --> tests/ui/try_err.rs:70:17 | LL | Err(err)?; | ^^^^^^^^^ help: try: `return Err(err.into())` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:95:23 + --> tests/ui/try_err.rs:91:23 | LL | Err(_) => Err(1)?, | ^^^^^^^ help: try: `return Err(1)` @@ -37,7 +34,7 @@ LL | Err(_) => Err(1)?, = note: this error originates in the macro `__inline_mac_fn_calling_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:103:23 + --> tests/ui/try_err.rs:99:23 | LL | Err(_) => Err(inline!(1))?, | ^^^^^^^^^^^^^^^^ help: try: `return Err(inline!(1))` @@ -45,31 +42,31 @@ LL | Err(_) => Err(inline!(1))?, = note: this error originates in the macro `__inline_mac_fn_calling_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:124:9 + --> tests/ui/try_err.rs:120:9 | LL | Err(inline!(inline!(String::from("aasdfasdfasdfa"))))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Err(inline!(inline!(String::from("aasdfasdfasdfa"))))` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:132:9 + --> tests/ui/try_err.rs:128:9 | LL | Err(io::ErrorKind::WriteZero)? | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Poll::Ready(Err(io::ErrorKind::WriteZero.into()))` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:135:9 + --> tests/ui/try_err.rs:131:9 | LL | Err(io::Error::new(io::ErrorKind::InvalidInput, "error"))? | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Poll::Ready(Err(io::Error::new(io::ErrorKind::InvalidInput, "error")))` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:144:9 + --> tests/ui/try_err.rs:140:9 | LL | Err(io::ErrorKind::NotFound)? | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `return Poll::Ready(Some(Err(io::ErrorKind::NotFound.into())))` error: returning an `Err(_)` with the `?` operator - --> tests/ui/try_err.rs:154:16 + --> tests/ui/try_err.rs:150:16 | LL | return Err(42)?; | ^^^^^^^^ help: try: `Err(42)` diff --git a/tests/ui/tuple_array_conversions.rs b/tests/ui/tuple_array_conversions.rs index 17e6a252b266..2fd6903aa3e3 100644 --- a/tests/ui/tuple_array_conversions.rs +++ b/tests/ui/tuple_array_conversions.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macros.rs -#![allow(clippy::no_effect, clippy::useless_vec, unused)] #![warn(clippy::tuple_array_conversions)] +#![expect(clippy::no_effect, clippy::useless_vec)] #[macro_use] extern crate proc_macros; diff --git a/tests/ui/type_complexity.rs b/tests/ui/type_complexity.rs index 9d145516d610..fcc4e7757feb 100644 --- a/tests/ui/type_complexity.rs +++ b/tests/ui/type_complexity.rs @@ -1,5 +1,5 @@ #![feature(associated_type_defaults)] -#![allow(clippy::needless_pass_by_value, clippy::vec_box, clippy::useless_vec)] +#![warn(clippy::type_complexity)] type Alias = Vec>>; // no warning here diff --git a/tests/ui/type_repetition_in_bounds.rs b/tests/ui/type_repetition_in_bounds.rs index e75678d5fd93..b1041e305343 100644 --- a/tests/ui/type_repetition_in_bounds.rs +++ b/tests/ui/type_repetition_in_bounds.rs @@ -1,9 +1,5 @@ -#![deny(clippy::type_repetition_in_bounds)] -#![allow( - clippy::extra_unused_type_parameters, - clippy::multiple_bound_locations, - clippy::needless_maybe_sized -)] +#![warn(clippy::type_repetition_in_bounds)] +#![expect(clippy::multiple_bound_locations, clippy::needless_maybe_sized)] use serde::Deserialize; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; diff --git a/tests/ui/type_repetition_in_bounds.stderr b/tests/ui/type_repetition_in_bounds.stderr index de1b14da1985..562d486a8298 100644 --- a/tests/ui/type_repetition_in_bounds.stderr +++ b/tests/ui/type_repetition_in_bounds.stderr @@ -1,18 +1,15 @@ error: type `T` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:14:5 + --> tests/ui/type_repetition_in_bounds.rs:10:5 | LL | T: Clone, | ^^^^^^^^ | = help: consider combining the bounds: `T: Copy + Clone` -note: the lint level is defined here - --> tests/ui/type_repetition_in_bounds.rs:1:9 - | -LL | #![deny(clippy::type_repetition_in_bounds)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::type-repetition-in-bounds` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::type_repetition_in_bounds)]` error: type `Self` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:32:5 + --> tests/ui/type_repetition_in_bounds.rs:28:5 | LL | Self: Copy + Default + Ord, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,7 +17,7 @@ LL | Self: Copy + Default + Ord, = help: consider combining the bounds: `Self: Clone + Copy + Default + Ord` error: type `T` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:107:5 + --> tests/ui/type_repetition_in_bounds.rs:103:5 | LL | T: Clone, | ^^^^^^^^ @@ -28,7 +25,7 @@ LL | T: Clone, = help: consider combining the bounds: `T: ?Sized + Clone` error: type `T` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:113:5 + --> tests/ui/type_repetition_in_bounds.rs:109:5 | LL | T: ?Sized, | ^^^^^^^^^ @@ -36,7 +33,7 @@ LL | T: ?Sized, = help: consider combining the bounds: `T: Clone + ?Sized` error: type `T` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:139:9 + --> tests/ui/type_repetition_in_bounds.rs:135:9 | LL | T: Trait, Box<[String]>, bool> + 'static, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +41,7 @@ LL | T: Trait, Box<[String]>, bool> + 'static, = help: consider combining the bounds: `T: ?Sized + Trait, Box<[String]>, bool> + 'static` error: type `K` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:148:5 + --> tests/ui/type_repetition_in_bounds.rs:144:5 | LL | K: Clone, | ^^^^^^^^ @@ -52,7 +49,7 @@ LL | K: Clone, = help: consider combining the bounds: `K: 'a + Clone` error: type `Vec` has already been used as a bound predicate - --> tests/ui/type_repetition_in_bounds.rs:157:5 + --> tests/ui/type_repetition_in_bounds.rs:153:5 | LL | Vec: Clone, | ^^^^^^^^^^^^^ diff --git a/tests/ui/unconditional_recursion.rs b/tests/ui/unconditional_recursion.rs index 20b4198d6392..fb4f7b503578 100644 --- a/tests/ui/unconditional_recursion.rs +++ b/tests/ui/unconditional_recursion.rs @@ -1,9 +1,9 @@ #![warn(clippy::unconditional_recursion)] -#![allow( - clippy::partialeq_ne_impl, +#![expect( clippy::default_constructed_unit_structs, + clippy::needless_lifetimes, clippy::only_used_in_recursion, - clippy::needless_lifetimes + clippy::partialeq_ne_impl )] enum Foo { diff --git a/tests/ui/unicode.fixed b/tests/ui/unicode.fixed index 8fd25d1b48f5..271198081364 100644 --- a/tests/ui/unicode.fixed +++ b/tests/ui/unicode.fixed @@ -1,6 +1,4 @@ -#![allow(dead_code)] - -#[warn(clippy::invisible_characters)] +#![warn(clippy::invisible_characters, clippy::unicode_not_nfc)] fn zero() { print!("Here >\u{200B}< is a ZWS, and \u{200B}another"); //~^ invisible_characters @@ -13,7 +11,6 @@ fn zero() { print!("This\u{2060}is\u{2060}fine"); } -#[warn(clippy::unicode_not_nfc)] fn canon() { print!("̀àh?"); //~^ unicode_not_nfc diff --git a/tests/ui/unicode.rs b/tests/ui/unicode.rs index 6447a704a356..86adce0e629c 100644 --- a/tests/ui/unicode.rs +++ b/tests/ui/unicode.rs @@ -1,6 +1,4 @@ -#![allow(dead_code)] - -#[warn(clippy::invisible_characters)] +#![warn(clippy::invisible_characters, clippy::unicode_not_nfc)] fn zero() { print!("Here >​< is a ZWS, and ​another"); //~^ invisible_characters @@ -13,7 +11,6 @@ fn zero() { print!("This\u{2060}is\u{2060}fine"); } -#[warn(clippy::unicode_not_nfc)] fn canon() { print!("̀àh?"); //~^ unicode_not_nfc diff --git a/tests/ui/unicode.stderr b/tests/ui/unicode.stderr index c761ec89602f..f7d025d8da7a 100644 --- a/tests/ui/unicode.stderr +++ b/tests/ui/unicode.stderr @@ -1,5 +1,5 @@ error: invisible character detected - --> tests/ui/unicode.rs:5:12 + --> tests/ui/unicode.rs:3:12 | LL | print!("Here >​< is a ZWS, and ​another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{200B}< is a ZWS, and \u{200B}another"` @@ -8,19 +8,19 @@ LL | print!("Here >​< is a ZWS, and ​another"); = help: to override `-D warnings` add `#[allow(clippy::invisible_characters)]` error: invisible character detected - --> tests/ui/unicode.rs:8:12 + --> tests/ui/unicode.rs:6:12 | LL | print!("Here >­< is a SHY, and ­another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{AD}< is a SHY, and \u{AD}another"` error: invisible character detected - --> tests/ui/unicode.rs:11:12 + --> tests/ui/unicode.rs:9:12 | LL | print!("Here >⁠< is a WJ, and ⁠another"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{2060}< is a WJ, and \u{2060}another"` error: non-NFC Unicode sequence detected - --> tests/ui/unicode.rs:18:12 + --> tests/ui/unicode.rs:15:12 | LL | print!("̀àh?"); | ^^^^^ help: consider replacing the string with: `"̀àh?"` @@ -29,37 +29,37 @@ LL | print!("̀àh?"); = help: to override `-D warnings` add `#[allow(clippy::unicode_not_nfc)]` error: literal non-ASCII character detected - --> tests/ui/unicode.rs:27:16 + --> tests/ui/unicode.rs:24:16 | LL | print!("Üben!"); | ^^^^^^^ help: consider replacing the string with: `"\u{dc}ben!"` | note: the lint level is defined here - --> tests/ui/unicode.rs:24:13 + --> tests/ui/unicode.rs:21:13 | LL | #![deny(clippy::non_ascii_literal)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: literal non-ASCII character detected - --> tests/ui/unicode.rs:34:36 + --> tests/ui/unicode.rs:31:36 | LL | const _EMPTY_BLOCK: char = '▱'; | ^^^ help: consider replacing the string with: `'\u{25b1}'` error: literal non-ASCII character detected - --> tests/ui/unicode.rs:36:35 + --> tests/ui/unicode.rs:33:35 | LL | const _FULL_BLOCK: char = '▰'; | ^^^ help: consider replacing the string with: `'\u{25b0}'` error: literal non-ASCII character detected - --> tests/ui/unicode.rs:57:21 + --> tests/ui/unicode.rs:54:21 | LL | let _ = "悲しいかな、ここに日本語を書くことはできない。"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"\u{60b2}\u{3057}\u{3044}\u{304b}\u{306a}\u{3001}\u{3053}\u{3053}\u{306b}\u{65e5}\u{672c}\u{8a9e}\u{3092}\u{66f8}\u{304f}\u{3053}\u{3068}\u{306f}\u{3067}\u{304d}\u{306a}\u{3044}\u{3002}"` | note: the lint level is defined here - --> tests/ui/unicode.rs:46:17 + --> tests/ui/unicode.rs:43:17 | LL | #![deny(clippy::non_ascii_literal)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/uninhabited_references.rs b/tests/ui/uninhabited_references.rs index 9b3616ad5187..2351fb6a2c4e 100644 --- a/tests/ui/uninhabited_references.rs +++ b/tests/ui/uninhabited_references.rs @@ -1,5 +1,4 @@ #![warn(clippy::uninhabited_references)] -#![allow(clippy::missing_transmute_annotations)] #![feature(never_type)] fn ret_uninh_ref() -> &'static std::convert::Infallible { diff --git a/tests/ui/uninhabited_references.stderr b/tests/ui/uninhabited_references.stderr index ac05ab5bb4d4..0d29816fc51d 100644 --- a/tests/ui/uninhabited_references.stderr +++ b/tests/ui/uninhabited_references.stderr @@ -1,5 +1,5 @@ error: dereferencing a reference to an uninhabited type would be undefined behavior - --> tests/ui/uninhabited_references.rs:5:23 + --> tests/ui/uninhabited_references.rs:4:23 | LL | fn ret_uninh_ref() -> &'static std::convert::Infallible { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | fn ret_uninh_ref() -> &'static std::convert::Infallible { = help: to override `-D warnings` add `#[allow(clippy::uninhabited_references)]` error: dereferencing a reference to an uninhabited type would be undefined behavior - --> tests/ui/uninhabited_references.rs:12:30 + --> tests/ui/uninhabited_references.rs:11:30 | LL | fn $name(x: &$ty) -> &$ty { | ^^^^ @@ -19,7 +19,7 @@ LL | ret_something!(id_never, !); = note: this error originates in the macro `ret_something` (in Nightly builds, run with -Z macro-backtrace for more info) error: dereferencing a reference to an uninhabited type is undefined behavior - --> tests/ui/uninhabited_references.rs:14:14 + --> tests/ui/uninhabited_references.rs:13:14 | LL | &*x | ^^ @@ -30,7 +30,7 @@ LL | ret_something!(id_never, !); = note: this error originates in the macro `ret_something` (in Nightly builds, run with -Z macro-backtrace for more info) error: dereferencing a reference to an uninhabited type is undefined behavior - --> tests/ui/uninhabited_references.rs:25:13 + --> tests/ui/uninhabited_references.rs:24:13 | LL | let _ = *x; | ^^ diff --git a/tests/ui/uninit.rs b/tests/ui/uninit.rs index f74248c8aea8..32d5a8cfc67c 100644 --- a/tests/ui/uninit.rs +++ b/tests/ui/uninit.rs @@ -1,5 +1,6 @@ #![feature(stmt_expr_attributes)] -#![allow(clippy::let_unit_value, invalid_value)] +#![warn(clippy::uninit_assumed_init)] +#![expect(invalid_value)] use std::mem::MaybeUninit; diff --git a/tests/ui/uninit.stderr b/tests/ui/uninit.stderr index d6f54dd61ca0..a18b0020661d 100644 --- a/tests/ui/uninit.stderr +++ b/tests/ui/uninit.stderr @@ -1,19 +1,20 @@ error: this call for this type may be undefined behavior - --> tests/ui/uninit.rs:12:29 + --> tests/ui/uninit.rs:13:29 | LL | let _: usize = unsafe { MaybeUninit::uninit().assume_init() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[deny(clippy::uninit_assumed_init)]` on by default + = note: `-D clippy::uninit-assumed-init` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::uninit_assumed_init)]` error: this call for this type may be undefined behavior - --> tests/ui/uninit.rs:34:29 + --> tests/ui/uninit.rs:35:29 | LL | let _: usize = unsafe { MaybeUninit::uninit().assume_init() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this call for this type may be undefined behavior - --> tests/ui/uninit.rs:43:29 + --> tests/ui/uninit.rs:44:29 | LL | let _: T = unsafe { MaybeUninit::uninit().assume_init() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/uninlined_format_args.fixed b/tests/ui/uninlined_format_args.fixed index 2e84bbc106ac..8d4de4f5bda2 100644 --- a/tests/ui/uninlined_format_args.fixed +++ b/tests/ui/uninlined_format_args.fixed @@ -1,9 +1,8 @@ //@aux-build:proc_macros.rs #![warn(clippy::uninlined_format_args)] -#![allow(named_arguments_used_positionally, unused)] -#![allow( - clippy::eq_op, +#![allow(named_arguments_used_positionally)] +#![expect( clippy::format_in_format_args, clippy::print_literal, clippy::unnecessary_literal_unwrap diff --git a/tests/ui/uninlined_format_args.rs b/tests/ui/uninlined_format_args.rs index 4368ce864474..0af948dd0a4f 100644 --- a/tests/ui/uninlined_format_args.rs +++ b/tests/ui/uninlined_format_args.rs @@ -1,9 +1,8 @@ //@aux-build:proc_macros.rs #![warn(clippy::uninlined_format_args)] -#![allow(named_arguments_used_positionally, unused)] -#![allow( - clippy::eq_op, +#![allow(named_arguments_used_positionally)] +#![expect( clippy::format_in_format_args, clippy::print_literal, clippy::unnecessary_literal_unwrap diff --git a/tests/ui/uninlined_format_args.stderr b/tests/ui/uninlined_format_args.stderr index 45994fdc9588..8fc35af75036 100644 --- a/tests/ui/uninlined_format_args.stderr +++ b/tests/ui/uninlined_format_args.stderr @@ -1,5 +1,5 @@ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:45:5 + --> tests/ui/uninlined_format_args.rs:44:5 | LL | println!("val='{}'", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + println!("val='{local_i32}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:47:5 + --> tests/ui/uninlined_format_args.rs:46:5 | LL | println!("val='{ }'", local_i32); // 3 spaces | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + println!("val='{local_i32}'"); // 3 spaces | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:50:5 + --> tests/ui/uninlined_format_args.rs:49:5 | LL | println!("val='{ }'", local_i32); // tab | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + println!("val='{local_i32}'"); // tab | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:53:5 + --> tests/ui/uninlined_format_args.rs:52:5 | LL | println!("val='{ }'", local_i32); // space+tab | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + println!("val='{local_i32}'"); // space+tab | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:56:5 + --> tests/ui/uninlined_format_args.rs:55:5 | LL | println!("val='{ }'", local_i32); // tab+space | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + println!("val='{local_i32}'"); // tab+space | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:59:5 + --> tests/ui/uninlined_format_args.rs:58:5 | LL | / println!( LL | | @@ -72,7 +72,7 @@ LL | | ); | |_____^ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:65:5 + --> tests/ui/uninlined_format_args.rs:64:5 | LL | println!("{}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ LL + println!("{local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:67:5 + --> tests/ui/uninlined_format_args.rs:66:5 | LL | println!("{}", fn_arg); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -96,7 +96,7 @@ LL + println!("{fn_arg}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:69:5 + --> tests/ui/uninlined_format_args.rs:68:5 | LL | println!("{:?}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -108,7 +108,7 @@ LL + println!("{local_i32:?}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:71:5 + --> tests/ui/uninlined_format_args.rs:70:5 | LL | println!("{:#?}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ LL + println!("{local_i32:#?}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:73:5 + --> tests/ui/uninlined_format_args.rs:72:5 | LL | println!("{:4}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -132,7 +132,7 @@ LL + println!("{local_i32:4}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:75:5 + --> tests/ui/uninlined_format_args.rs:74:5 | LL | println!("{:04}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -144,7 +144,7 @@ LL + println!("{local_i32:04}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:77:5 + --> tests/ui/uninlined_format_args.rs:76:5 | LL | println!("{:<3}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -156,7 +156,7 @@ LL + println!("{local_i32:<3}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:79:5 + --> tests/ui/uninlined_format_args.rs:78:5 | LL | println!("{:#010x}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -168,7 +168,7 @@ LL + println!("{local_i32:#010x}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:81:5 + --> tests/ui/uninlined_format_args.rs:80:5 | LL | println!("{:.1}", local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -180,7 +180,7 @@ LL + println!("{local_f64:.1}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:86:5 + --> tests/ui/uninlined_format_args.rs:85:5 | LL | println!("{} {}", local_i32, local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -192,7 +192,7 @@ LL + println!("{local_i32} {local_f64}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:89:5 + --> tests/ui/uninlined_format_args.rs:88:5 | LL | println!("{}", val); | ^^^^^^^^^^^^^^^^^^^ @@ -204,7 +204,7 @@ LL + println!("{val}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:91:5 + --> tests/ui/uninlined_format_args.rs:90:5 | LL | println!("{}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -216,7 +216,7 @@ LL + println!("{val}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:94:5 + --> tests/ui/uninlined_format_args.rs:93:5 | LL | println!("val='{\t }'", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -228,7 +228,7 @@ LL + println!("val='{local_i32}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:96:5 + --> tests/ui/uninlined_format_args.rs:95:5 | LL | println!("val='{\n }'", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -240,7 +240,7 @@ LL + println!("val='{local_i32}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:98:5 + --> tests/ui/uninlined_format_args.rs:97:5 | LL | println!("val='{local_i32}'", local_i32 = local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -252,7 +252,7 @@ LL + println!("val='{local_i32}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:100:5 + --> tests/ui/uninlined_format_args.rs:99:5 | LL | println!("val='{local_i32}'", local_i32 = fn_arg); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -264,7 +264,7 @@ LL + println!("val='{fn_arg}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:102:5 + --> tests/ui/uninlined_format_args.rs:101:5 | LL | println!("{0}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -276,7 +276,7 @@ LL + println!("{local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:104:5 + --> tests/ui/uninlined_format_args.rs:103:5 | LL | println!("{0:?}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -288,7 +288,7 @@ LL + println!("{local_i32:?}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:106:5 + --> tests/ui/uninlined_format_args.rs:105:5 | LL | println!("{0:#?}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -300,7 +300,7 @@ LL + println!("{local_i32:#?}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:108:5 + --> tests/ui/uninlined_format_args.rs:107:5 | LL | println!("{0:04}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -312,7 +312,7 @@ LL + println!("{local_i32:04}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:110:5 + --> tests/ui/uninlined_format_args.rs:109:5 | LL | println!("{0:<3}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -324,7 +324,7 @@ LL + println!("{local_i32:<3}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:112:5 + --> tests/ui/uninlined_format_args.rs:111:5 | LL | println!("{0:#010x}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -336,7 +336,7 @@ LL + println!("{local_i32:#010x}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:114:5 + --> tests/ui/uninlined_format_args.rs:113:5 | LL | println!("{0:.1}", local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -348,7 +348,7 @@ LL + println!("{local_f64:.1}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:116:5 + --> tests/ui/uninlined_format_args.rs:115:5 | LL | println!("{0} {0}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -360,7 +360,7 @@ LL + println!("{local_i32} {local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:118:5 + --> tests/ui/uninlined_format_args.rs:117:5 | LL | println!("{1} {} {0} {}", local_i32, local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -372,7 +372,7 @@ LL + println!("{local_f64} {local_i32} {local_i32} {local_f64}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:120:5 + --> tests/ui/uninlined_format_args.rs:119:5 | LL | println!("{0} {1}", local_i32, local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -384,7 +384,7 @@ LL + println!("{local_i32} {local_f64}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:122:5 + --> tests/ui/uninlined_format_args.rs:121:5 | LL | println!("{1} {0}", local_i32, local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -396,7 +396,7 @@ LL + println!("{local_f64} {local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:124:5 + --> tests/ui/uninlined_format_args.rs:123:5 | LL | println!("{1} {0} {1} {0}", local_i32, local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -408,7 +408,7 @@ LL + println!("{local_f64} {local_i32} {local_f64} {local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:127:5 + --> tests/ui/uninlined_format_args.rs:126:5 | LL | println!("{v}", v = local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -420,7 +420,7 @@ LL + println!("{local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:129:5 + --> tests/ui/uninlined_format_args.rs:128:5 | LL | println!("{local_i32:0$}", width); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -432,7 +432,7 @@ LL + println!("{local_i32:width$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:131:5 + --> tests/ui/uninlined_format_args.rs:130:5 | LL | println!("{local_i32:w$}", w = width); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -444,7 +444,7 @@ LL + println!("{local_i32:width$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:133:5 + --> tests/ui/uninlined_format_args.rs:132:5 | LL | println!("{local_i32:.0$}", prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -456,7 +456,7 @@ LL + println!("{local_i32:.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:135:5 + --> tests/ui/uninlined_format_args.rs:134:5 | LL | println!("{local_i32:.p$}", p = prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -468,7 +468,7 @@ LL + println!("{local_i32:.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:137:5 + --> tests/ui/uninlined_format_args.rs:136:5 | LL | println!("{:0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -480,7 +480,7 @@ LL + println!("{val:val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:139:5 + --> tests/ui/uninlined_format_args.rs:138:5 | LL | println!("{0:0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -492,7 +492,7 @@ LL + println!("{val:val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:141:5 + --> tests/ui/uninlined_format_args.rs:140:5 | LL | println!("{:0$.0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -504,7 +504,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:143:5 + --> tests/ui/uninlined_format_args.rs:142:5 | LL | println!("{0:0$.0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -516,7 +516,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:145:5 + --> tests/ui/uninlined_format_args.rs:144:5 | LL | println!("{0:0$.v$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -528,7 +528,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:147:5 + --> tests/ui/uninlined_format_args.rs:146:5 | LL | println!("{0:v$.0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -540,7 +540,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:149:5 + --> tests/ui/uninlined_format_args.rs:148:5 | LL | println!("{v:0$.0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -552,7 +552,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:151:5 + --> tests/ui/uninlined_format_args.rs:150:5 | LL | println!("{v:v$.0$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -564,7 +564,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:153:5 + --> tests/ui/uninlined_format_args.rs:152:5 | LL | println!("{v:0$.v$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -576,7 +576,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:155:5 + --> tests/ui/uninlined_format_args.rs:154:5 | LL | println!("{v:v$.v$}", v = val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -588,7 +588,7 @@ LL + println!("{val:val$.val$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:157:5 + --> tests/ui/uninlined_format_args.rs:156:5 | LL | println!("{:0$}", width); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -600,7 +600,7 @@ LL + println!("{width:width$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:159:5 + --> tests/ui/uninlined_format_args.rs:158:5 | LL | println!("{:1$}", local_i32, width); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -612,7 +612,7 @@ LL + println!("{local_i32:width$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:161:5 + --> tests/ui/uninlined_format_args.rs:160:5 | LL | println!("{:w$}", w = width); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -624,7 +624,7 @@ LL + println!("{width:width$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:163:5 + --> tests/ui/uninlined_format_args.rs:162:5 | LL | println!("{:w$}", local_i32, w = width); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -636,7 +636,7 @@ LL + println!("{local_i32:width$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:165:5 + --> tests/ui/uninlined_format_args.rs:164:5 | LL | println!("{:.0$}", prec); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -648,7 +648,7 @@ LL + println!("{prec:.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:167:5 + --> tests/ui/uninlined_format_args.rs:166:5 | LL | println!("{:.1$}", local_i32, prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -660,7 +660,7 @@ LL + println!("{local_i32:.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:169:5 + --> tests/ui/uninlined_format_args.rs:168:5 | LL | println!("{:.p$}", p = prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -672,7 +672,7 @@ LL + println!("{prec:.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:171:5 + --> tests/ui/uninlined_format_args.rs:170:5 | LL | println!("{:.p$}", local_i32, p = prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -684,7 +684,7 @@ LL + println!("{local_i32:.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:173:5 + --> tests/ui/uninlined_format_args.rs:172:5 | LL | println!("{:0$.1$}", width, prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -696,7 +696,7 @@ LL + println!("{width:width$.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:175:5 + --> tests/ui/uninlined_format_args.rs:174:5 | LL | println!("{:0$.w$}", width, w = prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -708,7 +708,7 @@ LL + println!("{width:width$.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:177:5 + --> tests/ui/uninlined_format_args.rs:176:5 | LL | println!("{:1$.2$}", local_f64, width, prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -720,7 +720,7 @@ LL + println!("{local_f64:width$.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:179:5 + --> tests/ui/uninlined_format_args.rs:178:5 | LL | println!("{:1$.2$} {0} {1} {2}", local_f64, width, prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -732,7 +732,7 @@ LL + println!("{local_f64:width$.prec$} {local_f64} {width} {prec}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:181:5 + --> tests/ui/uninlined_format_args.rs:180:5 | LL | / println!( LL | | @@ -742,7 +742,7 @@ LL | | ); | |_____^ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:193:5 + --> tests/ui/uninlined_format_args.rs:192:5 | LL | println!("Width = {}, value with width = {:0$}", local_i32, local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -754,7 +754,7 @@ LL + println!("Width = {local_i32}, value with width = {local_f64:local_i32$ | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:195:5 + --> tests/ui/uninlined_format_args.rs:194:5 | LL | println!("{:w$.p$}", local_i32, w = width, p = prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -766,7 +766,7 @@ LL + println!("{local_i32:width$.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:197:5 + --> tests/ui/uninlined_format_args.rs:196:5 | LL | println!("{:w$.p$}", w = width, p = prec); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -778,7 +778,7 @@ LL + println!("{width:width$.prec$}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:217:5 + --> tests/ui/uninlined_format_args.rs:216:5 | LL | / println!( LL | | @@ -788,7 +788,7 @@ LL | | ); | |_____^ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:223:5 + --> tests/ui/uninlined_format_args.rs:222:5 | LL | println!("{}", /* comment with a comma , in it */ val); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -800,7 +800,7 @@ LL + println!("{val}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:230:9 + --> tests/ui/uninlined_format_args.rs:229:9 | LL | panic!("p1 {}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -812,7 +812,7 @@ LL + panic!("p1 {local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:234:9 + --> tests/ui/uninlined_format_args.rs:233:9 | LL | panic!("p2 {0}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -824,7 +824,7 @@ LL + panic!("p2 {local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:238:9 + --> tests/ui/uninlined_format_args.rs:237:9 | LL | panic!("p3 {local_i32}", local_i32 = local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -836,7 +836,7 @@ LL + panic!("p3 {local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:257:5 + --> tests/ui/uninlined_format_args.rs:256:5 | LL | println!("expand='{}'", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -848,7 +848,7 @@ LL + println!("expand='{local_i32}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:360:5 + --> tests/ui/uninlined_format_args.rs:359:5 | LL | usr_println!(true, "val='{}'", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -860,7 +860,7 @@ LL + usr_println!(true, "val='{local_i32}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:362:5 + --> tests/ui/uninlined_format_args.rs:361:5 | LL | usr_println!(true, "{}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -872,7 +872,7 @@ LL + usr_println!(true, "{local_i32}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:364:5 + --> tests/ui/uninlined_format_args.rs:363:5 | LL | usr_println!(true, "{:#010x}", local_i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -884,7 +884,7 @@ LL + usr_println!(true, "{local_i32:#010x}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args.rs:366:5 + --> tests/ui/uninlined_format_args.rs:365:5 | LL | usr_println!(true, "{:.1}", local_f64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/uninlined_format_args_panic.edition2018.fixed b/tests/ui/uninlined_format_args_panic.edition2018.fixed index 6d0f76eaf252..d44312129a13 100644 --- a/tests/ui/uninlined_format_args_panic.edition2018.fixed +++ b/tests/ui/uninlined_format_args_panic.edition2018.fixed @@ -4,7 +4,6 @@ //@[edition2024] edition:2024 #![warn(clippy::uninlined_format_args)] -#![allow(clippy::literal_string_with_formatting_args)] fn main() { let var = 1; diff --git a/tests/ui/uninlined_format_args_panic.edition2018.stderr b/tests/ui/uninlined_format_args_panic.edition2018.stderr index 24afb3d35abe..4b154abac5bc 100644 --- a/tests/ui/uninlined_format_args_panic.edition2018.stderr +++ b/tests/ui/uninlined_format_args_panic.edition2018.stderr @@ -1,5 +1,5 @@ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:12:5 + --> tests/ui/uninlined_format_args_panic.rs:11:5 | LL | println!("val='{}'", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/uninlined_format_args_panic.edition2021.fixed b/tests/ui/uninlined_format_args_panic.edition2021.fixed index ba741bfcd09d..22b05c542212 100644 --- a/tests/ui/uninlined_format_args_panic.edition2021.fixed +++ b/tests/ui/uninlined_format_args_panic.edition2021.fixed @@ -4,7 +4,6 @@ //@[edition2024] edition:2024 #![warn(clippy::uninlined_format_args)] -#![allow(clippy::literal_string_with_formatting_args)] fn main() { let var = 1; diff --git a/tests/ui/uninlined_format_args_panic.edition2021.stderr b/tests/ui/uninlined_format_args_panic.edition2021.stderr index dcf6747e2d64..a90998aaf06a 100644 --- a/tests/ui/uninlined_format_args_panic.edition2021.stderr +++ b/tests/ui/uninlined_format_args_panic.edition2021.stderr @@ -1,5 +1,5 @@ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:12:5 + --> tests/ui/uninlined_format_args_panic.rs:11:5 | LL | println!("val='{}'", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + println!("val='{var}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:16:9 + --> tests/ui/uninlined_format_args_panic.rs:15:9 | LL | panic!("p1 {}", var); | ^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + panic!("p1 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:21:9 + --> tests/ui/uninlined_format_args_panic.rs:20:9 | LL | panic!("p2 {0}", var); | ^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + panic!("p2 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:26:9 + --> tests/ui/uninlined_format_args_panic.rs:25:9 | LL | panic!("p3 {var}", var = var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + panic!("p3 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:38:5 + --> tests/ui/uninlined_format_args_panic.rs:37:5 | LL | assert!(var == 1, "p5 {}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + assert!(var == 1, "p5 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:41:5 + --> tests/ui/uninlined_format_args_panic.rs:40:5 | LL | debug_assert!(var == 1, "p6 {}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + debug_assert!(var == 1, "p6 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:47:9 + --> tests/ui/uninlined_format_args_panic.rs:46:9 | LL | core::panic!("p7 {}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + core::panic!("p7 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:52:9 + --> tests/ui/uninlined_format_args_panic.rs:51:9 | LL | core::panic!("p8 {0}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + core::panic!("p8 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:57:9 + --> tests/ui/uninlined_format_args_panic.rs:56:9 | LL | core::panic!("p9 {var}", var = var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/uninlined_format_args_panic.edition2024.fixed b/tests/ui/uninlined_format_args_panic.edition2024.fixed index ba741bfcd09d..22b05c542212 100644 --- a/tests/ui/uninlined_format_args_panic.edition2024.fixed +++ b/tests/ui/uninlined_format_args_panic.edition2024.fixed @@ -4,7 +4,6 @@ //@[edition2024] edition:2024 #![warn(clippy::uninlined_format_args)] -#![allow(clippy::literal_string_with_formatting_args)] fn main() { let var = 1; diff --git a/tests/ui/uninlined_format_args_panic.edition2024.stderr b/tests/ui/uninlined_format_args_panic.edition2024.stderr index dcf6747e2d64..a90998aaf06a 100644 --- a/tests/ui/uninlined_format_args_panic.edition2024.stderr +++ b/tests/ui/uninlined_format_args_panic.edition2024.stderr @@ -1,5 +1,5 @@ error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:12:5 + --> tests/ui/uninlined_format_args_panic.rs:11:5 | LL | println!("val='{}'", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + println!("val='{var}'"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:16:9 + --> tests/ui/uninlined_format_args_panic.rs:15:9 | LL | panic!("p1 {}", var); | ^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + panic!("p1 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:21:9 + --> tests/ui/uninlined_format_args_panic.rs:20:9 | LL | panic!("p2 {0}", var); | ^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL + panic!("p2 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:26:9 + --> tests/ui/uninlined_format_args_panic.rs:25:9 | LL | panic!("p3 {var}", var = var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + panic!("p3 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:38:5 + --> tests/ui/uninlined_format_args_panic.rs:37:5 | LL | assert!(var == 1, "p5 {}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + assert!(var == 1, "p5 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:41:5 + --> tests/ui/uninlined_format_args_panic.rs:40:5 | LL | debug_assert!(var == 1, "p6 {}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + debug_assert!(var == 1, "p6 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:47:9 + --> tests/ui/uninlined_format_args_panic.rs:46:9 | LL | core::panic!("p7 {}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + core::panic!("p7 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:52:9 + --> tests/ui/uninlined_format_args_panic.rs:51:9 | LL | core::panic!("p8 {0}", var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + core::panic!("p8 {var}"); | error: variables can be used directly in the `format!` string - --> tests/ui/uninlined_format_args_panic.rs:57:9 + --> tests/ui/uninlined_format_args_panic.rs:56:9 | LL | core::panic!("p9 {var}", var = var); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/uninlined_format_args_panic.rs b/tests/ui/uninlined_format_args_panic.rs index 7ee17d8fb16e..f151f5da959e 100644 --- a/tests/ui/uninlined_format_args_panic.rs +++ b/tests/ui/uninlined_format_args_panic.rs @@ -4,7 +4,6 @@ //@[edition2024] edition:2024 #![warn(clippy::uninlined_format_args)] -#![allow(clippy::literal_string_with_formatting_args)] fn main() { let var = 1; diff --git a/tests/ui/unit_arg.rs b/tests/ui/unit_arg.rs index 3cba0735b362..fa9851db3d10 100644 --- a/tests/ui/unit_arg.rs +++ b/tests/ui/unit_arg.rs @@ -1,16 +1,10 @@ //@aux-build: proc_macros.rs //@no-rustfix: overlapping suggestions #![warn(clippy::unit_arg)] -#![allow(unused_must_use, unused_variables)] -#![allow( - clippy::let_unit_value, +#![expect( clippy::needless_question_mark, clippy::never_loop, clippy::no_effect, - clippy::or_fun_call, - clippy::self_named_constructors, - clippy::uninlined_format_args, - clippy::unnecessary_wraps, clippy::unused_unit )] @@ -124,7 +118,6 @@ fn question_mark() -> Result<(), ()> { Ok(()) } -#[allow(dead_code)] mod issue_2945 { fn unit_fn() -> Result<(), i32> { Ok(()) @@ -135,7 +128,6 @@ mod issue_2945 { } } -#[allow(dead_code)] fn returning_expr() -> Option<()> { Some(foo(1)) //~^ unit_arg diff --git a/tests/ui/unit_arg.stderr b/tests/ui/unit_arg.stderr index ed1310863157..26e35fa616d4 100644 --- a/tests/ui/unit_arg.stderr +++ b/tests/ui/unit_arg.stderr @@ -1,5 +1,5 @@ error: passing a unit value to a function - --> tests/ui/unit_arg.rs:63:5 + --> tests/ui/unit_arg.rs:57:5 | LL | / foo({ LL | | @@ -24,7 +24,7 @@ LL ~ foo(()); | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:67:5 + --> tests/ui/unit_arg.rs:61:5 | LL | foo(foo(1)); | ^^^^^^^^^^^ @@ -36,7 +36,7 @@ LL ~ foo(()); | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:69:5 + --> tests/ui/unit_arg.rs:63:5 | LL | / foo({ LL | | @@ -61,7 +61,7 @@ LL ~ foo(()); | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:75:5 + --> tests/ui/unit_arg.rs:69:5 | LL | / b.bar({ LL | | @@ -84,7 +84,7 @@ LL ~ b.bar(()); | error: passing unit values to a function - --> tests/ui/unit_arg.rs:79:5 + --> tests/ui/unit_arg.rs:73:5 | LL | taking_multiple_units(foo(0), foo(1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL ~ taking_multiple_units((), ()); | error: passing unit values to a function - --> tests/ui/unit_arg.rs:81:5 + --> tests/ui/unit_arg.rs:75:5 | LL | / taking_multiple_units(foo(0), { LL | | @@ -123,7 +123,7 @@ LL ~ taking_multiple_units((), ()); | error: passing unit values to a function - --> tests/ui/unit_arg.rs:86:5 + --> tests/ui/unit_arg.rs:80:5 | LL | / taking_multiple_units( LL | | @@ -162,7 +162,7 @@ LL ~ ); | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:98:13 + --> tests/ui/unit_arg.rs:92:13 | LL | None.or(Some(foo(2))); | ^^^^^^^^^^^^ @@ -176,7 +176,7 @@ LL ~ }); | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:102:5 + --> tests/ui/unit_arg.rs:96:5 | LL | foo(foo(())); | ^^^^^^^^^^^^ @@ -188,7 +188,7 @@ LL ~ foo(()); | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:140:5 + --> tests/ui/unit_arg.rs:132:5 | LL | Some(foo(1)) | ^^^^^^^^^^^^ @@ -200,19 +200,19 @@ LL + Some(()) | error: passing a unit value to a function - --> tests/ui/unit_arg.rs:168:5 + --> tests/ui/unit_arg.rs:160:5 | LL | fn_take_unit(mac!(def)); | ^^^^^^^^^^^^^^^^^^^^^^^ error: passing a unit value to a function - --> tests/ui/unit_arg.rs:170:5 + --> tests/ui/unit_arg.rs:162:5 | LL | fn_take_unit(mac!(func Default::default)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: passing a unit value to a function - --> tests/ui/unit_arg.rs:172:5 + --> tests/ui/unit_arg.rs:164:5 | LL | fn_take_unit(mac!(nonempty_block Default::default())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unit_arg_fixable.fixed b/tests/ui/unit_arg_fixable.fixed index 3bbc62ca0bca..41af9263f914 100644 --- a/tests/ui/unit_arg_fixable.fixed +++ b/tests/ui/unit_arg_fixable.fixed @@ -1,6 +1,4 @@ #![warn(clippy::unit_arg)] -#![allow(unused_must_use, unused_variables)] -#![allow(clippy::no_effect, clippy::uninlined_format_args)] use std::fmt::Debug; diff --git a/tests/ui/unit_arg_fixable.rs b/tests/ui/unit_arg_fixable.rs index 12d6cbcf61d9..02d39b028301 100644 --- a/tests/ui/unit_arg_fixable.rs +++ b/tests/ui/unit_arg_fixable.rs @@ -1,6 +1,4 @@ #![warn(clippy::unit_arg)] -#![allow(unused_must_use, unused_variables)] -#![allow(clippy::no_effect, clippy::uninlined_format_args)] use std::fmt::Debug; diff --git a/tests/ui/unit_arg_fixable.stderr b/tests/ui/unit_arg_fixable.stderr index 9f6bc671bf55..40eee8c2cc1c 100644 --- a/tests/ui/unit_arg_fixable.stderr +++ b/tests/ui/unit_arg_fixable.stderr @@ -1,5 +1,5 @@ error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:16:5 + --> tests/ui/unit_arg_fixable.rs:14:5 | LL | foo({}); | ^^^^^^^ @@ -13,7 +13,7 @@ LL + foo(()); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:18:5 + --> tests/ui/unit_arg_fixable.rs:16:5 | LL | foo3({}, 2, 2); | ^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + foo3((), 2, 2); | error: passing unit values to a function - --> tests/ui/unit_arg_fixable.rs:20:5 + --> tests/ui/unit_arg_fixable.rs:18:5 | LL | taking_two_units({}, foo(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL ~ taking_two_units((), ()); | error: passing unit values to a function - --> tests/ui/unit_arg_fixable.rs:22:5 + --> tests/ui/unit_arg_fixable.rs:20:5 | LL | taking_three_units({}, foo(0), foo(1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL ~ taking_three_units((), (), ()); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:33:5 + --> tests/ui/unit_arg_fixable.rs:31:5 | LL | fn_take_unit(Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -62,7 +62,7 @@ LL + fn_take_unit(()); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:47:5 + --> tests/ui/unit_arg_fixable.rs:45:5 | LL | fn_take_unit(another_mac!()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL ~ fn_take_unit(()); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:49:5 + --> tests/ui/unit_arg_fixable.rs:47:5 | LL | fn_take_unit(another_mac!(1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL ~ fn_take_unit(()); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:58:5 + --> tests/ui/unit_arg_fixable.rs:56:5 | LL | fn_take_unit(mac!(nondef Default::default())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -98,7 +98,7 @@ LL + fn_take_unit(mac!(nondef ())); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:60:5 + --> tests/ui/unit_arg_fixable.rs:58:5 | LL | fn_take_unit(mac!(empty_block)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL ~ fn_take_unit(()); | error: passing a unit value to a function - --> tests/ui/unit_arg_fixable.rs:67:5 + --> tests/ui/unit_arg_fixable.rs:65:5 | LL | fn_take_unit(def()); | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unit_cmp.rs b/tests/ui/unit_cmp.rs index 839987a474cd..6e2ae4bc0fb0 100644 --- a/tests/ui/unit_cmp.rs +++ b/tests/ui/unit_cmp.rs @@ -1,10 +1,5 @@ #![warn(clippy::unit_cmp)] -#![allow( - clippy::no_effect, - clippy::unnecessary_operation, - clippy::derive_partial_eq_without_eq, - clippy::needless_ifs -)] +#![expect(clippy::needless_ifs, clippy::no_effect)] #[derive(PartialEq)] pub struct ContainsUnit(()); // should be fine diff --git a/tests/ui/unit_cmp.stderr b/tests/ui/unit_cmp.stderr index 21aa9dce1510..1ac151442ebc 100644 --- a/tests/ui/unit_cmp.stderr +++ b/tests/ui/unit_cmp.stderr @@ -1,5 +1,5 @@ error: ==-comparison of unit values detected. This will always be true - --> tests/ui/unit_cmp.rs:17:8 + --> tests/ui/unit_cmp.rs:12:8 | LL | if { | ________^ @@ -15,7 +15,7 @@ LL | | } {} = help: to override `-D warnings` add `#[allow(clippy::unit_cmp)]` error: >-comparison of unit values detected. This will always be false - --> tests/ui/unit_cmp.rs:25:8 + --> tests/ui/unit_cmp.rs:20:8 | LL | if { | ________^ @@ -28,7 +28,7 @@ LL | | } {} | |_____^ error: `assert_eq` of unit values detected. This will always succeed - --> tests/ui/unit_cmp.rs:33:5 + --> tests/ui/unit_cmp.rs:28:5 | LL | / assert_eq!( LL | | @@ -39,7 +39,7 @@ LL | | ); | |_____^ error: `debug_assert_eq` of unit values detected. This will always succeed - --> tests/ui/unit_cmp.rs:42:5 + --> tests/ui/unit_cmp.rs:37:5 | LL | / debug_assert_eq!( LL | | @@ -50,7 +50,7 @@ LL | | ); | |_____^ error: `assert_ne` of unit values detected. This will always fail - --> tests/ui/unit_cmp.rs:52:5 + --> tests/ui/unit_cmp.rs:47:5 | LL | / assert_ne!( LL | | @@ -61,7 +61,7 @@ LL | | ); | |_____^ error: `debug_assert_ne` of unit values detected. This will always fail - --> tests/ui/unit_cmp.rs:61:5 + --> tests/ui/unit_cmp.rs:56:5 | LL | / debug_assert_ne!( LL | | @@ -72,7 +72,7 @@ LL | | ); | |_____^ error: `assert_eq` of unit values detected. This will always succeed - --> tests/ui/unit_cmp.rs:74:5 + --> tests/ui/unit_cmp.rs:69:5 | LL | / assert_eq!( LL | | @@ -84,7 +84,7 @@ LL | | ); | |_____^ error: `assert_eq` of unit values detected. This will always succeed - --> tests/ui/unit_cmp.rs:81:5 + --> tests/ui/unit_cmp.rs:76:5 | LL | assert_eq!(foo(), foo()); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unit_hash.fixed b/tests/ui/unit_hash.fixed index 25c90e6ddc4c..409c78f6c38c 100644 --- a/tests/ui/unit_hash.fixed +++ b/tests/ui/unit_hash.fixed @@ -1,5 +1,4 @@ #![warn(clippy::unit_hash)] -#![allow(clippy::let_unit_value)] use std::collections::hash_map::DefaultHasher; use std::hash::Hash; diff --git a/tests/ui/unit_hash.rs b/tests/ui/unit_hash.rs index b04cca6adf2a..f7e0b1d23ab2 100644 --- a/tests/ui/unit_hash.rs +++ b/tests/ui/unit_hash.rs @@ -1,5 +1,4 @@ #![warn(clippy::unit_hash)] -#![allow(clippy::let_unit_value)] use std::collections::hash_map::DefaultHasher; use std::hash::Hash; diff --git a/tests/ui/unit_hash.stderr b/tests/ui/unit_hash.stderr index d1cabf89f8e7..410cd149e1df 100644 --- a/tests/ui/unit_hash.stderr +++ b/tests/ui/unit_hash.stderr @@ -1,5 +1,5 @@ error: this call to `hash` on the unit type will do nothing - --> tests/ui/unit_hash.rs:19:23 + --> tests/ui/unit_hash.rs:18:23 | LL | Foo::Empty => ().hash(&mut state), | ^^^^^^^^^^^^^^^^^^^ help: remove the call to `hash` or consider using: `0_u8.hash(&mut state)` @@ -9,7 +9,7 @@ LL | Foo::Empty => ().hash(&mut state), = help: to override `-D warnings` add `#[allow(clippy::unit_hash)]` error: this call to `hash` on the unit type will do nothing - --> tests/ui/unit_hash.rs:25:5 + --> tests/ui/unit_hash.rs:24:5 | LL | res.hash(&mut state); | ^^^^^^^^^^^^^^^^^^^^ help: remove the call to `hash` or consider using: `0_u8.hash(&mut state)` @@ -17,7 +17,7 @@ LL | res.hash(&mut state); = note: the implementation of `Hash` for `()` is a no-op error: this call to `hash` on the unit type will do nothing - --> tests/ui/unit_hash.rs:29:5 + --> tests/ui/unit_hash.rs:28:5 | LL | do_nothing().hash(&mut state); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `hash` or consider using: `0_u8.hash(&mut state)` diff --git a/tests/ui/unit_return_expecting_ord.rs b/tests/ui/unit_return_expecting_ord.rs index 74cd30472684..de067190fe38 100644 --- a/tests/ui/unit_return_expecting_ord.rs +++ b/tests/ui/unit_return_expecting_ord.rs @@ -1,7 +1,6 @@ #![warn(clippy::unit_return_expecting_ord)] -#![allow(clippy::needless_return)] +#![expect(clippy::needless_return, clippy::useless_vec)] #![allow(clippy::unused_unit)] -#![allow(clippy::useless_vec)] struct Struct { field: isize, diff --git a/tests/ui/unit_return_expecting_ord.stderr b/tests/ui/unit_return_expecting_ord.stderr index d5ce2fb0b51d..548feada2117 100644 --- a/tests/ui/unit_return_expecting_ord.stderr +++ b/tests/ui/unit_return_expecting_ord.stderr @@ -1,11 +1,11 @@ error: this closure returns the unit type which also implements Ord - --> tests/ui/unit_return_expecting_ord.rs:18:25 + --> tests/ui/unit_return_expecting_ord.rs:17:25 | LL | structs.sort_by_key(|s| { | ^^^ | help: probably caused by this trailing semicolon - --> tests/ui/unit_return_expecting_ord.rs:21:24 + --> tests/ui/unit_return_expecting_ord.rs:20:24 | LL | double(s.field); | ^ @@ -13,25 +13,25 @@ LL | double(s.field); = help: to override `-D warnings` add `#[allow(clippy::unit_return_expecting_ord)]` error: this closure returns the unit type which also implements PartialOrd - --> tests/ui/unit_return_expecting_ord.rs:24:30 + --> tests/ui/unit_return_expecting_ord.rs:23:30 | LL | structs.is_sorted_by_key(|s| { | ^^^ | help: probably caused by this trailing semicolon - --> tests/ui/unit_return_expecting_ord.rs:27:24 + --> tests/ui/unit_return_expecting_ord.rs:26:24 | LL | double(s.field); | ^ error: this closure returns the unit type which also implements PartialOrd - --> tests/ui/unit_return_expecting_ord.rs:29:30 + --> tests/ui/unit_return_expecting_ord.rs:28:30 | LL | structs.is_sorted_by_key(|s| { | ^^^ error: this closure returns the unit type which also implements Ord - --> tests/ui/unit_return_expecting_ord.rs:41:25 + --> tests/ui/unit_return_expecting_ord.rs:40:25 | LL | structs.sort_by_key(|s| unit(s.field)); | ^^^ diff --git a/tests/ui/unnecessary_cast.fixed b/tests/ui/unnecessary_cast.fixed index 1ecc3ecf57a0..08a4b725c6af 100644 --- a/tests/ui/unnecessary_cast.fixed +++ b/tests/ui/unnecessary_cast.fixed @@ -1,13 +1,13 @@ //@aux-build:extern_fake_libc.rs #![warn(clippy::unnecessary_cast)] -#![allow( +#![expect( + nonstandard_style, + unused, clippy::borrow_as_ptr, clippy::multiple_bound_locations, clippy::no_effect, clippy::nonstandard_macro_braces, - clippy::unnecessary_operation, - nonstandard_style, - unused + clippy::unnecessary_operation )] extern crate extern_fake_libc; @@ -100,7 +100,6 @@ fn main() { // macro version macro_rules! foo { ($a:ident, $b:ident) => { - #[allow(unused)] pub fn $a() -> $b { 1 as $b } @@ -167,7 +166,6 @@ fn main() { type I32Alias = i32; mod fixable { - #![allow(dead_code)] fn main() { // casting integer literal to float is unnecessary diff --git a/tests/ui/unnecessary_cast.rs b/tests/ui/unnecessary_cast.rs index 1a6cc831aa4b..7728854468ef 100644 --- a/tests/ui/unnecessary_cast.rs +++ b/tests/ui/unnecessary_cast.rs @@ -1,13 +1,13 @@ //@aux-build:extern_fake_libc.rs #![warn(clippy::unnecessary_cast)] -#![allow( +#![expect( + nonstandard_style, + unused, clippy::borrow_as_ptr, clippy::multiple_bound_locations, clippy::no_effect, clippy::nonstandard_macro_braces, - clippy::unnecessary_operation, - nonstandard_style, - unused + clippy::unnecessary_operation )] extern crate extern_fake_libc; @@ -100,7 +100,6 @@ fn main() { // macro version macro_rules! foo { ($a:ident, $b:ident) => { - #[allow(unused)] pub fn $a() -> $b { 1 as $b } @@ -167,7 +166,6 @@ fn main() { type I32Alias = i32; mod fixable { - #![allow(dead_code)] fn main() { // casting integer literal to float is unnecessary diff --git a/tests/ui/unnecessary_cast.stderr b/tests/ui/unnecessary_cast.stderr index 19d2afcb4f25..c7fcb169121e 100644 --- a/tests/ui/unnecessary_cast.stderr +++ b/tests/ui/unnecessary_cast.stderr @@ -92,301 +92,301 @@ LL | uwu::([1u32].as_ptr()) as *const u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::([1u32].as_ptr())` error: casting to the same type is unnecessary (`u32` -> `u32`) - --> tests/ui/unnecessary_cast.rs:133:5 + --> tests/ui/unnecessary_cast.rs:132:5 | LL | aaa() as u32; | ^^^^^^^^^^^^ help: try: `aaa()` error: casting to the same type is unnecessary (`u32` -> `u32`) - --> tests/ui/unnecessary_cast.rs:136:5 + --> tests/ui/unnecessary_cast.rs:135:5 | LL | x as u32; | ^^^^^^^^ help: try: `x` error: casting to the same type is unnecessary (`u32` -> `u32`) - --> tests/ui/unnecessary_cast.rs:138:5 + --> tests/ui/unnecessary_cast.rs:137:5 | LL | bbb() as u32; | ^^^^^^^^^^^^ help: try: `bbb()` error: casting to the same type is unnecessary (`u32` -> `u32`) - --> tests/ui/unnecessary_cast.rs:141:5 + --> tests/ui/unnecessary_cast.rs:140:5 | LL | x as u32; | ^^^^^^^^ help: try: `x` error: casting integer literal to `f32` is unnecessary - --> tests/ui/unnecessary_cast.rs:174:9 + --> tests/ui/unnecessary_cast.rs:172:9 | LL | 100 as f32; | ^^^^^^^^^^ help: try: `100_f32` error: casting integer literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:176:9 + --> tests/ui/unnecessary_cast.rs:174:9 | LL | 100 as f64; | ^^^^^^^^^^ help: try: `100_f64` error: casting integer literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:178:9 + --> tests/ui/unnecessary_cast.rs:176:9 | LL | 100_i32 as f64; | ^^^^^^^^^^^^^^ help: try: `100_f64` error: casting integer literal to `f32` is unnecessary - --> tests/ui/unnecessary_cast.rs:180:17 + --> tests/ui/unnecessary_cast.rs:178:17 | LL | let _ = -100 as f32; | ^^^^^^^^^^^ help: try: `-100_f32` error: casting integer literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:182:17 + --> tests/ui/unnecessary_cast.rs:180:17 | LL | let _ = -100 as f64; | ^^^^^^^^^^^ help: try: `-100_f64` error: casting integer literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:184:17 + --> tests/ui/unnecessary_cast.rs:182:17 | LL | let _ = -100_i32 as f64; | ^^^^^^^^^^^^^^^ help: try: `-100_f64` error: casting float literal to `f32` is unnecessary - --> tests/ui/unnecessary_cast.rs:186:9 + --> tests/ui/unnecessary_cast.rs:184:9 | LL | 100. as f32; | ^^^^^^^^^^^ help: try: `100_f32` error: casting float literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:188:9 + --> tests/ui/unnecessary_cast.rs:186:9 | LL | 100. as f64; | ^^^^^^^^^^^ help: try: `100_f64` error: casting integer literal to `u32` is unnecessary - --> tests/ui/unnecessary_cast.rs:201:9 + --> tests/ui/unnecessary_cast.rs:199:9 | LL | 1 as u32; | ^^^^^^^^ help: try: `1_u32` error: casting integer literal to `i32` is unnecessary - --> tests/ui/unnecessary_cast.rs:203:9 + --> tests/ui/unnecessary_cast.rs:201:9 | LL | 0x10 as i32; | ^^^^^^^^^^^ help: try: `0x10_i32` error: casting integer literal to `usize` is unnecessary - --> tests/ui/unnecessary_cast.rs:205:9 + --> tests/ui/unnecessary_cast.rs:203:9 | LL | 0b10 as usize; | ^^^^^^^^^^^^^ help: try: `0b10_usize` error: casting integer literal to `u16` is unnecessary - --> tests/ui/unnecessary_cast.rs:207:9 + --> tests/ui/unnecessary_cast.rs:205:9 | LL | 0o73 as u16; | ^^^^^^^^^^^ help: try: `0o73_u16` error: casting integer literal to `u32` is unnecessary - --> tests/ui/unnecessary_cast.rs:209:9 + --> tests/ui/unnecessary_cast.rs:207:9 | LL | 1_000_000_000 as u32; | ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32` error: casting float literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:212:9 + --> tests/ui/unnecessary_cast.rs:210:9 | LL | 1.0 as f64; | ^^^^^^^^^^ help: try: `1.0_f64` error: casting float literal to `f32` is unnecessary - --> tests/ui/unnecessary_cast.rs:214:9 + --> tests/ui/unnecessary_cast.rs:212:9 | LL | 0.5 as f32; | ^^^^^^^^^^ help: try: `0.5_f32` error: casting integer literal to `i32` is unnecessary - --> tests/ui/unnecessary_cast.rs:219:17 + --> tests/ui/unnecessary_cast.rs:217:17 | LL | let _ = -1 as i32; | ^^^^^^^^^ help: try: `-1_i32` error: casting float literal to `f32` is unnecessary - --> tests/ui/unnecessary_cast.rs:221:17 + --> tests/ui/unnecessary_cast.rs:219:17 | LL | let _ = -1.0 as f32; | ^^^^^^^^^^^ help: try: `-1.0_f32` error: casting to the same type is unnecessary (`i32` -> `i32`) - --> tests/ui/unnecessary_cast.rs:228:18 + --> tests/ui/unnecessary_cast.rs:226:18 | LL | let _ = &(x as i32); | ^^^^^^^^^^ help: try: `{ x }` error: casting integer literal to `i32` is unnecessary - --> tests/ui/unnecessary_cast.rs:235:22 + --> tests/ui/unnecessary_cast.rs:233:22 | LL | let _: i32 = -(1) as i32; | ^^^^^^^^^^^ help: try: `-1_i32` error: casting integer literal to `i64` is unnecessary - --> tests/ui/unnecessary_cast.rs:238:22 + --> tests/ui/unnecessary_cast.rs:236:22 | LL | let _: i64 = -(1) as i64; | ^^^^^^^^^^^ help: try: `-1_i64` error: casting float literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:246:22 + --> tests/ui/unnecessary_cast.rs:244:22 | LL | let _: f64 = (-8.0 as f64).exp(); | ^^^^^^^^^^^^^ help: try: `(-8.0_f64)` error: casting float literal to `f64` is unnecessary - --> tests/ui/unnecessary_cast.rs:249:23 + --> tests/ui/unnecessary_cast.rs:247:23 | LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior | ^^^^^^^^^^^^ help: try: `8.0_f64` error: casting to the same type is unnecessary (`f32` -> `f32`) - --> tests/ui/unnecessary_cast.rs:259:20 + --> tests/ui/unnecessary_cast.rs:257:20 | LL | let _num = foo() as f32; | ^^^^^^^^^^^^ help: try: `foo()` error: casting to the same type is unnecessary (`usize` -> `usize`) - --> tests/ui/unnecessary_cast.rs:270:9 + --> tests/ui/unnecessary_cast.rs:268:9 | LL | (*x as usize).pow(2) | ^^^^^^^^^^^^^ help: try: `(*x)` error: casting to the same type is unnecessary (`usize` -> `usize`) - --> tests/ui/unnecessary_cast.rs:278:31 + --> tests/ui/unnecessary_cast.rs:276:31 | LL | assert_eq!(vec.len(), x as usize); | ^^^^^^^^^^ help: try: `x` error: casting to the same type is unnecessary (`i64` -> `i64`) - --> tests/ui/unnecessary_cast.rs:281:17 + --> tests/ui/unnecessary_cast.rs:279:17 | LL | let _ = (5i32 as i64 as i64).abs(); | ^^^^^^^^^^^^^^^^^^^^ help: try: `(5i32 as i64)` error: casting to the same type is unnecessary (`i64` -> `i64`) - --> tests/ui/unnecessary_cast.rs:284:17 + --> tests/ui/unnecessary_cast.rs:282:17 | LL | let _ = 5i32 as i64 as i64; | ^^^^^^^^^^^^^^^^^^ help: try: `5i32 as i64` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:563:24 + --> tests/ui/unnecessary_cast.rs:561:24 | LL | id::>(1.0_f64.pow_like(2) as f64 * &a).view(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:567:26 + --> tests/ui/unnecessary_cast.rs:565:26 | LL | s.id::>(1.0_f64.pow_like(2) as f64 * &a).view(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:571:26 + --> tests/ui/unnecessary_cast.rs:569:26 | LL | wrap::>(1.0_f64.pow_like(2) as f64 * &a).inner.view(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:575:28 + --> tests/ui/unnecessary_cast.rs:573:28 | LL | s.wrap::>(1.0_f64.pow_like(2) as f64 * &a).inner.view(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:591:31 + --> tests/ui/unnecessary_cast.rs:589:31 | LL | let _ = receiver.take(1.0_f64.pow_like_single_impl(2) as f64).abs(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like_single_impl(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:601:20 + --> tests/ui/unnecessary_cast.rs:599:20 | LL | let _ = id(1.0_f64.powi(2) as f64).abs(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:604:22 + --> tests/ui/unnecessary_cast.rs:602:22 | LL | let _ = wrap(1.0_f64.powi(2) as f64).inner.abs(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:607:22 + --> tests/ui/unnecessary_cast.rs:605:22 | LL | let _ = s.id(1.0_f64.powi(2) as f64).abs(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:610:24 + --> tests/ui/unnecessary_cast.rs:608:24 | LL | let _ = s.wrap(1.0_f64.powi(2) as f64).inner.abs(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:613:20 + --> tests/ui/unnecessary_cast.rs:611:20 | LL | let _ = id(1.0_f64.powi(2) as f64 * &a); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:616:22 + --> tests/ui/unnecessary_cast.rs:614:22 | LL | let _ = s.id(1.0_f64.powi(2) as f64 * &a); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:629:17 + --> tests/ui/unnecessary_cast.rs:627:17 | LL | let _ = 1.0_f64.pow_like(0.5) as f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like(0.5)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:632:17 + --> tests/ui/unnecessary_cast.rs:630:17 | LL | let _ = 1.0_f64.pow_like(2) as f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:635:17 + --> tests/ui/unnecessary_cast.rs:633:17 | LL | let _ = (1.0_f64.powi(2) as f64).abs(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.powi(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:638:17 + --> tests/ui/unnecessary_cast.rs:636:17 | LL | let _ = ((Y + 2) as f64).abs(); | ^^^^^^^^^^^^^^^^ help: try: `((Y + 2))` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:641:18 + --> tests/ui/unnecessary_cast.rs:639:18 | LL | let _ = (1.0_f64.pow_like_single_impl(2) as f64 + 1.0_f64).abs(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like_single_impl(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:644:18 + --> tests/ui/unnecessary_cast.rs:642:18 | LL | let _ = (1.0_f64.pow_like_single_impl(2) as f64 + ONE).abs(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like_single_impl(2)` error: casting to the same type is unnecessary (`f64` -> `f64`) - --> tests/ui/unnecessary_cast.rs:647:18 + --> tests/ui/unnecessary_cast.rs:645:18 | LL | let _ = (1.0_f64.pow_like_single_impl(2) as f64 + one).abs(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1.0_f64.pow_like_single_impl(2)` error: casting raw pointers to the same type and constness is unnecessary (`*const *const u8` -> `*const *const u8`) - --> tests/ui/unnecessary_cast.rs:655:10 + --> tests/ui/unnecessary_cast.rs:653:10 | LL | *(&NONE as *const _ as *const _ as *const *const u8 as *const *const u8) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&NONE as *const _ as *const _ as *const *const u8)` diff --git a/tests/ui/unnecessary_clippy_cfg.rs b/tests/ui/unnecessary_clippy_cfg.rs index 65f67df79131..0de8ccdf82a2 100644 --- a/tests/ui/unnecessary_clippy_cfg.rs +++ b/tests/ui/unnecessary_clippy_cfg.rs @@ -1,7 +1,7 @@ //@no-rustfix -#![allow(clippy::duplicated_attributes)] #![warn(clippy::unnecessary_clippy_cfg)] +#![expect(clippy::duplicated_attributes)] #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] //~^ unnecessary_clippy_cfg #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] diff --git a/tests/ui/unnecessary_filter_map.rs b/tests/ui/unnecessary_filter_map.rs index 85582c399ce5..c09293d9fef5 100644 --- a/tests/ui/unnecessary_filter_map.rs +++ b/tests/ui/unnecessary_filter_map.rs @@ -1,4 +1,5 @@ -#![allow(clippy::redundant_closure)] +#![warn(clippy::unnecessary_filter_map)] +#![expect(clippy::redundant_closure)] fn main() { let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); @@ -54,7 +55,6 @@ mod comment_483920107 { impl S { fn foo(&mut self, server_errors: Vec) { - #[allow(unused_variables)] let errors: Vec = server_errors .into_iter() .filter_map(|se| match se.severity() { diff --git a/tests/ui/unnecessary_filter_map.stderr b/tests/ui/unnecessary_filter_map.stderr index 8c33c08c267d..f5d090f8be63 100644 --- a/tests/ui/unnecessary_filter_map.stderr +++ b/tests/ui/unnecessary_filter_map.stderr @@ -1,5 +1,5 @@ error: this `.filter_map(..)` can be written more simply using `.filter(..)` - --> tests/ui/unnecessary_filter_map.rs:4:20 + --> tests/ui/unnecessary_filter_map.rs:5:20 | LL | let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let _ = (0..4).filter_map(|x| if x > 1 { Some(x) } else { None }); = help: to override `-D warnings` add `#[allow(clippy::unnecessary_filter_map)]` error: this `.filter_map(..)` can be written more simply using `.filter(..)` - --> tests/ui/unnecessary_filter_map.rs:7:20 + --> tests/ui/unnecessary_filter_map.rs:8:20 | LL | let _ = (0..4).filter_map(|x| { | ____________________^ @@ -21,7 +21,7 @@ LL | | }); | |______^ error: this `.filter_map(..)` can be written more simply using `.filter(..)` - --> tests/ui/unnecessary_filter_map.rs:15:20 + --> tests/ui/unnecessary_filter_map.rs:16:20 | LL | let _ = (0..4).filter_map(|x| match x { | ____________________^ @@ -32,13 +32,13 @@ LL | | }); | |______^ error: this `.filter_map(..)` can be written more simply using `.map(..)` - --> tests/ui/unnecessary_filter_map.rs:21:20 + --> tests/ui/unnecessary_filter_map.rs:22:20 | LL | let _ = (0..4).filter_map(|x| Some(x + 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this call to `.filter_map(..)` is unnecessary - --> tests/ui/unnecessary_filter_map.rs:28:46 + --> tests/ui/unnecessary_filter_map.rs:29:46 | LL | let _ = vec![Some(10), None].into_iter().filter_map(|x| Some(x)); | ^^^^^^^^^^^^^^^^^^^^^^^ From 593c20d1276a1dcd2ef956b15919a306058901df Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 08/11] Attributes cleanup in tests [16/20] --- tests/ui/ref_as_ptr.fixed | 2 +- tests/ui/ref_as_ptr.rs | 2 +- tests/ui/ref_binding_to_reference.rs | 3 +- tests/ui/ref_binding_to_reference.stderr | 14 +-- tests/ui/ref_option_ref.rs | 1 - tests/ui/ref_option_ref.stderr | 22 ++-- tests/ui/ref_patterns.rs | 1 - tests/ui/ref_patterns.stderr | 6 +- tests/ui/regex.rs | 10 +- tests/ui/regex.stderr | 64 +++++----- tests/ui/repeat_vec_with_capacity.fixed | 1 - tests/ui/repeat_vec_with_capacity.rs | 1 - tests/ui/repeat_vec_with_capacity.stderr | 6 +- .../ui/rest_pat_in_fully_bound_structs.fixed | 2 +- tests/ui/rest_pat_in_fully_bound_structs.rs | 2 +- tests/ui/result_filter_map.fixed | 2 +- tests/ui/result_filter_map.rs | 2 +- tests/ui/result_large_err.rs | 2 +- tests/ui/result_map_unit_fn_unfixable.rs | 2 +- tests/ui/return_and_then.fixed | 2 +- tests/ui/return_and_then.rs | 2 +- tests/ui/reversed_empty_ranges_fixable.fixed | 2 +- tests/ui/reversed_empty_ranges_fixable.rs | 2 +- .../reversed_empty_ranges_loops_fixable.fixed | 2 +- .../ui/reversed_empty_ranges_loops_fixable.rs | 2 +- .../reversed_empty_ranges_loops_unfixable.rs | 2 +- tests/ui/same_functions_in_if_condition.rs | 5 +- .../ui/same_functions_in_if_condition.stderr | 19 ++- tests/ui/same_name_method.rs | 2 +- tests/ui/search_is_some.rs | 3 +- tests/ui/search_is_some.stderr | 4 +- tests/ui/search_is_some_fixable_none.fixed | 3 +- tests/ui/search_is_some_fixable_none.rs | 3 +- tests/ui/search_is_some_fixable_none.stderr | 114 +++++++++--------- tests/ui/search_is_some_fixable_some.fixed | 3 +- tests/ui/search_is_some_fixable_some.rs | 3 +- tests/ui/search_is_some_fixable_some.stderr | 98 +++++++-------- .../ui/seek_to_start_instead_of_rewind.fixed | 1 - tests/ui/seek_to_start_instead_of_rewind.rs | 1 - .../ui/seek_to_start_instead_of_rewind.stderr | 6 +- tests/ui/self_assignment.rs | 2 +- tests/ui/semicolon_if_nothing_returned.fixed | 8 +- tests/ui/semicolon_if_nothing_returned.rs | 8 +- tests/ui/semicolon_if_nothing_returned.stderr | 10 +- tests/ui/semicolon_inside_block.fixed | 11 +- tests/ui/semicolon_inside_block.rs | 11 +- tests/ui/semicolon_inside_block.stderr | 8 +- ...micolon_inside_block_stmt_expr_attrs.fixed | 2 +- .../semicolon_inside_block_stmt_expr_attrs.rs | 2 +- tests/ui/semicolon_outside_block.fixed | 11 +- tests/ui/semicolon_outside_block.rs | 11 +- tests/ui/semicolon_outside_block.stderr | 12 +- tests/ui/serde.rs | 1 - tests/ui/serde.stderr | 2 +- tests/ui/set_contains_or_insert.rs | 5 +- tests/ui/set_contains_or_insert.stderr | 30 ++--- tests/ui/shadow.rs | 9 +- tests/ui/shadow.stderr | 104 ++++++++-------- tests/ui/short_circuit_statement.fixed | 1 - tests/ui/short_circuit_statement.rs | 1 - tests/ui/short_circuit_statement.stderr | 14 +-- tests/ui/should_impl_trait/corner_cases.rs | 14 +-- .../method_list_1.edition2015.stderr | 30 ++--- .../method_list_1.edition2021.stderr | 30 ++--- tests/ui/should_impl_trait/method_list_1.rs | 12 +- .../method_list_2.edition2015.stderr | 28 ++--- .../method_list_2.edition2021.stderr | 30 ++--- tests/ui/should_impl_trait/method_list_2.rs | 12 +- tests/ui/significant_drop_in_scrutinee.rs | 8 +- tests/ui/significant_drop_in_scrutinee.stderr | 62 +++++----- tests/ui/similar_names.rs | 8 +- tests/ui/similar_names.stderr | 24 ++-- tests/ui/single_call_fn.rs | 1 - tests/ui/single_call_fn.stderr | 24 ++-- tests/ui/single_char_add_str.fixed | 1 - tests/ui/single_char_add_str.rs | 1 - tests/ui/single_char_add_str.stderr | 42 +++---- tests/ui/single_char_lifetime_names.rs | 1 - tests/ui/single_char_lifetime_names.stderr | 10 +- 79 files changed, 476 insertions(+), 549 deletions(-) diff --git a/tests/ui/ref_as_ptr.fixed b/tests/ui/ref_as_ptr.fixed index eadbb7c36415..d00a2fd693f6 100644 --- a/tests/ui/ref_as_ptr.fixed +++ b/tests/ui/ref_as_ptr.fixed @@ -1,5 +1,5 @@ #![warn(clippy::ref_as_ptr)] -#![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)] +#![allow(clippy::unnecessary_mut_passed)] fn f(_: T) {} diff --git a/tests/ui/ref_as_ptr.rs b/tests/ui/ref_as_ptr.rs index ef96a3ff5693..c9b87256290f 100644 --- a/tests/ui/ref_as_ptr.rs +++ b/tests/ui/ref_as_ptr.rs @@ -1,5 +1,5 @@ #![warn(clippy::ref_as_ptr)] -#![allow(clippy::unnecessary_mut_passed, clippy::needless_lifetimes)] +#![allow(clippy::unnecessary_mut_passed)] fn f(_: T) {} diff --git a/tests/ui/ref_binding_to_reference.rs b/tests/ui/ref_binding_to_reference.rs index 365fd8edea78..a0f0b7b46ea4 100644 --- a/tests/ui/ref_binding_to_reference.rs +++ b/tests/ui/ref_binding_to_reference.rs @@ -1,7 +1,7 @@ // FIXME: run-rustfix waiting on multi-span suggestions //@no-rustfix #![warn(clippy::ref_binding_to_reference)] -#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)] +#![expect(clippy::explicit_auto_deref, clippy::needless_borrowed_reference)] fn f1(_: &str) {} macro_rules! m2 { @@ -15,7 +15,6 @@ macro_rules! m3 { }; } -#[allow(dead_code)] fn main() { let x = String::new(); diff --git a/tests/ui/ref_binding_to_reference.stderr b/tests/ui/ref_binding_to_reference.stderr index c1adfab12bcb..d06ca7458527 100644 --- a/tests/ui/ref_binding_to_reference.stderr +++ b/tests/ui/ref_binding_to_reference.stderr @@ -1,5 +1,5 @@ error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:30:14 + --> tests/ui/ref_binding_to_reference.rs:29:14 | LL | Some(ref x) => x, | ^^^^^ @@ -13,7 +13,7 @@ LL + Some(x) => &x, | error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:37:14 + --> tests/ui/ref_binding_to_reference.rs:36:14 | LL | Some(ref x) => { | ^^^^^ @@ -29,7 +29,7 @@ LL ~ &x | error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:49:14 + --> tests/ui/ref_binding_to_reference.rs:48:14 | LL | Some(ref x) => m2!(x), | ^^^^^ @@ -41,7 +41,7 @@ LL + Some(x) => m2!(&x), | error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:55:15 + --> tests/ui/ref_binding_to_reference.rs:54:15 | LL | let _ = |&ref x: &&String| { | ^^^^^ @@ -55,7 +55,7 @@ LL ~ let _: &&String = &x; | error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:63:12 + --> tests/ui/ref_binding_to_reference.rs:62:12 | LL | fn f2<'a>(&ref x: &&'a String) -> &'a String { | ^^^^^ @@ -70,7 +70,7 @@ LL ~ x | error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:72:11 + --> tests/ui/ref_binding_to_reference.rs:71:11 | LL | fn f(&ref x: &&String) { | ^^^^^ @@ -84,7 +84,7 @@ LL ~ let _: &&String = &x; | error: this pattern creates a reference to a reference - --> tests/ui/ref_binding_to_reference.rs:82:11 + --> tests/ui/ref_binding_to_reference.rs:81:11 | LL | fn f(&ref x: &&String) { | ^^^^^ diff --git a/tests/ui/ref_option_ref.rs b/tests/ui/ref_option_ref.rs index 9632611f7df4..7bcaddf4467c 100644 --- a/tests/ui/ref_option_ref.rs +++ b/tests/ui/ref_option_ref.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::ref_option_ref)] //@no-rustfix // This lint is not tagged as run-rustfix because automatically diff --git a/tests/ui/ref_option_ref.stderr b/tests/ui/ref_option_ref.stderr index 25064a61ee88..1dbd6244b1ee 100644 --- a/tests/ui/ref_option_ref.stderr +++ b/tests/ui/ref_option_ref.stderr @@ -1,5 +1,5 @@ error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:10:23 + --> tests/ui/ref_option_ref.rs:9:23 | LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD); | ^^^^^^^^^^^^^ help: try: `Option<&i32>` @@ -8,61 +8,61 @@ LL | static REF_THRESHOLD: &Option<&i32> = &Some(&THRESHOLD); = help: to override `-D warnings` add `#[allow(clippy::ref_option_ref)]` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:14:18 + --> tests/ui/ref_option_ref.rs:13:18 | LL | const REF_CONST: &Option<&i32> = &Some(CONST_THRESHOLD); | ^^^^^^^^^^^^^ help: try: `Option<&i32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:17:25 + --> tests/ui/ref_option_ref.rs:16:25 | LL | type RefOptRefU32<'a> = &'a Option<&'a u32>; | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:20:25 + --> tests/ui/ref_option_ref.rs:19:25 | LL | type RefOptRef<'a, T> = &'a Option<&'a T>; | ^^^^^^^^^^^^^^^^^ help: try: `Option<&'a T>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:23:14 + --> tests/ui/ref_option_ref.rs:22:14 | LL | fn foo(data: &Option<&u32>) {} | ^^^^^^^^^^^^^ help: try: `Option<&u32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:26:23 + --> tests/ui/ref_option_ref.rs:25:23 | LL | fn bar(data: &u32) -> &Option<&u32> { | ^^^^^^^^^^^^^ help: try: `Option<&u32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:33:11 + --> tests/ui/ref_option_ref.rs:32:11 | LL | data: &'a Option<&'a u32>, | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:37:32 + --> tests/ui/ref_option_ref.rs:36:32 | LL | struct StructTupleRef<'a>(u32, &'a Option<&'a u32>); | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:42:14 + --> tests/ui/ref_option_ref.rs:41:14 | LL | Variant2(&'a Option<&'a u32>), | ^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'a u32>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:52:14 + --> tests/ui/ref_option_ref.rs:51:14 | LL | type A = &'static Option<&'static Self>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option<&'static Self>` error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>` - --> tests/ui/ref_option_ref.rs:59:12 + --> tests/ui/ref_option_ref.rs:58:12 | LL | let x: &Option<&u32> = &None; | ^^^^^^^^^^^^^ help: try: `Option<&u32>` diff --git a/tests/ui/ref_patterns.rs b/tests/ui/ref_patterns.rs index 2905af13ccb6..fb3ae912d13d 100644 --- a/tests/ui/ref_patterns.rs +++ b/tests/ui/ref_patterns.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::ref_patterns)] fn use_in_pattern() { diff --git a/tests/ui/ref_patterns.stderr b/tests/ui/ref_patterns.stderr index 9e2d036e3483..af593835ea78 100644 --- a/tests/ui/ref_patterns.stderr +++ b/tests/ui/ref_patterns.stderr @@ -1,5 +1,5 @@ error: usage of ref pattern - --> tests/ui/ref_patterns.rs:8:14 + --> tests/ui/ref_patterns.rs:7:14 | LL | Some(ref opt) => {}, | ^^^^^^^ @@ -9,7 +9,7 @@ LL | Some(ref opt) => {}, = help: to override `-D warnings` add `#[allow(clippy::ref_patterns)]` error: usage of ref pattern - --> tests/ui/ref_patterns.rs:15:9 + --> tests/ui/ref_patterns.rs:14:9 | LL | let ref y = x; | ^^^^^ @@ -17,7 +17,7 @@ LL | let ref y = x; = help: consider using `&` for clarity instead error: usage of ref pattern - --> tests/ui/ref_patterns.rs:19:21 + --> tests/ui/ref_patterns.rs:18:21 | LL | fn use_in_parameter(ref x: i32) {} | ^^^^^ diff --git a/tests/ui/regex.rs b/tests/ui/regex.rs index 699256f22c01..2e28017ab117 100644 --- a/tests/ui/regex.rs +++ b/tests/ui/regex.rs @@ -1,12 +1,6 @@ //@require-annotations-for-level: WARN -#![allow( - unused, - clippy::needless_raw_strings, - clippy::needless_raw_string_hashes, - clippy::needless_borrow, - clippy::needless_borrows_for_generic_args -)] -#![warn(clippy::invalid_regex, clippy::trivial_regex, clippy::regex_creation_in_loops)] +#![warn(clippy::invalid_regex, clippy::regex_creation_in_loops, clippy::trivial_regex)] +#![expect(clippy::needless_borrows_for_generic_args)] extern crate regex; diff --git a/tests/ui/regex.stderr b/tests/ui/regex.stderr index aaec3bc14200..159e55baafb5 100644 --- a/tests/ui/regex.stderr +++ b/tests/ui/regex.stderr @@ -1,5 +1,5 @@ error: trivial regex - --> tests/ui/regex.rs:20:45 + --> tests/ui/regex.rs:14:45 | LL | let pipe_in_wrong_position = Regex::new("|"); | ^^^ @@ -9,7 +9,7 @@ LL | let pipe_in_wrong_position = Regex::new("|"); = help: to override `-D warnings` add `#[allow(clippy::trivial_regex)]` error: trivial regex - --> tests/ui/regex.rs:22:60 + --> tests/ui/regex.rs:16:60 | LL | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); | ^^^ @@ -17,7 +17,7 @@ LL | let pipe_in_wrong_position_builder = RegexBuilder::new("|"); = help: the regex is unlikely to be useful as it is error: regex syntax error: invalid character class range, the start must be <= the end - --> tests/ui/regex.rs:24:42 + --> tests/ui/regex.rs:18:42 | LL | let wrong_char_ranice = Regex::new("[z-a]"); | ^^^ @@ -26,7 +26,7 @@ LL | let wrong_char_ranice = Regex::new("[z-a]"); = help: to override `-D warnings` add `#[allow(clippy::invalid_regex)]` error: regex syntax error: invalid character class range, the start must be <= the end - --> tests/ui/regex.rs:27:37 + --> tests/ui/regex.rs:21:37 | LL | let some_unicode = Regex::new("[é-è]"); | ^^^ @@ -35,13 +35,13 @@ error: regex parse error: ( ^ error: unclosed group - --> tests/ui/regex.rs:30:33 + --> tests/ui/regex.rs:24:33 | LL | let some_regex = Regex::new(OPENING_PAREN); | ^^^^^^^^^^^^^ error: trivial regex - --> tests/ui/regex.rs:33:53 + --> tests/ui/regex.rs:27:53 | LL | let binary_pipe_in_wrong_position = BRegex::new("|"); | ^^^ @@ -52,7 +52,7 @@ error: regex parse error: ( ^ error: unclosed group - --> tests/ui/regex.rs:35:41 + --> tests/ui/regex.rs:29:41 | LL | let some_binary_regex = BRegex::new(OPENING_PAREN); | ^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ error: regex parse error: ( ^ error: unclosed group - --> tests/ui/regex.rs:37:56 + --> tests/ui/regex.rs:31:56 | LL | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN); | ^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ error: regex parse error: ( ^ error: unclosed group - --> tests/ui/regex.rs:50:37 + --> tests/ui/regex.rs:44:37 | LL | let set_error = RegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]); | ^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ error: regex parse error: ( ^ error: unclosed group - --> tests/ui/regex.rs:52:39 + --> tests/ui/regex.rs:46:39 | LL | let bset_error = BRegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]); | ^^^^^^^^^^^^^ @@ -88,7 +88,7 @@ error: regex parse error: \b\c ^^ error: unrecognized escape sequence - --> tests/ui/regex.rs:60:42 + --> tests/ui/regex.rs:54:42 | LL | let escaped_string_span = Regex::new("\\b\\c"); | ^^^^^^^^ @@ -96,19 +96,19 @@ LL | let escaped_string_span = Regex::new("\\b\\c"); = help: consider using a raw string literal: `r".."` error: regex syntax error: duplicate flag - --> tests/ui/regex.rs:63:34 + --> tests/ui/regex.rs:57:34 | LL | let aux_span = Regex::new("(?ixi)"); | ^ ^ error: regex syntax error: pattern can match invalid UTF-8 - --> tests/ui/regex.rs:69:53 + --> tests/ui/regex.rs:63:53 | LL | let invalid_utf8_should_lint = Regex::new("(?-u)."); | ^ error: trivial regex - --> tests/ui/regex.rs:74:33 + --> tests/ui/regex.rs:68:33 | LL | let trivial_eq = Regex::new("^foobar$"); | ^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | let trivial_eq = Regex::new("^foobar$"); = help: consider using `==` on `str`s error: trivial regex - --> tests/ui/regex.rs:77:48 + --> tests/ui/regex.rs:71:48 | LL | let trivial_eq_builder = RegexBuilder::new("^foobar$"); | ^^^^^^^^^^ @@ -124,7 +124,7 @@ LL | let trivial_eq_builder = RegexBuilder::new("^foobar$"); = help: consider using `==` on `str`s error: trivial regex - --> tests/ui/regex.rs:80:42 + --> tests/ui/regex.rs:74:42 | LL | let trivial_starts_with = Regex::new("^foobar"); | ^^^^^^^^^ @@ -132,7 +132,7 @@ LL | let trivial_starts_with = Regex::new("^foobar"); = help: consider using `str::starts_with` error: trivial regex - --> tests/ui/regex.rs:83:40 + --> tests/ui/regex.rs:77:40 | LL | let trivial_ends_with = Regex::new("foobar$"); | ^^^^^^^^^ @@ -140,7 +140,7 @@ LL | let trivial_ends_with = Regex::new("foobar$"); = help: consider using `str::ends_with` error: trivial regex - --> tests/ui/regex.rs:86:39 + --> tests/ui/regex.rs:80:39 | LL | let trivial_contains = Regex::new("foobar"); | ^^^^^^^^ @@ -148,7 +148,7 @@ LL | let trivial_contains = Regex::new("foobar"); = help: consider using `str::contains` error: trivial regex - --> tests/ui/regex.rs:89:39 + --> tests/ui/regex.rs:83:39 | LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX); | ^^^^^^^^^^^^^^^^ @@ -156,7 +156,7 @@ LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX); = help: consider using `str::contains` error: trivial regex - --> tests/ui/regex.rs:92:40 + --> tests/ui/regex.rs:86:40 | LL | let trivial_backslash = Regex::new("a\\.b"); | ^^^^^^^ @@ -164,7 +164,7 @@ LL | let trivial_backslash = Regex::new("a\\.b"); = help: consider using `str::contains` error: trivial regex - --> tests/ui/regex.rs:96:36 + --> tests/ui/regex.rs:90:36 | LL | let trivial_empty = Regex::new(""); | ^^ @@ -172,7 +172,7 @@ LL | let trivial_empty = Regex::new(""); = help: the regex is unlikely to be useful as it is error: trivial regex - --> tests/ui/regex.rs:99:36 + --> tests/ui/regex.rs:93:36 | LL | let trivial_empty = Regex::new("^"); | ^^^ @@ -180,7 +180,7 @@ LL | let trivial_empty = Regex::new("^"); = help: the regex is unlikely to be useful as it is error: trivial regex - --> tests/ui/regex.rs:102:36 + --> tests/ui/regex.rs:96:36 | LL | let trivial_empty = Regex::new("^$"); | ^^^^ @@ -188,7 +188,7 @@ LL | let trivial_empty = Regex::new("^$"); = help: consider using `str::is_empty` error: trivial regex - --> tests/ui/regex.rs:105:44 + --> tests/ui/regex.rs:99:44 | LL | let binary_trivial_empty = BRegex::new("^$"); | ^^^^ @@ -196,13 +196,13 @@ LL | let binary_trivial_empty = BRegex::new("^$"); = help: consider using `str::is_empty` error: compiling a regex in a loop - --> tests/ui/regex.rs:132:21 + --> tests/ui/regex.rs:126:21 | LL | let regex = Regex::new("a.b"); | ^^^^^^^^^^ | help: move the regex construction outside this loop - --> tests/ui/regex.rs:129:5 + --> tests/ui/regex.rs:123:5 | LL | loop { | ^^^^ @@ -210,37 +210,37 @@ LL | loop { = help: to override `-D warnings` add `#[allow(clippy::regex_creation_in_loops)]` error: compiling a regex in a loop - --> tests/ui/regex.rs:134:21 + --> tests/ui/regex.rs:128:21 | LL | let regex = BRegex::new("a.b"); | ^^^^^^^^^^^ | help: move the regex construction outside this loop - --> tests/ui/regex.rs:129:5 + --> tests/ui/regex.rs:123:5 | LL | loop { | ^^^^ error: compiling a regex in a loop - --> tests/ui/regex.rs:140:25 + --> tests/ui/regex.rs:134:25 | LL | let regex = Regex::new("a.b"); | ^^^^^^^^^^ | help: move the regex construction outside this loop - --> tests/ui/regex.rs:129:5 + --> tests/ui/regex.rs:123:5 | LL | loop { | ^^^^ error: compiling a regex in a loop - --> tests/ui/regex.rs:145:32 + --> tests/ui/regex.rs:139:32 | LL | let nested_regex = Regex::new("a.b"); | ^^^^^^^^^^ | help: move the regex construction outside this loop - --> tests/ui/regex.rs:144:9 + --> tests/ui/regex.rs:138:9 | LL | for _ in 0..10 { | ^^^^^^^^^^^^^^ diff --git a/tests/ui/repeat_vec_with_capacity.fixed b/tests/ui/repeat_vec_with_capacity.fixed index 8a3b0b4f193f..db2b788d6e92 100644 --- a/tests/ui/repeat_vec_with_capacity.fixed +++ b/tests/ui/repeat_vec_with_capacity.fixed @@ -1,4 +1,3 @@ -#![allow(clippy::map_with_unused_argument_over_ranges)] #![warn(clippy::repeat_vec_with_capacity)] fn main() { diff --git a/tests/ui/repeat_vec_with_capacity.rs b/tests/ui/repeat_vec_with_capacity.rs index 011202d84757..547c24aee353 100644 --- a/tests/ui/repeat_vec_with_capacity.rs +++ b/tests/ui/repeat_vec_with_capacity.rs @@ -1,4 +1,3 @@ -#![allow(clippy::map_with_unused_argument_over_ranges)] #![warn(clippy::repeat_vec_with_capacity)] fn main() { diff --git a/tests/ui/repeat_vec_with_capacity.stderr b/tests/ui/repeat_vec_with_capacity.stderr index 05513a8859a4..3da26a12ae38 100644 --- a/tests/ui/repeat_vec_with_capacity.stderr +++ b/tests/ui/repeat_vec_with_capacity.stderr @@ -1,5 +1,5 @@ error: repeating `Vec::with_capacity` using `vec![x; n]`, which does not retain capacity - --> tests/ui/repeat_vec_with_capacity.rs:6:9 + --> tests/ui/repeat_vec_with_capacity.rs:5:9 | LL | vec![Vec::<()>::with_capacity(42); 123]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL + (0..123).map(|_| Vec::<()>::with_capacity(42)).collect::>(); | error: repeating `Vec::with_capacity` using `vec![x; n]`, which does not retain capacity - --> tests/ui/repeat_vec_with_capacity.rs:12:9 + --> tests/ui/repeat_vec_with_capacity.rs:11:9 | LL | vec![Vec::<()>::with_capacity(42); n]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL + (0..n).map(|_| Vec::<()>::with_capacity(42)).collect::>(); | error: repeating `Vec::with_capacity` using `iter::repeat`, which does not retain capacity - --> tests/ui/repeat_vec_with_capacity.rs:27:9 + --> tests/ui/repeat_vec_with_capacity.rs:26:9 | LL | std::iter::repeat(Vec::<()>::with_capacity(42)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rest_pat_in_fully_bound_structs.fixed b/tests/ui/rest_pat_in_fully_bound_structs.fixed index ac200b3b19b7..6e33fda50dd9 100644 --- a/tests/ui/rest_pat_in_fully_bound_structs.fixed +++ b/tests/ui/rest_pat_in_fully_bound_structs.fixed @@ -1,5 +1,5 @@ #![warn(clippy::rest_pat_in_fully_bound_structs)] -#![allow(clippy::struct_field_names)] +#![expect(clippy::struct_field_names)] struct A { a: i32, diff --git a/tests/ui/rest_pat_in_fully_bound_structs.rs b/tests/ui/rest_pat_in_fully_bound_structs.rs index bede01688972..7007dfcf5ed4 100644 --- a/tests/ui/rest_pat_in_fully_bound_structs.rs +++ b/tests/ui/rest_pat_in_fully_bound_structs.rs @@ -1,5 +1,5 @@ #![warn(clippy::rest_pat_in_fully_bound_structs)] -#![allow(clippy::struct_field_names)] +#![expect(clippy::struct_field_names)] struct A { a: i32, diff --git a/tests/ui/result_filter_map.fixed b/tests/ui/result_filter_map.fixed index e8943dbc72da..6b4186bcce26 100644 --- a/tests/ui/result_filter_map.fixed +++ b/tests/ui/result_filter_map.fixed @@ -1,5 +1,5 @@ #![warn(clippy::result_filter_map)] -#![allow(clippy::map_flatten, clippy::unnecessary_map_on_constructor)] +#![allow(clippy::map_flatten)] fn odds_out(x: i32) -> Result { if x % 2 == 0 { Ok(x) } else { Err(()) } diff --git a/tests/ui/result_filter_map.rs b/tests/ui/result_filter_map.rs index ebd9c4288e3b..473694256330 100644 --- a/tests/ui/result_filter_map.rs +++ b/tests/ui/result_filter_map.rs @@ -1,5 +1,5 @@ #![warn(clippy::result_filter_map)] -#![allow(clippy::map_flatten, clippy::unnecessary_map_on_constructor)] +#![allow(clippy::map_flatten)] fn odds_out(x: i32) -> Result { if x % 2 == 0 { Ok(x) } else { Err(()) } diff --git a/tests/ui/result_large_err.rs b/tests/ui/result_large_err.rs index 0056c54ff5d4..70822bfa1230 100644 --- a/tests/ui/result_large_err.rs +++ b/tests/ui/result_large_err.rs @@ -1,7 +1,7 @@ //@ignore-bitwidth: 32 #![warn(clippy::result_large_err)] -#![allow(clippy::large_enum_variant)] +#![expect(clippy::large_enum_variant)] pub fn small_err() -> Result<(), u128> { Ok(()) diff --git a/tests/ui/result_map_unit_fn_unfixable.rs b/tests/ui/result_map_unit_fn_unfixable.rs index e3f5c7f996da..8453e57d43fb 100644 --- a/tests/ui/result_map_unit_fn_unfixable.rs +++ b/tests/ui/result_map_unit_fn_unfixable.rs @@ -1,7 +1,7 @@ //@no-rustfix #![warn(clippy::result_map_unit_fn)] #![feature(never_type)] -#![allow(clippy::unnecessary_map_on_constructor)] +#![expect(clippy::unnecessary_map_on_constructor)] struct HasResult { field: Result, diff --git a/tests/ui/return_and_then.fixed b/tests/ui/return_and_then.fixed index be9a8e1da5c6..a0a6314038aa 100644 --- a/tests/ui/return_and_then.fixed +++ b/tests/ui/return_and_then.fixed @@ -1,5 +1,5 @@ #![warn(clippy::return_and_then)] -#![allow(clippy::manual_filter)] +#![expect(clippy::manual_filter)] fn main() { fn test_opt_block(opt: Option) -> Option { diff --git a/tests/ui/return_and_then.rs b/tests/ui/return_and_then.rs index 5d8372e418bf..8ab52ed016dc 100644 --- a/tests/ui/return_and_then.rs +++ b/tests/ui/return_and_then.rs @@ -1,5 +1,5 @@ #![warn(clippy::return_and_then)] -#![allow(clippy::manual_filter)] +#![expect(clippy::manual_filter)] fn main() { fn test_opt_block(opt: Option) -> Option { diff --git a/tests/ui/reversed_empty_ranges_fixable.fixed b/tests/ui/reversed_empty_ranges_fixable.fixed index 6c866aceed4f..561e75e27ad2 100644 --- a/tests/ui/reversed_empty_ranges_fixable.fixed +++ b/tests/ui/reversed_empty_ranges_fixable.fixed @@ -1,5 +1,5 @@ #![warn(clippy::reversed_empty_ranges)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] const ANSWER: i32 = 42; diff --git a/tests/ui/reversed_empty_ranges_fixable.rs b/tests/ui/reversed_empty_ranges_fixable.rs index 4068bc393066..cc175673b19b 100644 --- a/tests/ui/reversed_empty_ranges_fixable.rs +++ b/tests/ui/reversed_empty_ranges_fixable.rs @@ -1,5 +1,5 @@ #![warn(clippy::reversed_empty_ranges)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] const ANSWER: i32 = 42; diff --git a/tests/ui/reversed_empty_ranges_loops_fixable.fixed b/tests/ui/reversed_empty_ranges_loops_fixable.fixed index 9fb46c9533cd..e10eeca83f31 100644 --- a/tests/ui/reversed_empty_ranges_loops_fixable.fixed +++ b/tests/ui/reversed_empty_ranges_loops_fixable.fixed @@ -1,5 +1,5 @@ #![warn(clippy::reversed_empty_ranges)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] fn main() { const MAX_LEN: usize = 42; diff --git a/tests/ui/reversed_empty_ranges_loops_fixable.rs b/tests/ui/reversed_empty_ranges_loops_fixable.rs index e51557bc2796..64c376bbca28 100644 --- a/tests/ui/reversed_empty_ranges_loops_fixable.rs +++ b/tests/ui/reversed_empty_ranges_loops_fixable.rs @@ -1,5 +1,5 @@ #![warn(clippy::reversed_empty_ranges)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] fn main() { const MAX_LEN: usize = 42; diff --git a/tests/ui/reversed_empty_ranges_loops_unfixable.rs b/tests/ui/reversed_empty_ranges_loops_unfixable.rs index 00aa20d25bda..f5f53a4bd077 100644 --- a/tests/ui/reversed_empty_ranges_loops_unfixable.rs +++ b/tests/ui/reversed_empty_ranges_loops_unfixable.rs @@ -1,5 +1,5 @@ #![warn(clippy::reversed_empty_ranges)] -#![allow(clippy::uninlined_format_args)] +#![expect(clippy::uninlined_format_args)] fn main() { for i in 5..5 { diff --git a/tests/ui/same_functions_in_if_condition.rs b/tests/ui/same_functions_in_if_condition.rs index 3f205b322ab0..9801701cb63c 100644 --- a/tests/ui/same_functions_in_if_condition.rs +++ b/tests/ui/same_functions_in_if_condition.rs @@ -1,9 +1,8 @@ #![feature(adt_const_params)] -#![deny(clippy::same_functions_in_if_condition)] +#![warn(clippy::same_functions_in_if_condition)] // ifs_same_cond warning is different from `ifs_same_cond`. // clippy::if_same_then_else, clippy::comparison_chain -- all empty blocks -#![allow(incomplete_features)] -#![allow(clippy::if_same_then_else, clippy::ifs_same_cond, clippy::uninlined_format_args)] +#![expect(clippy::ifs_same_cond)] use std::marker::ConstParamTy; diff --git a/tests/ui/same_functions_in_if_condition.stderr b/tests/ui/same_functions_in_if_condition.stderr index 59f4511757d6..1d9ce73fbeaa 100644 --- a/tests/ui/same_functions_in_if_condition.stderr +++ b/tests/ui/same_functions_in_if_condition.stderr @@ -1,5 +1,5 @@ error: these `if` branches have the same function call - --> tests/ui/same_functions_in_if_condition.rs:33:8 + --> tests/ui/same_functions_in_if_condition.rs:32:8 | LL | if function() { | ^^^^^^^^^^ @@ -7,14 +7,11 @@ LL | LL | } else if function() { | ^^^^^^^^^^ | -note: the lint level is defined here - --> tests/ui/same_functions_in_if_condition.rs:2:9 - | -LL | #![deny(clippy::same_functions_in_if_condition)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::same-functions-in-if-condition` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::same_functions_in_if_condition)]` error: these `if` branches have the same function call - --> tests/ui/same_functions_in_if_condition.rs:38:8 + --> tests/ui/same_functions_in_if_condition.rs:37:8 | LL | if fn_arg(a) { | ^^^^^^^^^ @@ -23,7 +20,7 @@ LL | } else if fn_arg(a) { | ^^^^^^^^^ error: these `if` branches have the same function call - --> tests/ui/same_functions_in_if_condition.rs:43:8 + --> tests/ui/same_functions_in_if_condition.rs:42:8 | LL | if obj.method() { | ^^^^^^^^^^^^ @@ -32,7 +29,7 @@ LL | } else if obj.method() { | ^^^^^^^^^^^^ error: these `if` branches have the same function call - --> tests/ui/same_functions_in_if_condition.rs:48:8 + --> tests/ui/same_functions_in_if_condition.rs:47:8 | LL | if obj.method_arg(a) { | ^^^^^^^^^^^^^^^^^ @@ -41,7 +38,7 @@ LL | } else if obj.method_arg(a) { | ^^^^^^^^^^^^^^^^^ error: these `if` branches have the same function call - --> tests/ui/same_functions_in_if_condition.rs:54:8 + --> tests/ui/same_functions_in_if_condition.rs:53:8 | LL | if v.pop().is_none() { | ^^^^^^^^^^^^^^^^^ @@ -50,7 +47,7 @@ LL | } else if v.pop().is_none() { | ^^^^^^^^^^^^^^^^^ error: these `if` branches have the same function call - --> tests/ui/same_functions_in_if_condition.rs:59:8 + --> tests/ui/same_functions_in_if_condition.rs:58:8 | LL | if v.len() == 42 { | ^^^^^^^^^^^^^ diff --git a/tests/ui/same_name_method.rs b/tests/ui/same_name_method.rs index 43c664b1505f..684cc2ff833f 100644 --- a/tests/ui/same_name_method.rs +++ b/tests/ui/same_name_method.rs @@ -1,5 +1,5 @@ #![warn(clippy::same_name_method)] -#![allow(dead_code, non_camel_case_types)] +#![expect(non_camel_case_types)] trait T1 { fn foo() {} diff --git a/tests/ui/search_is_some.rs b/tests/ui/search_is_some.rs index 0a1e0b07d1eb..3df2ce7a95a0 100644 --- a/tests/ui/search_is_some.rs +++ b/tests/ui/search_is_some.rs @@ -1,8 +1,7 @@ //@aux-build:option_helpers.rs #![warn(clippy::search_is_some)] -#![allow(clippy::manual_pattern_char_comparison)] +#![expect(clippy::manual_pattern_char_comparison)] #![allow(clippy::useless_vec)] -#![allow(dead_code)] extern crate option_helpers; use option_helpers::IteratorFalsePositives; //@no-rustfix diff --git a/tests/ui/search_is_some.stderr b/tests/ui/search_is_some.stderr index ccbab5320ee2..f6e6cb1ec82c 100644 --- a/tests/ui/search_is_some.stderr +++ b/tests/ui/search_is_some.stderr @@ -1,5 +1,5 @@ error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some.rs:21:20 + --> tests/ui/search_is_some.rs:20:20 | LL | let _ = (0..1).find(some_closure).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(some_closure)` @@ -8,7 +8,7 @@ LL | let _ = (0..1).find(some_closure).is_some(); = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some.rs:37:13 + --> tests/ui/search_is_some.rs:36:13 | LL | let _ = (0..1).find(some_closure).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(some_closure)` diff --git a/tests/ui/search_is_some_fixable_none.fixed b/tests/ui/search_is_some_fixable_none.fixed index 720ed385fb48..916b7e75fdeb 100644 --- a/tests/ui/search_is_some_fixable_none.fixed +++ b/tests/ui/search_is_some_fixable_none.fixed @@ -1,5 +1,6 @@ -#![allow(dead_code, clippy::explicit_auto_deref, clippy::useless_vec, clippy::manual_contains)] #![warn(clippy::search_is_some)] +#![allow(clippy::explicit_auto_deref, clippy::manual_contains)] +#![expect(clippy::useless_vec)] fn main() { let v = vec![3, 2, 1, 0, -1, -2, -3]; diff --git a/tests/ui/search_is_some_fixable_none.rs b/tests/ui/search_is_some_fixable_none.rs index 1cb5f9c39959..c5d6e80b70ad 100644 --- a/tests/ui/search_is_some_fixable_none.rs +++ b/tests/ui/search_is_some_fixable_none.rs @@ -1,5 +1,6 @@ -#![allow(dead_code, clippy::explicit_auto_deref, clippy::useless_vec, clippy::manual_contains)] #![warn(clippy::search_is_some)] +#![allow(clippy::explicit_auto_deref, clippy::manual_contains)] +#![expect(clippy::useless_vec)] fn main() { let v = vec![3, 2, 1, 0, -1, -2, -3]; diff --git a/tests/ui/search_is_some_fixable_none.stderr b/tests/ui/search_is_some_fixable_none.stderr index 909248357169..64fb415549a7 100644 --- a/tests/ui/search_is_some_fixable_none.stderr +++ b/tests/ui/search_is_some_fixable_none.stderr @@ -1,5 +1,5 @@ error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:9:13 + --> tests/ui/search_is_some_fixable_none.rs:10:13 | LL | let _ = v.iter().find(|&x| *x < 0).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x < 0)` @@ -8,49 +8,49 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_none(); = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:11:13 + --> tests/ui/search_is_some_fixable_none.rs:12:13 | LL | let _ = (0..1).find(|x| **y == *x).is_none(); // one dereference less | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(|x| **y == x)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:14:13 + --> tests/ui/search_is_some_fixable_none.rs:15:13 | LL | let _ = (0..1).find(|x| *x == 0).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(|x| x == 0)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:16:13 + --> tests/ui/search_is_some_fixable_none.rs:17:13 | LL | let _ = v.iter().find(|x| **x == 0).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 0)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:18:13 + --> tests/ui/search_is_some_fixable_none.rs:19:13 | LL | let _ = (4..5).find(|x| *x == 1 || *x == 3 || *x == 5).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(4..5).any(|x| x == 1 || x == 3 || x == 5)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:20:13 + --> tests/ui/search_is_some_fixable_none.rs:21:13 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:22:13 + --> tests/ui/search_is_some_fixable_none.rs:23:13 | LL | let _ = (1..3).find(|x| *x == 0 || [1, 2, 3].contains(x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| x == 0 || [1, 2, 3].contains(&x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:24:13 + --> tests/ui/search_is_some_fixable_none.rs:25:13 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x) || *x == 0).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:26:13 + --> tests/ui/search_is_some_fixable_none.rs:27:13 | LL | let _ = (1..3) | _____________^ @@ -60,7 +60,7 @@ LL | | .is_none(); | |__________________^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:31:13 + --> tests/ui/search_is_some_fixable_none.rs:32:13 | LL | let _ = v | _____________^ @@ -82,13 +82,13 @@ LL ~ }); | error: called `is_none()` after searching an `Iterator` with `position` - --> tests/ui/search_is_some_fixable_none.rs:40:13 + --> tests/ui/search_is_some_fixable_none.rs:41:13 | LL | let _ = v.iter().position(|&x| x < 0).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|&x| x < 0)` error: called `is_none()` after searching an `Iterator` with `position` - --> tests/ui/search_is_some_fixable_none.rs:43:13 + --> tests/ui/search_is_some_fixable_none.rs:44:13 | LL | let _ = v | _____________^ @@ -110,13 +110,13 @@ LL ~ }); | error: called `is_none()` after searching an `Iterator` with `rposition` - --> tests/ui/search_is_some_fixable_none.rs:52:13 + --> tests/ui/search_is_some_fixable_none.rs:53:13 | LL | let _ = v.iter().rposition(|&x| x < 0).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|&x| x < 0)` error: called `is_none()` after searching an `Iterator` with `rposition` - --> tests/ui/search_is_some_fixable_none.rs:55:13 + --> tests/ui/search_is_some_fixable_none.rs:56:13 | LL | let _ = v | _____________^ @@ -138,79 +138,79 @@ LL ~ }); | error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:67:13 + --> tests/ui/search_is_some_fixable_none.rs:68:13 | LL | let _ = "hello world".find("world").is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:69:13 + --> tests/ui/search_is_some_fixable_none.rs:70:13 | LL | let _ = "hello world".find(&s2).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains(&s2)` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:71:13 + --> tests/ui/search_is_some_fixable_none.rs:72:13 | LL | let _ = "hello world".find(&s2[2..]).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains(&s2[2..])` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:74:13 + --> tests/ui/search_is_some_fixable_none.rs:75:13 | LL | let _ = s1.find("world").is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:76:13 + --> tests/ui/search_is_some_fixable_none.rs:77:13 | LL | let _ = s1.find(&s2).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains(&s2)` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:78:13 + --> tests/ui/search_is_some_fixable_none.rs:79:13 | LL | let _ = s1.find(&s2[2..]).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains(&s2[2..])` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:81:13 + --> tests/ui/search_is_some_fixable_none.rs:82:13 | LL | let _ = s1[2..].find("world").is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:83:13 + --> tests/ui/search_is_some_fixable_none.rs:84:13 | LL | let _ = s1[2..].find(&s2).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains(&s2)` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:85:13 + --> tests/ui/search_is_some_fixable_none.rs:86:13 | LL | let _ = s1[2..].find(&s2[2..]).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains(&s2[2..])` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:102:25 + --> tests/ui/search_is_some_fixable_none.rs:103:25 | LL | .filter(|c| filter_hand.iter().find(|cc| c == cc).is_none()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!filter_hand.iter().any(|cc| c == &cc)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:119:30 + --> tests/ui/search_is_some_fixable_none.rs:120:30 | LL | .filter(|(c, _)| filter_hand.iter().find(|cc| c == *cc).is_none()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!filter_hand.iter().any(|cc| c == cc)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:131:17 + --> tests/ui/search_is_some_fixable_none.rs:132:17 | LL | let _ = vfoo.iter().find(|v| v.foo == 1 && v.bar == 2).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.foo == 1 && v.bar == 2)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:135:17 + --> tests/ui/search_is_some_fixable_none.rs:136:17 | LL | let _ = vfoo | _________________^ @@ -228,55 +228,55 @@ LL ~ .iter().any(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2); | error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:144:17 + --> tests/ui/search_is_some_fixable_none.rs:145:17 | LL | let _ = vfoo.iter().find(|a| a[0] == 42).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|a| a[0] == 42)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:151:17 + --> tests/ui/search_is_some_fixable_none.rs:152:17 | LL | let _ = vfoo.iter().find(|sub| sub[1..4].len() == 3).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|sub| sub[1..4].len() == 3)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:170:17 + --> tests/ui/search_is_some_fixable_none.rs:171:17 | LL | let _ = [ppx].iter().find(|ppp_x: &&&u32| please(**ppp_x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![ppx].iter().any(|ppp_x: &&u32| please(ppp_x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:172:17 + --> tests/ui/search_is_some_fixable_none.rs:173:17 | LL | let _ = [String::from("Hey hey")].iter().find(|s| s.len() == 2).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![String::from("Hey hey")].iter().any(|s| s.len() == 2)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:176:17 + --> tests/ui/search_is_some_fixable_none.rs:177:17 | LL | let _ = v.iter().find(|x| deref_enough(**x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| deref_enough(*x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:178:17 + --> tests/ui/search_is_some_fixable_none.rs:179:17 | LL | let _ = v.iter().find(|x: &&u32| deref_enough(**x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x: &u32| deref_enough(*x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:182:17 + --> tests/ui/search_is_some_fixable_none.rs:183:17 | LL | let _ = v.iter().find(|x| arg_no_deref(x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| arg_no_deref(&x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:185:17 + --> tests/ui/search_is_some_fixable_none.rs:186:17 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref(x)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x: &u32| arg_no_deref(&x))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:206:17 + --> tests/ui/search_is_some_fixable_none.rs:207:17 | LL | let _ = vfoo | _________________^ @@ -294,25 +294,25 @@ LL ~ .iter().any(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] | error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:223:17 + --> tests/ui/search_is_some_fixable_none.rs:224:17 | LL | let _ = vfoo.iter().find(|v| v.inner[0].bar == 2).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.inner[0].bar == 2)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:229:17 + --> tests/ui/search_is_some_fixable_none.rs:230:17 | LL | let _ = vfoo.iter().find(|x| (**x)[0] == 9).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|x| (**x)[0] == 9)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:243:17 + --> tests/ui/search_is_some_fixable_none.rs:244:17 | LL | let _ = vfoo.iter().find(|v| v.by_ref(&v.bar)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.by_ref(&v.bar))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:248:17 + --> tests/ui/search_is_some_fixable_none.rs:249:17 | LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)] | _________________^ @@ -330,103 +330,103 @@ LL ~ .iter().any(|&&(&x, ref y)| x == *y); | error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:271:17 + --> tests/ui/search_is_some_fixable_none.rs:272:17 | LL | let _ = v.iter().find(|s| s[0].is_empty()).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|s| s[0].is_empty())` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:273:17 + --> tests/ui/search_is_some_fixable_none.rs:274:17 | LL | let _ = v.iter().find(|s| test_string_1(&s[0])).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|s| test_string_1(&s[0]))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:283:17 + --> tests/ui/search_is_some_fixable_none.rs:284:17 | LL | let _ = v.iter().find(|fp| fp.field.is_power_of_two()).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| fp.field.is_power_of_two())` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:285:17 + --> tests/ui/search_is_some_fixable_none.rs:286:17 | LL | let _ = v.iter().find(|fp| test_u32_1(fp.field)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| test_u32_1(fp.field))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:287:17 + --> tests/ui/search_is_some_fixable_none.rs:288:17 | LL | let _ = v.iter().find(|fp| test_u32_2(*fp.field)).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| test_u32_2(*fp.field))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:304:17 + --> tests/ui/search_is_some_fixable_none.rs:305:17 | LL | let _ = v.iter().find(|x| **x == 42).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 42)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:306:17 + --> tests/ui/search_is_some_fixable_none.rs:307:17 | LL | Foo.bar(v.iter().find(|x| **x == 42).is_none()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 42)` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:312:9 + --> tests/ui/search_is_some_fixable_none.rs:313:9 | LL | v.iter().find(|x| **x == 42).is_none().then(computations); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!v.iter().any(|x| *x == 42))` error: called `is_none()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_none.rs:318:9 + --> tests/ui/search_is_some_fixable_none.rs:319:9 | LL | v.iter().find(|x| **x == 42).is_none().then_some(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!v.iter().any(|x| *x == 42))` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:324:17 + --> tests/ui/search_is_some_fixable_none.rs:325:17 | LL | let _ = s.find("world").is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:326:17 + --> tests/ui/search_is_some_fixable_none.rs:327:17 | LL | Foo.bar(s.find("world").is_none()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:329:17 + --> tests/ui/search_is_some_fixable_none.rs:330:17 | LL | let _ = s.find("world").is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:331:17 + --> tests/ui/search_is_some_fixable_none.rs:332:17 | LL | Foo.bar(s.find("world").is_none()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s.contains("world")` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:337:17 + --> tests/ui/search_is_some_fixable_none.rs:338:17 | LL | let _ = s.find("world").is_none().then(computations); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:340:17 + --> tests/ui/search_is_some_fixable_none.rs:341:17 | LL | let _ = s.find("world").is_none().then(computations); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:346:17 + --> tests/ui/search_is_some_fixable_none.rs:347:17 | LL | let _ = s.find("world").is_none().then_some(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` error: called `is_none()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_none.rs:349:17 + --> tests/ui/search_is_some_fixable_none.rs:350:17 | LL | let _ = s.find("world").is_none().then_some(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(!s.contains("world"))` diff --git a/tests/ui/search_is_some_fixable_some.fixed b/tests/ui/search_is_some_fixable_some.fixed index daae41c0c891..69d6e8bfe1a2 100644 --- a/tests/ui/search_is_some_fixable_some.fixed +++ b/tests/ui/search_is_some_fixable_some.fixed @@ -1,5 +1,6 @@ -#![allow(dead_code, clippy::explicit_auto_deref, clippy::useless_vec, clippy::manual_contains)] #![warn(clippy::search_is_some)] +#![allow(clippy::explicit_auto_deref, clippy::manual_contains)] +#![expect(clippy::useless_vec)] fn main() { let v = vec![3, 2, 1, 0, -1, -2, -3]; diff --git a/tests/ui/search_is_some_fixable_some.rs b/tests/ui/search_is_some_fixable_some.rs index ead101a491a6..b6038fce37d9 100644 --- a/tests/ui/search_is_some_fixable_some.rs +++ b/tests/ui/search_is_some_fixable_some.rs @@ -1,5 +1,6 @@ -#![allow(dead_code, clippy::explicit_auto_deref, clippy::useless_vec, clippy::manual_contains)] #![warn(clippy::search_is_some)] +#![allow(clippy::explicit_auto_deref, clippy::manual_contains)] +#![expect(clippy::useless_vec)] fn main() { let v = vec![3, 2, 1, 0, -1, -2, -3]; diff --git a/tests/ui/search_is_some_fixable_some.stderr b/tests/ui/search_is_some_fixable_some.stderr index c56fe859aac0..90760242cd80 100644 --- a/tests/ui/search_is_some_fixable_some.stderr +++ b/tests/ui/search_is_some_fixable_some.stderr @@ -1,5 +1,5 @@ error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:9:22 + --> tests/ui/search_is_some_fixable_some.rs:10:22 | LL | let _ = v.iter().find(|&x| *x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| *x < 0)` @@ -8,49 +8,49 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some(); = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:11:20 + --> tests/ui/search_is_some_fixable_some.rs:12:20 | LL | let _ = (0..1).find(|x| **y == *x).is_some(); // one dereference less | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| **y == x)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:14:20 + --> tests/ui/search_is_some_fixable_some.rs:15:20 | LL | let _ = (0..1).find(|x| *x == 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == 0)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:16:22 + --> tests/ui/search_is_some_fixable_some.rs:17:22 | LL | let _ = v.iter().find(|x| **x == 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| *x == 0)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:18:20 + --> tests/ui/search_is_some_fixable_some.rs:19:20 | LL | let _ = (4..5).find(|x| *x == 1 || *x == 3 || *x == 5).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == 1 || x == 3 || x == 5)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:20:20 + --> tests/ui/search_is_some_fixable_some.rs:21:20 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| [1, 2, 3].contains(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:22:20 + --> tests/ui/search_is_some_fixable_some.rs:23:20 | LL | let _ = (1..3).find(|x| *x == 0 || [1, 2, 3].contains(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == 0 || [1, 2, 3].contains(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:24:20 + --> tests/ui/search_is_some_fixable_some.rs:25:20 | LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x) || *x == 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| [1, 2, 3].contains(&x) || x == 0)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:27:10 + --> tests/ui/search_is_some_fixable_some.rs:28:10 | LL | .find(|x| [1, 2, 3].contains(x) || *x == 0 || [4, 5, 6].contains(x) || *x == -1) | __________^ @@ -59,7 +59,7 @@ LL | | .is_some(); | |__________________^ help: consider using: `any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:33:10 + --> tests/ui/search_is_some_fixable_some.rs:34:10 | LL | .find(|&x| { | __________^ @@ -78,13 +78,13 @@ LL ~ }); | error: called `is_some()` after searching an `Iterator` with `position` - --> tests/ui/search_is_some_fixable_some.rs:40:22 + --> tests/ui/search_is_some_fixable_some.rs:41:22 | LL | let _ = v.iter().position(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with `position` - --> tests/ui/search_is_some_fixable_some.rs:45:10 + --> tests/ui/search_is_some_fixable_some.rs:46:10 | LL | .position(|&x| { | __________^ @@ -103,13 +103,13 @@ LL ~ }); | error: called `is_some()` after searching an `Iterator` with `rposition` - --> tests/ui/search_is_some_fixable_some.rs:52:22 + --> tests/ui/search_is_some_fixable_some.rs:53:22 | LL | let _ = v.iter().rposition(|&x| x < 0).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|&x| x < 0)` error: called `is_some()` after searching an `Iterator` with `rposition` - --> tests/ui/search_is_some_fixable_some.rs:57:10 + --> tests/ui/search_is_some_fixable_some.rs:58:10 | LL | .rposition(|&x| { | __________^ @@ -128,79 +128,79 @@ LL ~ }); | error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:66:27 + --> tests/ui/search_is_some_fixable_some.rs:67:27 | LL | let _ = "hello world".find("world").is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains("world")` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:68:27 + --> tests/ui/search_is_some_fixable_some.rs:69:27 | LL | let _ = "hello world".find(&s2).is_some(); | ^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2)` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:70:27 + --> tests/ui/search_is_some_fixable_some.rs:71:27 | LL | let _ = "hello world".find(&s2[2..]).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2[2..])` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:73:16 + --> tests/ui/search_is_some_fixable_some.rs:74:16 | LL | let _ = s1.find("world").is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains("world")` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:75:16 + --> tests/ui/search_is_some_fixable_some.rs:76:16 | LL | let _ = s1.find(&s2).is_some(); | ^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2)` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:77:16 + --> tests/ui/search_is_some_fixable_some.rs:78:16 | LL | let _ = s1.find(&s2[2..]).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2[2..])` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:80:21 + --> tests/ui/search_is_some_fixable_some.rs:81:21 | LL | let _ = s1[2..].find("world").is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains("world")` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:82:21 + --> tests/ui/search_is_some_fixable_some.rs:83:21 | LL | let _ = s1[2..].find(&s2).is_some(); | ^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2)` error: called `is_some()` after calling `find()` on a string - --> tests/ui/search_is_some_fixable_some.rs:84:21 + --> tests/ui/search_is_some_fixable_some.rs:85:21 | LL | let _ = s1[2..].find(&s2[2..]).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `contains(&s2[2..])` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:101:44 + --> tests/ui/search_is_some_fixable_some.rs:102:44 | LL | .filter(|c| filter_hand.iter().find(|cc| c == cc).is_some()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|cc| c == &cc)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:118:49 + --> tests/ui/search_is_some_fixable_some.rs:119:49 | LL | .filter(|(c, _)| filter_hand.iter().find(|cc| c == *cc).is_some()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|cc| c == cc)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:130:29 + --> tests/ui/search_is_some_fixable_some.rs:131:29 | LL | let _ = vfoo.iter().find(|v| v.foo == 1 && v.bar == 2).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| v.foo == 1 && v.bar == 2)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:136:14 + --> tests/ui/search_is_some_fixable_some.rs:137:14 | LL | .find(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2) | ______________^ @@ -209,55 +209,55 @@ LL | | .is_some(); | |______________________^ help: consider using: `any(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:143:29 + --> tests/ui/search_is_some_fixable_some.rs:144:29 | LL | let _ = vfoo.iter().find(|a| a[0] == 42).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|a| a[0] == 42)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:150:29 + --> tests/ui/search_is_some_fixable_some.rs:151:29 | LL | let _ = vfoo.iter().find(|sub| sub[1..4].len() == 3).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|sub| sub[1..4].len() == 3)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:169:30 + --> tests/ui/search_is_some_fixable_some.rs:170:30 | LL | let _ = [ppx].iter().find(|ppp_x: &&&u32| please(**ppp_x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|ppp_x: &&u32| please(ppp_x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:171:50 + --> tests/ui/search_is_some_fixable_some.rs:172:50 | LL | let _ = [String::from("Hey hey")].iter().find(|s| s.len() == 2).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|s| s.len() == 2)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:175:26 + --> tests/ui/search_is_some_fixable_some.rs:176:26 | LL | let _ = v.iter().find(|x| deref_enough(**x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| deref_enough(*x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:177:26 + --> tests/ui/search_is_some_fixable_some.rs:178:26 | LL | let _ = v.iter().find(|x: &&u32| deref_enough(**x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| deref_enough(*x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:181:26 + --> tests/ui/search_is_some_fixable_some.rs:182:26 | LL | let _ = v.iter().find(|x| arg_no_deref(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| arg_no_deref(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:184:26 + --> tests/ui/search_is_some_fixable_some.rs:185:26 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| arg_no_deref(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:207:14 + --> tests/ui/search_is_some_fixable_some.rs:208:14 | LL | .find(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2) | ______________^ @@ -266,25 +266,25 @@ LL | | .is_some(); | |______________________^ help: consider using: `any(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:222:29 + --> tests/ui/search_is_some_fixable_some.rs:223:29 | LL | let _ = vfoo.iter().find(|v| v.inner[0].bar == 2).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| v.inner[0].bar == 2)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:228:29 + --> tests/ui/search_is_some_fixable_some.rs:229:29 | LL | let _ = vfoo.iter().find(|x| (**x)[0] == 9).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| (**x)[0] == 9)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:242:29 + --> tests/ui/search_is_some_fixable_some.rs:243:29 | LL | let _ = vfoo.iter().find(|v| v.by_ref(&v.bar)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| v.by_ref(&v.bar))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:249:14 + --> tests/ui/search_is_some_fixable_some.rs:250:14 | LL | .find(|&&&(&x, ref y)| x == *y) | ______________^ @@ -293,55 +293,55 @@ LL | | .is_some(); | |______________________^ help: consider using: `any(|&&(&x, ref y)| x == *y)` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:270:26 + --> tests/ui/search_is_some_fixable_some.rs:271:26 | LL | let _ = v.iter().find(|s| s[0].is_empty()).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|s| s[0].is_empty())` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:272:26 + --> tests/ui/search_is_some_fixable_some.rs:273:26 | LL | let _ = v.iter().find(|s| test_string_1(&s[0])).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|s| test_string_1(&s[0]))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:282:26 + --> tests/ui/search_is_some_fixable_some.rs:283:26 | LL | let _ = v.iter().find(|fp| fp.field.is_power_of_two()).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|fp| fp.field.is_power_of_two())` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:284:26 + --> tests/ui/search_is_some_fixable_some.rs:285:26 | LL | let _ = v.iter().find(|fp| test_u32_1(fp.field)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|fp| test_u32_1(fp.field))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:286:26 + --> tests/ui/search_is_some_fixable_some.rs:287:26 | LL | let _ = v.iter().find(|fp| test_u32_2(*fp.field)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|fp| test_u32_2(*fp.field))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:302:18 + --> tests/ui/search_is_some_fixable_some.rs:303:18 | LL | v.iter().find(|x: &&u32| func(x)).is_some() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| func(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:312:26 + --> tests/ui/search_is_some_fixable_some.rs:313:26 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref_impl(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| arg_no_deref_impl(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:316:26 + --> tests/ui/search_is_some_fixable_some.rs:317:26 | LL | let _ = v.iter().find(|x: &&u32| arg_no_deref_dyn(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| arg_no_deref_dyn(&x))` error: called `is_some()` after searching an `Iterator` with `find` - --> tests/ui/search_is_some_fixable_some.rs:320:26 + --> tests/ui/search_is_some_fixable_some.rs:321:26 | LL | let _ = v.iter().find(|x: &&u32| (*arg_no_deref_dyn)(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| (*arg_no_deref_dyn)(&x))` diff --git a/tests/ui/seek_to_start_instead_of_rewind.fixed b/tests/ui/seek_to_start_instead_of_rewind.fixed index 87747eafc443..ac9cf489f3fb 100644 --- a/tests/ui/seek_to_start_instead_of_rewind.fixed +++ b/tests/ui/seek_to_start_instead_of_rewind.fixed @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::seek_to_start_instead_of_rewind)] use std::fs::OpenOptions; diff --git a/tests/ui/seek_to_start_instead_of_rewind.rs b/tests/ui/seek_to_start_instead_of_rewind.rs index e824a9b1ec31..05e6246cd8bb 100644 --- a/tests/ui/seek_to_start_instead_of_rewind.rs +++ b/tests/ui/seek_to_start_instead_of_rewind.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::seek_to_start_instead_of_rewind)] use std::fs::OpenOptions; diff --git a/tests/ui/seek_to_start_instead_of_rewind.stderr b/tests/ui/seek_to_start_instead_of_rewind.stderr index 6c6575cc02f5..40d0db51d25c 100644 --- a/tests/ui/seek_to_start_instead_of_rewind.stderr +++ b/tests/ui/seek_to_start_instead_of_rewind.stderr @@ -1,5 +1,5 @@ error: used `seek` to go to the start of the stream - --> tests/ui/seek_to_start_instead_of_rewind.rs:52:7 + --> tests/ui/seek_to_start_instead_of_rewind.rs:51:7 | LL | t.seek(SeekFrom::Start(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` @@ -8,13 +8,13 @@ LL | t.seek(SeekFrom::Start(0)); = help: to override `-D warnings` add `#[allow(clippy::seek_to_start_instead_of_rewind)]` error: used `seek` to go to the start of the stream - --> tests/ui/seek_to_start_instead_of_rewind.rs:58:7 + --> tests/ui/seek_to_start_instead_of_rewind.rs:57:7 | LL | t.seek(SeekFrom::Start(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` error: used `seek` to go to the start of the stream - --> tests/ui/seek_to_start_instead_of_rewind.rs:138:7 + --> tests/ui/seek_to_start_instead_of_rewind.rs:137:7 | LL | f.seek(SeekFrom::Start(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` diff --git a/tests/ui/self_assignment.rs b/tests/ui/self_assignment.rs index 6e82b42cf6d7..7732b53f94fc 100644 --- a/tests/ui/self_assignment.rs +++ b/tests/ui/self_assignment.rs @@ -1,5 +1,5 @@ #![warn(clippy::self_assignment)] -#![allow(clippy::useless_vec, clippy::needless_pass_by_ref_mut)] +#![expect(clippy::useless_vec)] pub struct S<'a> { a: i32, diff --git a/tests/ui/semicolon_if_nothing_returned.fixed b/tests/ui/semicolon_if_nothing_returned.fixed index 3de14e9d2595..bbb81fea529b 100644 --- a/tests/ui/semicolon_if_nothing_returned.fixed +++ b/tests/ui/semicolon_if_nothing_returned.fixed @@ -1,12 +1,8 @@ //@aux-build:proc_macro_attr.rs #![warn(clippy::semicolon_if_nothing_returned)] -#![allow( - clippy::redundant_closure, - clippy::uninlined_format_args, - clippy::needless_late_init, - clippy::empty_docs -)] +#![allow(clippy::needless_late_init)] +#![expect(clippy::empty_docs)] #[macro_use] extern crate proc_macro_attr; diff --git a/tests/ui/semicolon_if_nothing_returned.rs b/tests/ui/semicolon_if_nothing_returned.rs index 304f43fb457c..d962f2ef6c41 100644 --- a/tests/ui/semicolon_if_nothing_returned.rs +++ b/tests/ui/semicolon_if_nothing_returned.rs @@ -1,12 +1,8 @@ //@aux-build:proc_macro_attr.rs #![warn(clippy::semicolon_if_nothing_returned)] -#![allow( - clippy::redundant_closure, - clippy::uninlined_format_args, - clippy::needless_late_init, - clippy::empty_docs -)] +#![allow(clippy::needless_late_init)] +#![expect(clippy::empty_docs)] #[macro_use] extern crate proc_macro_attr; diff --git a/tests/ui/semicolon_if_nothing_returned.stderr b/tests/ui/semicolon_if_nothing_returned.stderr index d7d117e05bdf..8757f5e48220 100644 --- a/tests/ui/semicolon_if_nothing_returned.stderr +++ b/tests/ui/semicolon_if_nothing_returned.stderr @@ -1,5 +1,5 @@ error: consider adding a `;` to the last statement for consistent formatting - --> tests/ui/semicolon_if_nothing_returned.rs:18:5 + --> tests/ui/semicolon_if_nothing_returned.rs:14:5 | LL | println!("Hello") | ^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Hello");` @@ -8,25 +8,25 @@ LL | println!("Hello") = help: to override `-D warnings` add `#[allow(clippy::semicolon_if_nothing_returned)]` error: consider adding a `;` to the last statement for consistent formatting - --> tests/ui/semicolon_if_nothing_returned.rs:23:5 + --> tests/ui/semicolon_if_nothing_returned.rs:19:5 | LL | get_unit() | ^^^^^^^^^^ help: add a `;` here: `get_unit();` error: consider adding a `;` to the last statement for consistent formatting - --> tests/ui/semicolon_if_nothing_returned.rs:29:5 + --> tests/ui/semicolon_if_nothing_returned.rs:25:5 | LL | y = x + 1 | ^^^^^^^^^ help: add a `;` here: `y = x + 1;` error: consider adding a `;` to the last statement for consistent formatting - --> tests/ui/semicolon_if_nothing_returned.rs:36:9 + --> tests/ui/semicolon_if_nothing_returned.rs:32:9 | LL | hello() | ^^^^^^^ help: add a `;` here: `hello();` error: consider adding a `;` to the last statement for consistent formatting - --> tests/ui/semicolon_if_nothing_returned.rs:48:9 + --> tests/ui/semicolon_if_nothing_returned.rs:44:9 | LL | ptr::drop_in_place(s.as_mut_ptr()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `ptr::drop_in_place(s.as_mut_ptr());` diff --git a/tests/ui/semicolon_inside_block.fixed b/tests/ui/semicolon_inside_block.fixed index c7174881a4fa..c3afda065633 100644 --- a/tests/ui/semicolon_inside_block.fixed +++ b/tests/ui/semicolon_inside_block.fixed @@ -1,12 +1,11 @@ -#![allow( - unused, - clippy::unused_unit, - clippy::unnecessary_operation, +#![warn(clippy::semicolon_inside_block)] +#![allow(clippy::unnecessary_operation)] +#![expect( + clippy::double_parens, clippy::no_effect, clippy::single_element_loop, - clippy::double_parens + clippy::unused_unit )] -#![warn(clippy::semicolon_inside_block)] #![feature(try_blocks)] macro_rules! m { diff --git a/tests/ui/semicolon_inside_block.rs b/tests/ui/semicolon_inside_block.rs index 25be9bee4f53..3163583a9cec 100644 --- a/tests/ui/semicolon_inside_block.rs +++ b/tests/ui/semicolon_inside_block.rs @@ -1,12 +1,11 @@ -#![allow( - unused, - clippy::unused_unit, - clippy::unnecessary_operation, +#![warn(clippy::semicolon_inside_block)] +#![allow(clippy::unnecessary_operation)] +#![expect( + clippy::double_parens, clippy::no_effect, clippy::single_element_loop, - clippy::double_parens + clippy::unused_unit )] -#![warn(clippy::semicolon_inside_block)] #![feature(try_blocks)] macro_rules! m { diff --git a/tests/ui/semicolon_inside_block.stderr b/tests/ui/semicolon_inside_block.stderr index e16590374295..2046dd1c36be 100644 --- a/tests/ui/semicolon_inside_block.stderr +++ b/tests/ui/semicolon_inside_block.stderr @@ -1,5 +1,5 @@ error: consider moving the `;` inside the block for consistent formatting - --> tests/ui/semicolon_inside_block.rs:40:5 + --> tests/ui/semicolon_inside_block.rs:39:5 | LL | { unit_fn_block() }; | ^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + { unit_fn_block(); } | error: consider moving the `;` inside the block for consistent formatting - --> tests/ui/semicolon_inside_block.rs:42:5 + --> tests/ui/semicolon_inside_block.rs:41:5 | LL | unsafe { unit_fn_block() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + unsafe { unit_fn_block(); } | error: consider moving the `;` inside the block for consistent formatting - --> tests/ui/semicolon_inside_block.rs:51:5 + --> tests/ui/semicolon_inside_block.rs:50:5 | LL | / { LL | | @@ -41,7 +41,7 @@ LL ~ } | error: consider moving the `;` inside the block for consistent formatting - --> tests/ui/semicolon_inside_block.rs:65:5 + --> tests/ui/semicolon_inside_block.rs:64:5 | LL | { m!(()) }; | ^^^^^^^^^^^ diff --git a/tests/ui/semicolon_inside_block_stmt_expr_attrs.fixed b/tests/ui/semicolon_inside_block_stmt_expr_attrs.fixed index 5b93a91da003..457738f6d321 100644 --- a/tests/ui/semicolon_inside_block_stmt_expr_attrs.fixed +++ b/tests/ui/semicolon_inside_block_stmt_expr_attrs.fixed @@ -1,8 +1,8 @@ // Test when the feature `stmt_expr_attributes` is enabled #![feature(stmt_expr_attributes)] -#![allow(clippy::no_effect)] #![warn(clippy::semicolon_inside_block)] +#![expect(clippy::no_effect)] pub fn issue15388() { #[rustfmt::skip] diff --git a/tests/ui/semicolon_inside_block_stmt_expr_attrs.rs b/tests/ui/semicolon_inside_block_stmt_expr_attrs.rs index aa2c0cb50299..b6277ded7edd 100644 --- a/tests/ui/semicolon_inside_block_stmt_expr_attrs.rs +++ b/tests/ui/semicolon_inside_block_stmt_expr_attrs.rs @@ -1,8 +1,8 @@ // Test when the feature `stmt_expr_attributes` is enabled #![feature(stmt_expr_attributes)] -#![allow(clippy::no_effect)] #![warn(clippy::semicolon_inside_block)] +#![expect(clippy::no_effect)] pub fn issue15388() { #[rustfmt::skip] diff --git a/tests/ui/semicolon_outside_block.fixed b/tests/ui/semicolon_outside_block.fixed index a3be80b49284..6939c6d01bf1 100644 --- a/tests/ui/semicolon_outside_block.fixed +++ b/tests/ui/semicolon_outside_block.fixed @@ -1,11 +1,10 @@ -#![allow( - unused, - clippy::unused_unit, - clippy::unnecessary_operation, +#![warn(clippy::semicolon_outside_block)] +#![expect( clippy::no_effect, - clippy::single_element_loop + clippy::single_element_loop, + clippy::unnecessary_operation, + clippy::unused_unit )] -#![warn(clippy::semicolon_outside_block)] macro_rules! m { (()) => { diff --git a/tests/ui/semicolon_outside_block.rs b/tests/ui/semicolon_outside_block.rs index 3b7bf68029f3..33810142e8a0 100644 --- a/tests/ui/semicolon_outside_block.rs +++ b/tests/ui/semicolon_outside_block.rs @@ -1,11 +1,10 @@ -#![allow( - unused, - clippy::unused_unit, - clippy::unnecessary_operation, +#![warn(clippy::semicolon_outside_block)] +#![expect( clippy::no_effect, - clippy::single_element_loop + clippy::single_element_loop, + clippy::unnecessary_operation, + clippy::unused_unit )] -#![warn(clippy::semicolon_outside_block)] macro_rules! m { (()) => { diff --git a/tests/ui/semicolon_outside_block.stderr b/tests/ui/semicolon_outside_block.stderr index 18d6dc697f2e..ab36ab38b2a8 100644 --- a/tests/ui/semicolon_outside_block.stderr +++ b/tests/ui/semicolon_outside_block.stderr @@ -1,5 +1,5 @@ error: consider moving the `;` outside the block for consistent formatting - --> tests/ui/semicolon_outside_block.rs:41:5 + --> tests/ui/semicolon_outside_block.rs:40:5 | LL | { unit_fn_block(); } | ^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + { unit_fn_block() }; | error: consider moving the `;` outside the block for consistent formatting - --> tests/ui/semicolon_outside_block.rs:43:5 + --> tests/ui/semicolon_outside_block.rs:42:5 | LL | unsafe { unit_fn_block(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + unsafe { unit_fn_block() }; | error: consider moving the `;` outside the block for consistent formatting - --> tests/ui/semicolon_outside_block.rs:53:5 + --> tests/ui/semicolon_outside_block.rs:52:5 | LL | / { LL | | @@ -41,7 +41,7 @@ LL ~ }; | error: consider moving the `;` outside the block for consistent formatting - --> tests/ui/semicolon_outside_block.rs:64:5 + --> tests/ui/semicolon_outside_block.rs:63:5 | LL | { m!(()); } | ^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL + { m!(()) }; | error: consider moving the `;` outside the block for consistent formatting - --> tests/ui/semicolon_outside_block.rs:87:5 + --> tests/ui/semicolon_outside_block.rs:86:5 | LL | / unsafe { LL | | @@ -68,7 +68,7 @@ LL ~ }; | error: consider moving the `;` outside the block for consistent formatting - --> tests/ui/semicolon_outside_block.rs:92:5 + --> tests/ui/semicolon_outside_block.rs:91:5 | LL | / { LL | | diff --git a/tests/ui/serde.rs b/tests/ui/serde.rs index 8ab1144e5700..1628380c4eb8 100644 --- a/tests/ui/serde.rs +++ b/tests/ui/serde.rs @@ -1,5 +1,4 @@ #![warn(clippy::serde_api_misuse)] -#![allow(dead_code, clippy::needless_lifetimes)] extern crate serde; diff --git a/tests/ui/serde.stderr b/tests/ui/serde.stderr index 652248e3578c..264ea09dd722 100644 --- a/tests/ui/serde.stderr +++ b/tests/ui/serde.stderr @@ -1,5 +1,5 @@ error: you should not implement `visit_string` without also implementing `visit_str` - --> tests/ui/serde.rs:39:5 + --> tests/ui/serde.rs:38:5 | LL | / fn visit_string(self, _v: String) -> Result LL | | diff --git a/tests/ui/set_contains_or_insert.rs b/tests/ui/set_contains_or_insert.rs index b9480cd9172a..fa94ae858394 100644 --- a/tests/ui/set_contains_or_insert.rs +++ b/tests/ui/set_contains_or_insert.rs @@ -1,7 +1,6 @@ -#![allow(unused)] -#![allow(clippy::nonminimal_bool)] -#![allow(clippy::needless_borrow)] #![warn(clippy::set_contains_or_insert)] +#![expect(clippy::nonminimal_bool)] +#![allow(clippy::needless_borrow)] use std::collections::{BTreeSet, HashSet}; diff --git a/tests/ui/set_contains_or_insert.stderr b/tests/ui/set_contains_or_insert.stderr index 85331514be7a..8ec945f5d82f 100644 --- a/tests/ui/set_contains_or_insert.stderr +++ b/tests/ui/set_contains_or_insert.stderr @@ -1,5 +1,5 @@ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:12:13 + --> tests/ui/set_contains_or_insert.rs:11:13 | LL | if !set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | set.insert(value); = help: to override `-D warnings` add `#[allow(clippy::set_contains_or_insert)]` error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:18:12 + --> tests/ui/set_contains_or_insert.rs:17:12 | LL | if set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:24:13 + --> tests/ui/set_contains_or_insert.rs:23:13 | LL | if !set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:29:14 + --> tests/ui/set_contains_or_insert.rs:28:14 | LL | if !!set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:35:15 + --> tests/ui/set_contains_or_insert.rs:34:15 | LL | if (&set).contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:41:13 + --> tests/ui/set_contains_or_insert.rs:40:13 | LL | if !set.contains(borrow_value) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -56,7 +56,7 @@ LL | set.insert(*borrow_value); | ^^^^^^^^^^^^^^^^^^^^^ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:47:20 + --> tests/ui/set_contains_or_insert.rs:46:20 | LL | if !borrow_set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | borrow_set.insert(value); | ^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:86:13 + --> tests/ui/set_contains_or_insert.rs:85:13 | LL | if !set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:92:12 + --> tests/ui/set_contains_or_insert.rs:91:12 | LL | if set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -83,7 +83,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:98:13 + --> tests/ui/set_contains_or_insert.rs:97:13 | LL | if !set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -92,7 +92,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:103:14 + --> tests/ui/set_contains_or_insert.rs:102:14 | LL | if !!set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -101,7 +101,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:109:15 + --> tests/ui/set_contains_or_insert.rs:108:15 | LL | if (&set).contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL | set.insert(value); | ^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:115:13 + --> tests/ui/set_contains_or_insert.rs:114:13 | LL | if !set.contains(borrow_value) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | set.insert(*borrow_value); | ^^^^^^^^^^^^^^^^^^^^^ error: usage of `BTreeSet::insert` after `BTreeSet::contains` - --> tests/ui/set_contains_or_insert.rs:121:20 + --> tests/ui/set_contains_or_insert.rs:120:20 | LL | if !borrow_set.contains(&value) { | ^^^^^^^^^^^^^^^^ @@ -128,7 +128,7 @@ LL | borrow_set.insert(value); | ^^^^^^^^^^^^^ error: usage of `HashSet::insert` after `HashSet::contains` - --> tests/ui/set_contains_or_insert.rs:176:11 + --> tests/ui/set_contains_or_insert.rs:175:11 | LL | if !s.contains(&v) { | ^^^^^^^^^^^^ diff --git a/tests/ui/shadow.rs b/tests/ui/shadow.rs index d589bbc4affd..90953cda1010 100644 --- a/tests/ui/shadow.rs +++ b/tests/ui/shadow.rs @@ -1,12 +1,7 @@ //@aux-build:proc_macro_derive.rs -#![warn(clippy::shadow_same, clippy::shadow_reuse, clippy::shadow_unrelated)] -#![allow( - clippy::let_unit_value, - clippy::needless_ifs, - clippy::redundant_guards, - clippy::redundant_locals -)] +#![warn(clippy::shadow_reuse, clippy::shadow_same, clippy::shadow_unrelated)] +#![expect(clippy::let_unit_value, clippy::redundant_guards, clippy::redundant_locals)] extern crate proc_macro_derive; diff --git a/tests/ui/shadow.stderr b/tests/ui/shadow.stderr index 649f843575a7..c356e4a130d0 100644 --- a/tests/ui/shadow.stderr +++ b/tests/ui/shadow.stderr @@ -1,11 +1,11 @@ error: `x` is shadowed by itself in `x` - --> tests/ui/shadow.rs:24:9 + --> tests/ui/shadow.rs:19:9 | LL | let x = x; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:23:9 + --> tests/ui/shadow.rs:18:9 | LL | let x = 1; | ^ @@ -13,49 +13,49 @@ LL | let x = 1; = help: to override `-D warnings` add `#[allow(clippy::shadow_same)]` error: `mut x` is shadowed by itself in `&x` - --> tests/ui/shadow.rs:26:13 + --> tests/ui/shadow.rs:21:13 | LL | let mut x = &x; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:24:9 + --> tests/ui/shadow.rs:19:9 | LL | let x = x; | ^ error: `x` is shadowed by itself in `&mut x` - --> tests/ui/shadow.rs:28:9 + --> tests/ui/shadow.rs:23:9 | LL | let x = &mut x; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:26:9 + --> tests/ui/shadow.rs:21:9 | LL | let mut x = &x; | ^^^^^ error: `x` is shadowed by itself in `*x` - --> tests/ui/shadow.rs:30:9 + --> tests/ui/shadow.rs:25:9 | LL | let x = *x; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:28:9 + --> tests/ui/shadow.rs:23:9 | LL | let x = &mut x; | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:36:9 + --> tests/ui/shadow.rs:31:9 | LL | let x = x.0; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:35:9 + --> tests/ui/shadow.rs:30:9 | LL | let x = ([[0]], ()); | ^ @@ -63,97 +63,97 @@ LL | let x = ([[0]], ()); = help: to override `-D warnings` add `#[allow(clippy::shadow_reuse)]` error: `x` is shadowed - --> tests/ui/shadow.rs:38:9 + --> tests/ui/shadow.rs:33:9 | LL | let x = x[0]; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:36:9 + --> tests/ui/shadow.rs:31:9 | LL | let x = x.0; | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:40:10 + --> tests/ui/shadow.rs:35:10 | LL | let [x] = x; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:38:9 + --> tests/ui/shadow.rs:33:9 | LL | let x = x[0]; | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:42:9 + --> tests/ui/shadow.rs:37:9 | LL | let x = Some(x); | ^ | note: previous binding is here - --> tests/ui/shadow.rs:40:10 + --> tests/ui/shadow.rs:35:10 | LL | let [x] = x; | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:44:9 + --> tests/ui/shadow.rs:39:9 | LL | let x = foo(x); | ^ | note: previous binding is here - --> tests/ui/shadow.rs:42:9 + --> tests/ui/shadow.rs:37:9 | LL | let x = Some(x); | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:46:9 + --> tests/ui/shadow.rs:41:9 | LL | let x = || x; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:44:9 + --> tests/ui/shadow.rs:39:9 | LL | let x = foo(x); | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:48:9 + --> tests/ui/shadow.rs:43:9 | LL | let x = Some(1).map(|_| x)?; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:46:9 + --> tests/ui/shadow.rs:41:9 | LL | let x = || x; | ^ error: `y` is shadowed - --> tests/ui/shadow.rs:51:9 + --> tests/ui/shadow.rs:46:9 | LL | let y = match y { | ^ | note: previous binding is here - --> tests/ui/shadow.rs:50:9 + --> tests/ui/shadow.rs:45:9 | LL | let y = 1; | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:67:9 + --> tests/ui/shadow.rs:62:9 | LL | let x = 2; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:66:9 + --> tests/ui/shadow.rs:61:9 | LL | let x = 1; | ^ @@ -161,157 +161,157 @@ LL | let x = 1; = help: to override `-D warnings` add `#[allow(clippy::shadow_unrelated)]` error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:73:13 + --> tests/ui/shadow.rs:68:13 | LL | let x = 1; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:72:10 + --> tests/ui/shadow.rs:67:10 | LL | fn f(x: u32) { | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:79:14 + --> tests/ui/shadow.rs:74:14 | LL | Some(x) => { | ^ | note: previous binding is here - --> tests/ui/shadow.rs:76:9 + --> tests/ui/shadow.rs:71:9 | LL | let x = 1; | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:81:17 + --> tests/ui/shadow.rs:76:17 | LL | let x = 1; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:79:14 + --> tests/ui/shadow.rs:74:14 | LL | Some(x) => { | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:86:17 + --> tests/ui/shadow.rs:81:17 | LL | if let Some(x) = Some(1) {} | ^ | note: previous binding is here - --> tests/ui/shadow.rs:76:9 + --> tests/ui/shadow.rs:71:9 | LL | let x = 1; | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:88:20 + --> tests/ui/shadow.rs:83:20 | LL | while let Some(x) = Some(1) {} | ^ | note: previous binding is here - --> tests/ui/shadow.rs:76:9 + --> tests/ui/shadow.rs:71:9 | LL | let x = 1; | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:90:15 + --> tests/ui/shadow.rs:85:15 | LL | let _ = |[x]: [u32; 1]| { | ^ | note: previous binding is here - --> tests/ui/shadow.rs:76:9 + --> tests/ui/shadow.rs:71:9 | LL | let x = 1; | ^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:92:13 + --> tests/ui/shadow.rs:87:13 | LL | let x = 1; | ^ | note: previous binding is here - --> tests/ui/shadow.rs:90:15 + --> tests/ui/shadow.rs:85:15 | LL | let _ = |[x]: [u32; 1]| { | ^ error: `y` is shadowed - --> tests/ui/shadow.rs:96:17 + --> tests/ui/shadow.rs:91:17 | LL | if let Some(y) = y {} | ^ | note: previous binding is here - --> tests/ui/shadow.rs:95:9 + --> tests/ui/shadow.rs:90:9 | LL | let y = Some(1); | ^ error: `_b` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:133:9 + --> tests/ui/shadow.rs:128:9 | LL | let _b = _a; | ^^ | note: previous binding is here - --> tests/ui/shadow.rs:132:28 + --> tests/ui/shadow.rs:127:28 | LL | pub async fn foo2(_a: i32, _b: i64) { | ^^ error: `x` shadows a previous, unrelated binding - --> tests/ui/shadow.rs:140:21 + --> tests/ui/shadow.rs:135:21 | LL | if let Some(x) = Some(1) { x } else { 1 } | ^ | note: previous binding is here - --> tests/ui/shadow.rs:139:13 + --> tests/ui/shadow.rs:134:13 | LL | let x = 1; | ^ error: `x` is shadowed - --> tests/ui/shadow.rs:151:20 + --> tests/ui/shadow.rs:146:20 | LL | let z = x.map(|x| x + 1); | ^ | note: previous binding is here - --> tests/ui/shadow.rs:148:9 + --> tests/ui/shadow.rs:143:9 | LL | let x = Some(1); | ^ error: `i` is shadowed - --> tests/ui/shadow.rs:156:25 + --> tests/ui/shadow.rs:151:25 | LL | .map(|i| i.map(|i| i - 10)) | ^ | note: previous binding is here - --> tests/ui/shadow.rs:156:15 + --> tests/ui/shadow.rs:151:15 | LL | .map(|i| i.map(|i| i - 10)) | ^ error: `value` is shadowed by itself in `value` - --> tests/ui/shadow.rs:166:22 + --> tests/ui/shadow.rs:161:22 | LL | let Issue13795 { value, .. } = value; | ^^^^^ | note: previous binding is here - --> tests/ui/shadow.rs:165:15 + --> tests/ui/shadow.rs:160:15 | LL | fn issue13795(value: Issue13795) { | ^^^^^ diff --git a/tests/ui/short_circuit_statement.fixed b/tests/ui/short_circuit_statement.fixed index 133d296e259c..00b85de2d5c2 100644 --- a/tests/ui/short_circuit_statement.fixed +++ b/tests/ui/short_circuit_statement.fixed @@ -1,5 +1,4 @@ #![warn(clippy::short_circuit_statement)] -#![allow(clippy::nonminimal_bool)] fn main() { if f() { g(); } diff --git a/tests/ui/short_circuit_statement.rs b/tests/ui/short_circuit_statement.rs index 4275ae64fdd6..eaedaadba758 100644 --- a/tests/ui/short_circuit_statement.rs +++ b/tests/ui/short_circuit_statement.rs @@ -1,5 +1,4 @@ #![warn(clippy::short_circuit_statement)] -#![allow(clippy::nonminimal_bool)] fn main() { f() && g(); diff --git a/tests/ui/short_circuit_statement.stderr b/tests/ui/short_circuit_statement.stderr index acd28d41a33a..4dc40fc7a130 100644 --- a/tests/ui/short_circuit_statement.stderr +++ b/tests/ui/short_circuit_statement.stderr @@ -1,5 +1,5 @@ error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:5:5 + --> tests/ui/short_circuit_statement.rs:4:5 | LL | f() && g(); | ^^^^^^^^^^^ help: replace it with: `if f() { g(); }` @@ -8,37 +8,37 @@ LL | f() && g(); = help: to override `-D warnings` add `#[allow(clippy::short_circuit_statement)]` error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:8:5 + --> tests/ui/short_circuit_statement.rs:7:5 | LL | f() || g(); | ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:11:5 + --> tests/ui/short_circuit_statement.rs:10:5 | LL | 1 == 2 || g(); | ^^^^^^^^^^^^^^ help: replace it with: `if 1 != 2 { g(); }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:14:5 + --> tests/ui/short_circuit_statement.rs:13:5 | LL | (f() || g()) && (H * 2); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `if f() || g() { H * 2; }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:17:5 + --> tests/ui/short_circuit_statement.rs:16:5 | LL | (f() || g()) || (H * 2); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `if !(f() || g()) { H * 2; }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:32:5 + --> tests/ui/short_circuit_statement.rs:31:5 | LL | mac!() && mac!(); | ^^^^^^^^^^^^^^^^^ help: replace it with: `if mac!() { mac!(); }` error: boolean short circuit operator in statement may be clearer using an explicit test - --> tests/ui/short_circuit_statement.rs:35:5 + --> tests/ui/short_circuit_statement.rs:34:5 | LL | mac!() || mac!(); | ^^^^^^^^^^^^^^^^^ help: replace it with: `if !mac!() { mac!(); }` diff --git a/tests/ui/should_impl_trait/corner_cases.rs b/tests/ui/should_impl_trait/corner_cases.rs index 53704f59cb99..724e0a7e4c5c 100644 --- a/tests/ui/should_impl_trait/corner_cases.rs +++ b/tests/ui/should_impl_trait/corner_cases.rs @@ -1,16 +1,10 @@ //@ check-pass -#![allow( - clippy::missing_errors_doc, - clippy::needless_pass_by_value, - clippy::must_use_candidate, - clippy::unused_self, - clippy::needless_lifetimes, +#![warn(clippy::should_implement_trait)] +#![expect( clippy::missing_safety_doc, - clippy::wrong_self_convention, - clippy::missing_panics_doc, - clippy::return_self_not_must_use, - clippy::unused_async + clippy::needless_lifetimes, + clippy::wrong_self_convention )] use std::ops::Mul; diff --git a/tests/ui/should_impl_trait/method_list_1.edition2015.stderr b/tests/ui/should_impl_trait/method_list_1.edition2015.stderr index 0312fa8f04fa..aedebc64fee0 100644 --- a/tests/ui/should_impl_trait/method_list_1.edition2015.stderr +++ b/tests/ui/should_impl_trait/method_list_1.edition2015.stderr @@ -1,5 +1,5 @@ error: method `add` can be confused for the standard trait method `std::ops::Add::add` - --> tests/ui/should_impl_trait/method_list_1.rs:27:5 + --> tests/ui/should_impl_trait/method_list_1.rs:17:5 | LL | / pub fn add(self, other: T) -> T { LL | | @@ -13,7 +13,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::should_implement_trait)]` error: method `as_mut` can be confused for the standard trait method `std::convert::AsMut::as_mut` - --> tests/ui/should_impl_trait/method_list_1.rs:33:5 + --> tests/ui/should_impl_trait/method_list_1.rs:23:5 | LL | / pub fn as_mut(&mut self) -> &mut T { LL | | @@ -25,7 +25,7 @@ LL | | } = help: consider implementing the trait `std::convert::AsMut` or choosing a less ambiguous method name error: method `as_ref` can be confused for the standard trait method `std::convert::AsRef::as_ref` - --> tests/ui/should_impl_trait/method_list_1.rs:39:5 + --> tests/ui/should_impl_trait/method_list_1.rs:29:5 | LL | / pub fn as_ref(&self) -> &T { LL | | @@ -37,7 +37,7 @@ LL | | } = help: consider implementing the trait `std::convert::AsRef` or choosing a less ambiguous method name error: method `bitand` can be confused for the standard trait method `std::ops::BitAnd::bitand` - --> tests/ui/should_impl_trait/method_list_1.rs:45:5 + --> tests/ui/should_impl_trait/method_list_1.rs:35:5 | LL | / pub fn bitand(self, rhs: T) -> T { LL | | @@ -49,7 +49,7 @@ LL | | } = help: consider implementing the trait `std::ops::BitAnd` or choosing a less ambiguous method name error: method `bitor` can be confused for the standard trait method `std::ops::BitOr::bitor` - --> tests/ui/should_impl_trait/method_list_1.rs:51:5 + --> tests/ui/should_impl_trait/method_list_1.rs:41:5 | LL | / pub fn bitor(self, rhs: Self) -> Self { LL | | @@ -61,7 +61,7 @@ LL | | } = help: consider implementing the trait `std::ops::BitOr` or choosing a less ambiguous method name error: method `bitxor` can be confused for the standard trait method `std::ops::BitXor::bitxor` - --> tests/ui/should_impl_trait/method_list_1.rs:57:5 + --> tests/ui/should_impl_trait/method_list_1.rs:47:5 | LL | / pub fn bitxor(self, rhs: Self) -> Self { LL | | @@ -73,7 +73,7 @@ LL | | } = help: consider implementing the trait `std::ops::BitXor` or choosing a less ambiguous method name error: method `borrow` can be confused for the standard trait method `std::borrow::Borrow::borrow` - --> tests/ui/should_impl_trait/method_list_1.rs:63:5 + --> tests/ui/should_impl_trait/method_list_1.rs:53:5 | LL | / pub fn borrow(&self) -> &str { LL | | @@ -85,7 +85,7 @@ LL | | } = help: consider implementing the trait `std::borrow::Borrow` or choosing a less ambiguous method name error: method `borrow_mut` can be confused for the standard trait method `std::borrow::BorrowMut::borrow_mut` - --> tests/ui/should_impl_trait/method_list_1.rs:69:5 + --> tests/ui/should_impl_trait/method_list_1.rs:59:5 | LL | / pub fn borrow_mut(&mut self) -> &mut str { LL | | @@ -97,7 +97,7 @@ LL | | } = help: consider implementing the trait `std::borrow::BorrowMut` or choosing a less ambiguous method name error: method `clone` can be confused for the standard trait method `std::clone::Clone::clone` - --> tests/ui/should_impl_trait/method_list_1.rs:75:5 + --> tests/ui/should_impl_trait/method_list_1.rs:65:5 | LL | / pub fn clone(&self) -> Self { LL | | @@ -109,7 +109,7 @@ LL | | } = help: consider implementing the trait `std::clone::Clone` or choosing a less ambiguous method name error: method `cmp` can be confused for the standard trait method `std::cmp::Ord::cmp` - --> tests/ui/should_impl_trait/method_list_1.rs:81:5 + --> tests/ui/should_impl_trait/method_list_1.rs:71:5 | LL | / pub fn cmp(&self, other: &Self) -> Self { LL | | @@ -121,7 +121,7 @@ LL | | } = help: consider implementing the trait `std::cmp::Ord` or choosing a less ambiguous method name error: method `default` can be confused for the standard trait method `std::default::Default::default` - --> tests/ui/should_impl_trait/method_list_1.rs:87:5 + --> tests/ui/should_impl_trait/method_list_1.rs:77:5 | LL | / pub fn default() -> Self { LL | | @@ -133,7 +133,7 @@ LL | | } = help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name error: method `deref` can be confused for the standard trait method `std::ops::Deref::deref` - --> tests/ui/should_impl_trait/method_list_1.rs:93:5 + --> tests/ui/should_impl_trait/method_list_1.rs:83:5 | LL | / pub fn deref(&self) -> &Self { LL | | @@ -145,7 +145,7 @@ LL | | } = help: consider implementing the trait `std::ops::Deref` or choosing a less ambiguous method name error: method `deref_mut` can be confused for the standard trait method `std::ops::DerefMut::deref_mut` - --> tests/ui/should_impl_trait/method_list_1.rs:99:5 + --> tests/ui/should_impl_trait/method_list_1.rs:89:5 | LL | / pub fn deref_mut(&mut self) -> &mut Self { LL | | @@ -157,7 +157,7 @@ LL | | } = help: consider implementing the trait `std::ops::DerefMut` or choosing a less ambiguous method name error: method `div` can be confused for the standard trait method `std::ops::Div::div` - --> tests/ui/should_impl_trait/method_list_1.rs:105:5 + --> tests/ui/should_impl_trait/method_list_1.rs:95:5 | LL | / pub fn div(self, rhs: Self) -> Self { LL | | @@ -169,7 +169,7 @@ LL | | } = help: consider implementing the trait `std::ops::Div` or choosing a less ambiguous method name error: method `drop` can be confused for the standard trait method `std::ops::Drop::drop` - --> tests/ui/should_impl_trait/method_list_1.rs:111:5 + --> tests/ui/should_impl_trait/method_list_1.rs:101:5 | LL | / pub fn drop(&mut self) { LL | | diff --git a/tests/ui/should_impl_trait/method_list_1.edition2021.stderr b/tests/ui/should_impl_trait/method_list_1.edition2021.stderr index 0312fa8f04fa..aedebc64fee0 100644 --- a/tests/ui/should_impl_trait/method_list_1.edition2021.stderr +++ b/tests/ui/should_impl_trait/method_list_1.edition2021.stderr @@ -1,5 +1,5 @@ error: method `add` can be confused for the standard trait method `std::ops::Add::add` - --> tests/ui/should_impl_trait/method_list_1.rs:27:5 + --> tests/ui/should_impl_trait/method_list_1.rs:17:5 | LL | / pub fn add(self, other: T) -> T { LL | | @@ -13,7 +13,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::should_implement_trait)]` error: method `as_mut` can be confused for the standard trait method `std::convert::AsMut::as_mut` - --> tests/ui/should_impl_trait/method_list_1.rs:33:5 + --> tests/ui/should_impl_trait/method_list_1.rs:23:5 | LL | / pub fn as_mut(&mut self) -> &mut T { LL | | @@ -25,7 +25,7 @@ LL | | } = help: consider implementing the trait `std::convert::AsMut` or choosing a less ambiguous method name error: method `as_ref` can be confused for the standard trait method `std::convert::AsRef::as_ref` - --> tests/ui/should_impl_trait/method_list_1.rs:39:5 + --> tests/ui/should_impl_trait/method_list_1.rs:29:5 | LL | / pub fn as_ref(&self) -> &T { LL | | @@ -37,7 +37,7 @@ LL | | } = help: consider implementing the trait `std::convert::AsRef` or choosing a less ambiguous method name error: method `bitand` can be confused for the standard trait method `std::ops::BitAnd::bitand` - --> tests/ui/should_impl_trait/method_list_1.rs:45:5 + --> tests/ui/should_impl_trait/method_list_1.rs:35:5 | LL | / pub fn bitand(self, rhs: T) -> T { LL | | @@ -49,7 +49,7 @@ LL | | } = help: consider implementing the trait `std::ops::BitAnd` or choosing a less ambiguous method name error: method `bitor` can be confused for the standard trait method `std::ops::BitOr::bitor` - --> tests/ui/should_impl_trait/method_list_1.rs:51:5 + --> tests/ui/should_impl_trait/method_list_1.rs:41:5 | LL | / pub fn bitor(self, rhs: Self) -> Self { LL | | @@ -61,7 +61,7 @@ LL | | } = help: consider implementing the trait `std::ops::BitOr` or choosing a less ambiguous method name error: method `bitxor` can be confused for the standard trait method `std::ops::BitXor::bitxor` - --> tests/ui/should_impl_trait/method_list_1.rs:57:5 + --> tests/ui/should_impl_trait/method_list_1.rs:47:5 | LL | / pub fn bitxor(self, rhs: Self) -> Self { LL | | @@ -73,7 +73,7 @@ LL | | } = help: consider implementing the trait `std::ops::BitXor` or choosing a less ambiguous method name error: method `borrow` can be confused for the standard trait method `std::borrow::Borrow::borrow` - --> tests/ui/should_impl_trait/method_list_1.rs:63:5 + --> tests/ui/should_impl_trait/method_list_1.rs:53:5 | LL | / pub fn borrow(&self) -> &str { LL | | @@ -85,7 +85,7 @@ LL | | } = help: consider implementing the trait `std::borrow::Borrow` or choosing a less ambiguous method name error: method `borrow_mut` can be confused for the standard trait method `std::borrow::BorrowMut::borrow_mut` - --> tests/ui/should_impl_trait/method_list_1.rs:69:5 + --> tests/ui/should_impl_trait/method_list_1.rs:59:5 | LL | / pub fn borrow_mut(&mut self) -> &mut str { LL | | @@ -97,7 +97,7 @@ LL | | } = help: consider implementing the trait `std::borrow::BorrowMut` or choosing a less ambiguous method name error: method `clone` can be confused for the standard trait method `std::clone::Clone::clone` - --> tests/ui/should_impl_trait/method_list_1.rs:75:5 + --> tests/ui/should_impl_trait/method_list_1.rs:65:5 | LL | / pub fn clone(&self) -> Self { LL | | @@ -109,7 +109,7 @@ LL | | } = help: consider implementing the trait `std::clone::Clone` or choosing a less ambiguous method name error: method `cmp` can be confused for the standard trait method `std::cmp::Ord::cmp` - --> tests/ui/should_impl_trait/method_list_1.rs:81:5 + --> tests/ui/should_impl_trait/method_list_1.rs:71:5 | LL | / pub fn cmp(&self, other: &Self) -> Self { LL | | @@ -121,7 +121,7 @@ LL | | } = help: consider implementing the trait `std::cmp::Ord` or choosing a less ambiguous method name error: method `default` can be confused for the standard trait method `std::default::Default::default` - --> tests/ui/should_impl_trait/method_list_1.rs:87:5 + --> tests/ui/should_impl_trait/method_list_1.rs:77:5 | LL | / pub fn default() -> Self { LL | | @@ -133,7 +133,7 @@ LL | | } = help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name error: method `deref` can be confused for the standard trait method `std::ops::Deref::deref` - --> tests/ui/should_impl_trait/method_list_1.rs:93:5 + --> tests/ui/should_impl_trait/method_list_1.rs:83:5 | LL | / pub fn deref(&self) -> &Self { LL | | @@ -145,7 +145,7 @@ LL | | } = help: consider implementing the trait `std::ops::Deref` or choosing a less ambiguous method name error: method `deref_mut` can be confused for the standard trait method `std::ops::DerefMut::deref_mut` - --> tests/ui/should_impl_trait/method_list_1.rs:99:5 + --> tests/ui/should_impl_trait/method_list_1.rs:89:5 | LL | / pub fn deref_mut(&mut self) -> &mut Self { LL | | @@ -157,7 +157,7 @@ LL | | } = help: consider implementing the trait `std::ops::DerefMut` or choosing a less ambiguous method name error: method `div` can be confused for the standard trait method `std::ops::Div::div` - --> tests/ui/should_impl_trait/method_list_1.rs:105:5 + --> tests/ui/should_impl_trait/method_list_1.rs:95:5 | LL | / pub fn div(self, rhs: Self) -> Self { LL | | @@ -169,7 +169,7 @@ LL | | } = help: consider implementing the trait `std::ops::Div` or choosing a less ambiguous method name error: method `drop` can be confused for the standard trait method `std::ops::Drop::drop` - --> tests/ui/should_impl_trait/method_list_1.rs:111:5 + --> tests/ui/should_impl_trait/method_list_1.rs:101:5 | LL | / pub fn drop(&mut self) { LL | | diff --git a/tests/ui/should_impl_trait/method_list_1.rs b/tests/ui/should_impl_trait/method_list_1.rs index bbb04c0c5aa1..3c33668fd605 100644 --- a/tests/ui/should_impl_trait/method_list_1.rs +++ b/tests/ui/should_impl_trait/method_list_1.rs @@ -1,18 +1,8 @@ //@revisions: edition2015 edition2021 //@[edition2015] edition:2015 //@[edition2021] edition:2021 -#![allow( - clippy::missing_errors_doc, - clippy::needless_pass_by_value, - clippy::must_use_candidate, - clippy::unused_self, - clippy::needless_lifetimes, - clippy::missing_safety_doc, - clippy::wrong_self_convention, - clippy::missing_panics_doc, - clippy::return_self_not_must_use -)] +#![warn(clippy::should_implement_trait)] use std::ops::Mul; use std::rc::{self, Rc}; use std::sync::{self, Arc}; diff --git a/tests/ui/should_impl_trait/method_list_2.edition2015.stderr b/tests/ui/should_impl_trait/method_list_2.edition2015.stderr index 259815908fee..bacd959d9ab6 100644 --- a/tests/ui/should_impl_trait/method_list_2.edition2015.stderr +++ b/tests/ui/should_impl_trait/method_list_2.edition2015.stderr @@ -1,5 +1,5 @@ error: method `eq` can be confused for the standard trait method `std::cmp::PartialEq::eq` - --> tests/ui/should_impl_trait/method_list_2.rs:28:5 + --> tests/ui/should_impl_trait/method_list_2.rs:18:5 | LL | / pub fn eq(&self, other: &Self) -> bool { LL | | @@ -13,7 +13,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::should_implement_trait)]` error: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str` - --> tests/ui/should_impl_trait/method_list_2.rs:40:5 + --> tests/ui/should_impl_trait/method_list_2.rs:30:5 | LL | / pub fn from_str(s: &str) -> Result { LL | | @@ -25,7 +25,7 @@ LL | | } = help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name error: method `hash` can be confused for the standard trait method `std::hash::Hash::hash` - --> tests/ui/should_impl_trait/method_list_2.rs:46:5 + --> tests/ui/should_impl_trait/method_list_2.rs:36:5 | LL | / pub fn hash(&self, state: &mut T) { LL | | @@ -37,7 +37,7 @@ LL | | } = help: consider implementing the trait `std::hash::Hash` or choosing a less ambiguous method name error: method `index` can be confused for the standard trait method `std::ops::Index::index` - --> tests/ui/should_impl_trait/method_list_2.rs:52:5 + --> tests/ui/should_impl_trait/method_list_2.rs:42:5 | LL | / pub fn index(&self, index: usize) -> &Self { LL | | @@ -49,7 +49,7 @@ LL | | } = help: consider implementing the trait `std::ops::Index` or choosing a less ambiguous method name error: method `index_mut` can be confused for the standard trait method `std::ops::IndexMut::index_mut` - --> tests/ui/should_impl_trait/method_list_2.rs:58:5 + --> tests/ui/should_impl_trait/method_list_2.rs:48:5 | LL | / pub fn index_mut(&mut self, index: usize) -> &mut Self { LL | | @@ -61,7 +61,7 @@ LL | | } = help: consider implementing the trait `std::ops::IndexMut` or choosing a less ambiguous method name error: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter` - --> tests/ui/should_impl_trait/method_list_2.rs:64:5 + --> tests/ui/should_impl_trait/method_list_2.rs:54:5 | LL | / pub fn into_iter(self) -> Self { LL | | @@ -73,7 +73,7 @@ LL | | } = help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name error: method `mul` can be confused for the standard trait method `std::ops::Mul::mul` - --> tests/ui/should_impl_trait/method_list_2.rs:70:5 + --> tests/ui/should_impl_trait/method_list_2.rs:60:5 | LL | / pub fn mul(self, rhs: Self) -> Self { LL | | @@ -85,7 +85,7 @@ LL | | } = help: consider implementing the trait `std::ops::Mul` or choosing a less ambiguous method name error: method `neg` can be confused for the standard trait method `std::ops::Neg::neg` - --> tests/ui/should_impl_trait/method_list_2.rs:76:5 + --> tests/ui/should_impl_trait/method_list_2.rs:66:5 | LL | / pub fn neg(self) -> Self { LL | | @@ -97,7 +97,7 @@ LL | | } = help: consider implementing the trait `std::ops::Neg` or choosing a less ambiguous method name error: method `next` can be confused for the standard trait method `std::iter::Iterator::next` - --> tests/ui/should_impl_trait/method_list_2.rs:82:5 + --> tests/ui/should_impl_trait/method_list_2.rs:72:5 | LL | / pub fn next(&mut self) -> Option { LL | | @@ -109,7 +109,7 @@ LL | | } = help: consider implementing the trait `std::iter::Iterator` or choosing a less ambiguous method name error: method `not` can be confused for the standard trait method `std::ops::Not::not` - --> tests/ui/should_impl_trait/method_list_2.rs:88:5 + --> tests/ui/should_impl_trait/method_list_2.rs:78:5 | LL | / pub fn not(self) -> Self { LL | | @@ -121,7 +121,7 @@ LL | | } = help: consider implementing the trait `std::ops::Not` or choosing a less ambiguous method name error: method `rem` can be confused for the standard trait method `std::ops::Rem::rem` - --> tests/ui/should_impl_trait/method_list_2.rs:94:5 + --> tests/ui/should_impl_trait/method_list_2.rs:84:5 | LL | / pub fn rem(self, rhs: Self) -> Self { LL | | @@ -133,7 +133,7 @@ LL | | } = help: consider implementing the trait `std::ops::Rem` or choosing a less ambiguous method name error: method `shl` can be confused for the standard trait method `std::ops::Shl::shl` - --> tests/ui/should_impl_trait/method_list_2.rs:100:5 + --> tests/ui/should_impl_trait/method_list_2.rs:90:5 | LL | / pub fn shl(self, rhs: Self) -> Self { LL | | @@ -145,7 +145,7 @@ LL | | } = help: consider implementing the trait `std::ops::Shl` or choosing a less ambiguous method name error: method `shr` can be confused for the standard trait method `std::ops::Shr::shr` - --> tests/ui/should_impl_trait/method_list_2.rs:106:5 + --> tests/ui/should_impl_trait/method_list_2.rs:96:5 | LL | / pub fn shr(self, rhs: Self) -> Self { LL | | @@ -157,7 +157,7 @@ LL | | } = help: consider implementing the trait `std::ops::Shr` or choosing a less ambiguous method name error: method `sub` can be confused for the standard trait method `std::ops::Sub::sub` - --> tests/ui/should_impl_trait/method_list_2.rs:112:5 + --> tests/ui/should_impl_trait/method_list_2.rs:102:5 | LL | / pub fn sub(self, rhs: Self) -> Self { LL | | diff --git a/tests/ui/should_impl_trait/method_list_2.edition2021.stderr b/tests/ui/should_impl_trait/method_list_2.edition2021.stderr index 2f90b61e7a17..99ed9b5080d1 100644 --- a/tests/ui/should_impl_trait/method_list_2.edition2021.stderr +++ b/tests/ui/should_impl_trait/method_list_2.edition2021.stderr @@ -1,5 +1,5 @@ error: method `eq` can be confused for the standard trait method `std::cmp::PartialEq::eq` - --> tests/ui/should_impl_trait/method_list_2.rs:28:5 + --> tests/ui/should_impl_trait/method_list_2.rs:18:5 | LL | / pub fn eq(&self, other: &Self) -> bool { LL | | @@ -13,7 +13,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::should_implement_trait)]` error: method `from_iter` can be confused for the standard trait method `std::iter::FromIterator::from_iter` - --> tests/ui/should_impl_trait/method_list_2.rs:34:5 + --> tests/ui/should_impl_trait/method_list_2.rs:24:5 | LL | / pub fn from_iter(iter: T) -> Self { LL | | @@ -25,7 +25,7 @@ LL | | } = help: consider implementing the trait `std::iter::FromIterator` or choosing a less ambiguous method name error: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str` - --> tests/ui/should_impl_trait/method_list_2.rs:40:5 + --> tests/ui/should_impl_trait/method_list_2.rs:30:5 | LL | / pub fn from_str(s: &str) -> Result { LL | | @@ -37,7 +37,7 @@ LL | | } = help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name error: method `hash` can be confused for the standard trait method `std::hash::Hash::hash` - --> tests/ui/should_impl_trait/method_list_2.rs:46:5 + --> tests/ui/should_impl_trait/method_list_2.rs:36:5 | LL | / pub fn hash(&self, state: &mut T) { LL | | @@ -49,7 +49,7 @@ LL | | } = help: consider implementing the trait `std::hash::Hash` or choosing a less ambiguous method name error: method `index` can be confused for the standard trait method `std::ops::Index::index` - --> tests/ui/should_impl_trait/method_list_2.rs:52:5 + --> tests/ui/should_impl_trait/method_list_2.rs:42:5 | LL | / pub fn index(&self, index: usize) -> &Self { LL | | @@ -61,7 +61,7 @@ LL | | } = help: consider implementing the trait `std::ops::Index` or choosing a less ambiguous method name error: method `index_mut` can be confused for the standard trait method `std::ops::IndexMut::index_mut` - --> tests/ui/should_impl_trait/method_list_2.rs:58:5 + --> tests/ui/should_impl_trait/method_list_2.rs:48:5 | LL | / pub fn index_mut(&mut self, index: usize) -> &mut Self { LL | | @@ -73,7 +73,7 @@ LL | | } = help: consider implementing the trait `std::ops::IndexMut` or choosing a less ambiguous method name error: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter` - --> tests/ui/should_impl_trait/method_list_2.rs:64:5 + --> tests/ui/should_impl_trait/method_list_2.rs:54:5 | LL | / pub fn into_iter(self) -> Self { LL | | @@ -85,7 +85,7 @@ LL | | } = help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name error: method `mul` can be confused for the standard trait method `std::ops::Mul::mul` - --> tests/ui/should_impl_trait/method_list_2.rs:70:5 + --> tests/ui/should_impl_trait/method_list_2.rs:60:5 | LL | / pub fn mul(self, rhs: Self) -> Self { LL | | @@ -97,7 +97,7 @@ LL | | } = help: consider implementing the trait `std::ops::Mul` or choosing a less ambiguous method name error: method `neg` can be confused for the standard trait method `std::ops::Neg::neg` - --> tests/ui/should_impl_trait/method_list_2.rs:76:5 + --> tests/ui/should_impl_trait/method_list_2.rs:66:5 | LL | / pub fn neg(self) -> Self { LL | | @@ -109,7 +109,7 @@ LL | | } = help: consider implementing the trait `std::ops::Neg` or choosing a less ambiguous method name error: method `next` can be confused for the standard trait method `std::iter::Iterator::next` - --> tests/ui/should_impl_trait/method_list_2.rs:82:5 + --> tests/ui/should_impl_trait/method_list_2.rs:72:5 | LL | / pub fn next(&mut self) -> Option { LL | | @@ -121,7 +121,7 @@ LL | | } = help: consider implementing the trait `std::iter::Iterator` or choosing a less ambiguous method name error: method `not` can be confused for the standard trait method `std::ops::Not::not` - --> tests/ui/should_impl_trait/method_list_2.rs:88:5 + --> tests/ui/should_impl_trait/method_list_2.rs:78:5 | LL | / pub fn not(self) -> Self { LL | | @@ -133,7 +133,7 @@ LL | | } = help: consider implementing the trait `std::ops::Not` or choosing a less ambiguous method name error: method `rem` can be confused for the standard trait method `std::ops::Rem::rem` - --> tests/ui/should_impl_trait/method_list_2.rs:94:5 + --> tests/ui/should_impl_trait/method_list_2.rs:84:5 | LL | / pub fn rem(self, rhs: Self) -> Self { LL | | @@ -145,7 +145,7 @@ LL | | } = help: consider implementing the trait `std::ops::Rem` or choosing a less ambiguous method name error: method `shl` can be confused for the standard trait method `std::ops::Shl::shl` - --> tests/ui/should_impl_trait/method_list_2.rs:100:5 + --> tests/ui/should_impl_trait/method_list_2.rs:90:5 | LL | / pub fn shl(self, rhs: Self) -> Self { LL | | @@ -157,7 +157,7 @@ LL | | } = help: consider implementing the trait `std::ops::Shl` or choosing a less ambiguous method name error: method `shr` can be confused for the standard trait method `std::ops::Shr::shr` - --> tests/ui/should_impl_trait/method_list_2.rs:106:5 + --> tests/ui/should_impl_trait/method_list_2.rs:96:5 | LL | / pub fn shr(self, rhs: Self) -> Self { LL | | @@ -169,7 +169,7 @@ LL | | } = help: consider implementing the trait `std::ops::Shr` or choosing a less ambiguous method name error: method `sub` can be confused for the standard trait method `std::ops::Sub::sub` - --> tests/ui/should_impl_trait/method_list_2.rs:112:5 + --> tests/ui/should_impl_trait/method_list_2.rs:102:5 | LL | / pub fn sub(self, rhs: Self) -> Self { LL | | diff --git a/tests/ui/should_impl_trait/method_list_2.rs b/tests/ui/should_impl_trait/method_list_2.rs index 4c6d7df236ef..71fc2100c734 100644 --- a/tests/ui/should_impl_trait/method_list_2.rs +++ b/tests/ui/should_impl_trait/method_list_2.rs @@ -1,18 +1,8 @@ //@revisions: edition2015 edition2021 //@[edition2015] edition:2015 //@[edition2021] edition:2021 -#![allow( - clippy::missing_errors_doc, - clippy::needless_pass_by_value, - clippy::must_use_candidate, - clippy::unused_self, - clippy::needless_lifetimes, - clippy::missing_safety_doc, - clippy::wrong_self_convention, - clippy::missing_panics_doc, - clippy::return_self_not_must_use -)] +#![warn(clippy::should_implement_trait)] use std::ops::Mul; use std::rc::{self, Rc}; use std::sync::{self, Arc}; diff --git a/tests/ui/significant_drop_in_scrutinee.rs b/tests/ui/significant_drop_in_scrutinee.rs index 78fc365bd5bb..f9d33014c958 100644 --- a/tests/ui/significant_drop_in_scrutinee.rs +++ b/tests/ui/significant_drop_in_scrutinee.rs @@ -1,13 +1,7 @@ // FIXME: Ideally these suggestions would be fixed via rustfix. Blocked by rust-lang/rust#53934 //@no-rustfix #![warn(clippy::significant_drop_in_scrutinee)] -#![allow(dead_code, unused_assignments)] -#![allow( - clippy::match_single_binding, - clippy::single_match, - clippy::uninlined_format_args, - clippy::needless_lifetimes -)] +#![expect(clippy::match_single_binding, clippy::single_match)] use std::num::ParseIntError; use std::ops::Deref; diff --git a/tests/ui/significant_drop_in_scrutinee.stderr b/tests/ui/significant_drop_in_scrutinee.stderr index b32b249fd429..24fe4571b670 100644 --- a/tests/ui/significant_drop_in_scrutinee.stderr +++ b/tests/ui/significant_drop_in_scrutinee.stderr @@ -1,5 +1,5 @@ error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:60:11 + --> tests/ui/significant_drop_in_scrutinee.rs:54:11 | LL | match mutex.lock().unwrap().foo() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:147:11 + --> tests/ui/significant_drop_in_scrutinee.rs:141:11 | LL | match s.lock_m().get_the_value() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:169:11 + --> tests/ui/significant_drop_in_scrutinee.rs:163:11 | LL | match s.lock_m_m().get_the_value() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -64,7 +64,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:218:11 + --> tests/ui/significant_drop_in_scrutinee.rs:212:11 | LL | match counter.temp_increment().len() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:242:16 + --> tests/ui/significant_drop_in_scrutinee.rs:236:16 | LL | match (mutex1.lock().unwrap().s.len(), true) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL ~ match (value, true) { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:252:22 + --> tests/ui/significant_drop_in_scrutinee.rs:246:22 | LL | match (true, mutex1.lock().unwrap().s.len(), true) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -118,7 +118,7 @@ LL ~ match (true, value, true) { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:263:16 + --> tests/ui/significant_drop_in_scrutinee.rs:257:16 | LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL ~ match (value, true, mutex2.lock().unwrap().s.len()) { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:263:54 + --> tests/ui/significant_drop_in_scrutinee.rs:257:54 | LL | match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,7 +160,7 @@ LL ~ match (mutex1.lock().unwrap().s.len(), true, value) { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:316:11 + --> tests/ui/significant_drop_in_scrutinee.rs:310:11 | LL | match mutex.lock().unwrap().s.len() > 1 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -179,7 +179,7 @@ LL ~ match value > 1 { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:324:15 + --> tests/ui/significant_drop_in_scrutinee.rs:318:15 | LL | match 1 < mutex.lock().unwrap().s.len() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -198,7 +198,7 @@ LL ~ match 1 < value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:343:11 + --> tests/ui/significant_drop_in_scrutinee.rs:337:11 | LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -219,7 +219,7 @@ LL ~ match value < mutex2.lock().unwrap().s.len() { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:343:44 + --> tests/ui/significant_drop_in_scrutinee.rs:337:44 | LL | match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -240,7 +240,7 @@ LL ~ match mutex1.lock().unwrap().s.len() < value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:356:11 + --> tests/ui/significant_drop_in_scrutinee.rs:350:11 | LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -261,7 +261,7 @@ LL ~ match value >= mutex2.lock().unwrap().s.len() { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:356:45 + --> tests/ui/significant_drop_in_scrutinee.rs:350:45 | LL | match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -282,7 +282,7 @@ LL ~ match mutex1.lock().unwrap().s.len() >= value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:393:11 + --> tests/ui/significant_drop_in_scrutinee.rs:387:11 | LL | match get_mutex_guard().s.len() > 1 { | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -301,7 +301,7 @@ LL ~ match value > 1 { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:411:11 + --> tests/ui/significant_drop_in_scrutinee.rs:405:11 | LL | match match i { | ___________^ @@ -333,7 +333,7 @@ LL ~ match value | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:438:11 + --> tests/ui/significant_drop_in_scrutinee.rs:432:11 | LL | match if i > 1 { | ___________^ @@ -366,7 +366,7 @@ LL ~ match value | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:493:11 + --> tests/ui/significant_drop_in_scrutinee.rs:487:11 | LL | match s.lock().deref().deref() { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -384,7 +384,7 @@ LL ~ match (&value) { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:542:11 + --> tests/ui/significant_drop_in_scrutinee.rs:536:11 | LL | match mutex.lock().unwrap().i = i { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -403,7 +403,7 @@ LL ~ match () { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:549:15 + --> tests/ui/significant_drop_in_scrutinee.rs:543:15 | LL | match i = mutex.lock().unwrap().i { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -422,7 +422,7 @@ LL ~ match i = value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:556:11 + --> tests/ui/significant_drop_in_scrutinee.rs:550:11 | LL | match mutex.lock().unwrap().i += 1 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -441,7 +441,7 @@ LL ~ match () { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:563:16 + --> tests/ui/significant_drop_in_scrutinee.rs:557:16 | LL | match i += mutex.lock().unwrap().i { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -460,7 +460,7 @@ LL ~ match i += value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:627:11 + --> tests/ui/significant_drop_in_scrutinee.rs:621:11 | LL | match rwlock.read().unwrap().to_number() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -476,7 +476,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:654:11 + --> tests/ui/significant_drop_in_scrutinee.rs:648:11 | LL | match mutex.lock().unwrap().foo() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -492,7 +492,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:716:11 + --> tests/ui/significant_drop_in_scrutinee.rs:710:11 | LL | match guard.take().len() { | ^^^^^^^^^^^^^^^^^^ @@ -508,7 +508,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression - --> tests/ui/significant_drop_in_scrutinee.rs:741:16 + --> tests/ui/significant_drop_in_scrutinee.rs:735:16 | LL | for val in mutex.lock().unwrap().copy_old_lifetime() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -524,7 +524,7 @@ LL ~ for val in value { | error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression - --> tests/ui/significant_drop_in_scrutinee.rs:780:17 + --> tests/ui/significant_drop_in_scrutinee.rs:774:17 | LL | for val in [mutex.lock().unwrap()[0], 2] { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -540,7 +540,7 @@ LL ~ for val in [value, 2] { | error: temporary with significant `Drop` in `if let` scrutinee will live until the end of the `if let` expression - --> tests/ui/significant_drop_in_scrutinee.rs:789:24 + --> tests/ui/significant_drop_in_scrutinee.rs:783:24 | LL | if let Some(val) = mutex.lock().unwrap().first().copied() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -556,7 +556,7 @@ LL ~ if let Some(val) = value { | error: temporary with significant `Drop` in `while let` scrutinee will live until the end of the `while let` expression - --> tests/ui/significant_drop_in_scrutinee.rs:804:27 + --> tests/ui/significant_drop_in_scrutinee.rs:798:27 | LL | while let Some(val) = mutex.lock().unwrap().pop() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -567,7 +567,7 @@ LL | } = note: this might lead to deadlocks or other unexpected behavior error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:815:11 + --> tests/ui/significant_drop_in_scrutinee.rs:809:11 | LL | match *foo_async(&mutex).await.unwrap() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -583,7 +583,7 @@ LL ~ match value { | error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression - --> tests/ui/significant_drop_in_scrutinee.rs:835:19 + --> tests/ui/significant_drop_in_scrutinee.rs:829:19 | LL | let _ = match mutex.lock().unwrap().foo() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/similar_names.rs b/tests/ui/similar_names.rs index 4b5e85d0d320..771c333b076a 100644 --- a/tests/ui/similar_names.rs +++ b/tests/ui/similar_names.rs @@ -1,11 +1,9 @@ #![warn(clippy::similar_names)] -#![allow( - unused, - clippy::println_empty_string, +#![expect( + clippy::diverging_sub_expression, clippy::empty_loop, clippy::never_loop, - clippy::diverging_sub_expression, - clippy::let_unit_value + clippy::println_empty_string )] struct Foo { diff --git a/tests/ui/similar_names.stderr b/tests/ui/similar_names.stderr index 7e8d0b2a2b75..ca7fcbd9fffd 100644 --- a/tests/ui/similar_names.stderr +++ b/tests/ui/similar_names.stderr @@ -1,11 +1,11 @@ error: binding's name is too similar to existing binding - --> tests/ui/similar_names.rs:47:9 + --> tests/ui/similar_names.rs:45:9 | LL | let bluby: i32; | ^^^^^ | note: existing binding defined here - --> tests/ui/similar_names.rs:46:9 + --> tests/ui/similar_names.rs:44:9 | LL | let blubx: i32; | ^^^^^ @@ -13,61 +13,61 @@ LL | let blubx: i32; = help: to override `-D warnings` add `#[allow(clippy::similar_names)]` error: binding's name is too similar to existing binding - --> tests/ui/similar_names.rs:51:9 + --> tests/ui/similar_names.rs:49:9 | LL | let ornange: i32; | ^^^^^^^ | note: existing binding defined here - --> tests/ui/similar_names.rs:50:9 + --> tests/ui/similar_names.rs:48:9 | LL | let orange: i32; | ^^^^^^ error: binding's name is too similar to existing binding - --> tests/ui/similar_names.rs:56:9 + --> tests/ui/similar_names.rs:54:9 | LL | let coke: i32; | ^^^^ | note: existing binding defined here - --> tests/ui/similar_names.rs:55:9 + --> tests/ui/similar_names.rs:53:9 | LL | let cake: i32; | ^^^^ error: binding's name is too similar to existing binding - --> tests/ui/similar_names.rs:78:9 + --> tests/ui/similar_names.rs:76:9 | LL | let xyzeabc: i32; | ^^^^^^^ | note: existing binding defined here - --> tests/ui/similar_names.rs:76:9 + --> tests/ui/similar_names.rs:74:9 | LL | let xyz1abc: i32; | ^^^^^^^ error: binding's name is too similar to existing binding - --> tests/ui/similar_names.rs:83:9 + --> tests/ui/similar_names.rs:81:9 | LL | let parsee: i32; | ^^^^^^ | note: existing binding defined here - --> tests/ui/similar_names.rs:81:9 + --> tests/ui/similar_names.rs:79:9 | LL | let parser: i32; | ^^^^^^ error: binding's name is too similar to existing binding - --> tests/ui/similar_names.rs:112:16 + --> tests/ui/similar_names.rs:110:16 | LL | bpple: sprang, | ^^^^^^ | note: existing binding defined here - --> tests/ui/similar_names.rs:111:16 + --> tests/ui/similar_names.rs:109:16 | LL | apple: spring, | ^^^^^^ diff --git a/tests/ui/single_call_fn.rs b/tests/ui/single_call_fn.rs index a1ecd7bc166c..f1fa035a3c74 100644 --- a/tests/ui/single_call_fn.rs +++ b/tests/ui/single_call_fn.rs @@ -1,6 +1,5 @@ //@ignore-bitwidth: 32 //@aux-build:proc_macros.rs -#![allow(clippy::redundant_closure_call, unused)] #![warn(clippy::single_call_fn)] #![no_main] diff --git a/tests/ui/single_call_fn.stderr b/tests/ui/single_call_fn.stderr index 8dd90a123852..f1f6c9b86791 100644 --- a/tests/ui/single_call_fn.stderr +++ b/tests/ui/single_call_fn.stderr @@ -1,11 +1,11 @@ error: this function is only used once - --> tests/ui/single_call_fn.rs:13:1 + --> tests/ui/single_call_fn.rs:12:1 | LL | fn i() {} | ^^^^^^^^^ | note: used here - --> tests/ui/single_call_fn.rs:20:13 + --> tests/ui/single_call_fn.rs:19:13 | LL | let a = i; | ^ @@ -13,19 +13,19 @@ LL | let a = i; = help: to override `-D warnings` add `#[allow(clippy::single_call_fn)]` error: this function is only used once - --> tests/ui/single_call_fn.rs:15:1 + --> tests/ui/single_call_fn.rs:14:1 | LL | fn j() {} | ^^^^^^^^^ | note: used here - --> tests/ui/single_call_fn.rs:27:9 + --> tests/ui/single_call_fn.rs:26:9 | LL | j(); | ^ error: this function is only used once - --> tests/ui/single_call_fn.rs:36:1 + --> tests/ui/single_call_fn.rs:35:1 | LL | / fn c() { LL | | @@ -36,43 +36,43 @@ LL | | } | |_^ | note: used here - --> tests/ui/single_call_fn.rs:44:5 + --> tests/ui/single_call_fn.rs:43:5 | LL | c(); | ^ error: this function is only used once - --> tests/ui/single_call_fn.rs:47:1 + --> tests/ui/single_call_fn.rs:46:1 | LL | fn a() {} | ^^^^^^^^^ | note: used here - --> tests/ui/single_call_fn.rs:51:5 + --> tests/ui/single_call_fn.rs:50:5 | LL | a(); | ^ error: this function is only used once - --> tests/ui/single_call_fn.rs:93:5 + --> tests/ui/single_call_fn.rs:92:5 | LL | fn default() {} | ^^^^^^^^^^^^^^^ | note: used here - --> tests/ui/single_call_fn.rs:110:5 + --> tests/ui/single_call_fn.rs:109:5 | LL | T::default(); | ^^^^^^^^^^ error: this function is only used once - --> tests/ui/single_call_fn.rs:107:9 + --> tests/ui/single_call_fn.rs:106:9 | LL | fn foo() {} | ^^^^^^^^^^^ | note: used here - --> tests/ui/single_call_fn.rs:111:5 + --> tests/ui/single_call_fn.rs:110:5 | LL | S::foo(); | ^^^^^^ diff --git a/tests/ui/single_char_add_str.fixed b/tests/ui/single_char_add_str.fixed index b729cf8b2ca1..5fea41916e47 100644 --- a/tests/ui/single_char_add_str.fixed +++ b/tests/ui/single_char_add_str.fixed @@ -1,5 +1,4 @@ #![warn(clippy::single_char_add_str)] -#![allow(clippy::needless_raw_strings, clippy::needless_raw_string_hashes)] macro_rules! get_string { () => { diff --git a/tests/ui/single_char_add_str.rs b/tests/ui/single_char_add_str.rs index a768c47db391..0130a33f5299 100644 --- a/tests/ui/single_char_add_str.rs +++ b/tests/ui/single_char_add_str.rs @@ -1,5 +1,4 @@ #![warn(clippy::single_char_add_str)] -#![allow(clippy::needless_raw_strings, clippy::needless_raw_string_hashes)] macro_rules! get_string { () => { diff --git a/tests/ui/single_char_add_str.stderr b/tests/ui/single_char_add_str.stderr index a1fae93462c9..2f06c99ca19a 100644 --- a/tests/ui/single_char_add_str.stderr +++ b/tests/ui/single_char_add_str.stderr @@ -1,5 +1,5 @@ error: calling `push_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:14:5 + --> tests/ui/single_char_add_str.rs:13:5 | LL | string.push_str("R"); | ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('R')` @@ -8,121 +8,121 @@ LL | string.push_str("R"); = help: to override `-D warnings` add `#[allow(clippy::single_char_add_str)]` error: calling `push_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:16:5 + --> tests/ui/single_char_add_str.rs:15:5 | LL | string.push_str("'"); | ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\'')` error: calling `push_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:22:5 + --> tests/ui/single_char_add_str.rs:21:5 | LL | string.push_str("\x52"); | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\x52')` error: calling `push_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:24:5 + --> tests/ui/single_char_add_str.rs:23:5 | LL | string.push_str("\u{0052}"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\u{0052}')` error: calling `push_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:26:5 + --> tests/ui/single_char_add_str.rs:25:5 | LL | string.push_str(r##"a"##); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('a')` error: calling `push_str()` using a single-character converted to string - --> tests/ui/single_char_add_str.rs:30:5 + --> tests/ui/single_char_add_str.rs:29:5 | LL | string.push_str(&c_ref.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` without `to_string()`: `string.push(*c_ref)` error: calling `push_str()` using a single-character converted to string - --> tests/ui/single_char_add_str.rs:33:5 + --> tests/ui/single_char_add_str.rs:32:5 | LL | string.push_str(&c.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` without `to_string()`: `string.push(c)` error: calling `push_str()` using a single-character converted to string - --> tests/ui/single_char_add_str.rs:35:5 + --> tests/ui/single_char_add_str.rs:34:5 | LL | string.push_str(&'a'.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` without `to_string()`: `string.push('a')` error: calling `push_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:38:5 + --> tests/ui/single_char_add_str.rs:37:5 | LL | get_string!().push_str("ö"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `get_string!().push('ö')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:44:5 + --> tests/ui/single_char_add_str.rs:43:5 | LL | string.insert_str(0, "R"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, 'R')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:46:5 + --> tests/ui/single_char_add_str.rs:45:5 | LL | string.insert_str(1, "'"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(1, '\'')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:52:5 + --> tests/ui/single_char_add_str.rs:51:5 | LL | string.insert_str(0, "\x52"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\x52')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:54:5 + --> tests/ui/single_char_add_str.rs:53:5 | LL | string.insert_str(0, "\u{0052}"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\u{0052}')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:57:5 + --> tests/ui/single_char_add_str.rs:56:5 | LL | string.insert_str(x, r##"a"##); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(x, 'a')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:60:5 + --> tests/ui/single_char_add_str.rs:59:5 | LL | string.insert_str(Y, r##"a"##); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, 'a')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:62:5 + --> tests/ui/single_char_add_str.rs:61:5 | LL | string.insert_str(Y, r##"""##); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '"')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:64:5 + --> tests/ui/single_char_add_str.rs:63:5 | LL | string.insert_str(Y, r##"'"##); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '\'')` error: calling `insert_str()` using a single-character converted to string - --> tests/ui/single_char_add_str.rs:67:5 + --> tests/ui/single_char_add_str.rs:66:5 | LL | string.insert_str(0, &c_ref.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` without `to_string()`: `string.insert(0, *c_ref)` error: calling `insert_str()` using a single-character converted to string - --> tests/ui/single_char_add_str.rs:69:5 + --> tests/ui/single_char_add_str.rs:68:5 | LL | string.insert_str(0, &c.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` without `to_string()`: `string.insert(0, c)` error: calling `insert_str()` using a single-character converted to string - --> tests/ui/single_char_add_str.rs:71:5 + --> tests/ui/single_char_add_str.rs:70:5 | LL | string.insert_str(0, &'a'.to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` without `to_string()`: `string.insert(0, 'a')` error: calling `insert_str()` using a single-character string literal - --> tests/ui/single_char_add_str.rs:74:5 + --> tests/ui/single_char_add_str.rs:73:5 | LL | get_string!().insert_str(1, "?"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `get_string!().insert(1, '?')` diff --git a/tests/ui/single_char_lifetime_names.rs b/tests/ui/single_char_lifetime_names.rs index f4dcf46b0e2d..3fe5c5fb720c 100644 --- a/tests/ui/single_char_lifetime_names.rs +++ b/tests/ui/single_char_lifetime_names.rs @@ -1,5 +1,4 @@ #![warn(clippy::single_char_lifetime_names)] -#![allow(clippy::let_unit_value)] // Lifetimes should only be linted when they're introduced struct DiagnosticCtx<'a, 'b> diff --git a/tests/ui/single_char_lifetime_names.stderr b/tests/ui/single_char_lifetime_names.stderr index 834b654baa57..ff9d039e7d51 100644 --- a/tests/ui/single_char_lifetime_names.stderr +++ b/tests/ui/single_char_lifetime_names.stderr @@ -1,5 +1,5 @@ error: single-character lifetime names are likely uninformative - --> tests/ui/single_char_lifetime_names.rs:5:22 + --> tests/ui/single_char_lifetime_names.rs:4:22 | LL | struct DiagnosticCtx<'a, 'b> | ^^ @@ -9,7 +9,7 @@ LL | struct DiagnosticCtx<'a, 'b> = help: to override `-D warnings` add `#[allow(clippy::single_char_lifetime_names)]` error: single-character lifetime names are likely uninformative - --> tests/ui/single_char_lifetime_names.rs:5:26 + --> tests/ui/single_char_lifetime_names.rs:4:26 | LL | struct DiagnosticCtx<'a, 'b> | ^^ @@ -17,7 +17,7 @@ LL | struct DiagnosticCtx<'a, 'b> = help: use a more informative name error: single-character lifetime names are likely uninformative - --> tests/ui/single_char_lifetime_names.rs:16:6 + --> tests/ui/single_char_lifetime_names.rs:15:6 | LL | impl<'a, 'b> DiagnosticCtx<'a, 'b> { | ^^ @@ -25,7 +25,7 @@ LL | impl<'a, 'b> DiagnosticCtx<'a, 'b> { = help: use a more informative name error: single-character lifetime names are likely uninformative - --> tests/ui/single_char_lifetime_names.rs:16:10 + --> tests/ui/single_char_lifetime_names.rs:15:10 | LL | impl<'a, 'b> DiagnosticCtx<'a, 'b> { | ^^ @@ -33,7 +33,7 @@ LL | impl<'a, 'b> DiagnosticCtx<'a, 'b> { = help: use a more informative name error: single-character lifetime names are likely uninformative - --> tests/ui/single_char_lifetime_names.rs:39:15 + --> tests/ui/single_char_lifetime_names.rs:38:15 | LL | fn split_once<'a>(base: &'a str, other: &'_ str) -> (&'a str, Option<&'a str>) { | ^^ From 029b8d2e4e68243acbf1cd0b27b8d36860761e90 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 21 May 2026 19:06:48 +0200 Subject: [PATCH 09/11] Attributes cleanup in tests [12/20] --- tests/ui/methods.rs | 22 +------- tests/ui/methods.stderr | 6 +-- tests/ui/methods_fixable.fixed | 2 +- tests/ui/methods_fixable.rs | 2 +- tests/ui/min_ident_chars.rs | 4 +- tests/ui/min_max.rs | 3 +- tests/ui/min_max.stderr | 29 +++++------ tests/ui/min_rust_version_attr.rs | 1 - tests/ui/min_rust_version_attr.stderr | 12 ++--- tests/ui/mismatching_type_param_order.rs | 1 - tests/ui/mismatching_type_param_order.stderr | 20 ++++---- tests/ui/misnamed_getters.fixed | 3 +- tests/ui/misnamed_getters.rs | 3 +- tests/ui/misnamed_getters.stderr | 36 ++++++------- tests/ui/misnamed_getters_2021.fixed | 2 - tests/ui/misnamed_getters_2021.rs | 2 - tests/ui/misnamed_getters_2021.stderr | 2 +- tests/ui/misrefactored_assign_op.1.fixed | 3 +- tests/ui/misrefactored_assign_op.2.fixed | 3 +- tests/ui/misrefactored_assign_op.rs | 3 +- tests/ui/misrefactored_assign_op.stderr | 18 +++---- .../missing_asserts_for_indexing_unfixable.rs | 1 - ...sing_asserts_for_indexing_unfixable.stderr | 20 ++++---- .../missing_const_for_fn/could_be_const.fixed | 2 +- .../ui/missing_const_for_fn/could_be_const.rs | 2 +- tests/ui/missing_fields_in_debug.rs | 1 - tests/ui/missing_fields_in_debug.stderr | 16 +++--- tests/ui/missing_inline.rs | 2 +- tests/ui/missing_panics_doc.rs | 2 +- tests/ui/missing_spin_loop.fixed | 3 +- tests/ui/missing_spin_loop.rs | 3 +- tests/ui/missing_spin_loop.stderr | 12 ++--- tests/ui/missing_trait_methods.rs | 2 +- tests/ui/missing_transmute_annotations.fixed | 2 +- tests/ui/missing_transmute_annotations.rs | 2 +- tests/ui/mistyped_literal_suffix.fixed | 6 +-- tests/ui/mistyped_literal_suffix.rs | 6 +-- tests/ui/mistyped_literal_suffix.stderr | 35 ++++++------- tests/ui/module_name_repetitions.rs | 1 - tests/ui/module_name_repetitions.stderr | 12 ++--- tests/ui/modulo_arithmetic_float.rs | 2 +- tests/ui/modulo_arithmetic_integral.rs | 2 +- tests/ui/modulo_arithmetic_integral_const.rs | 7 +-- .../modulo_arithmetic_integral_const.stderr | 34 ++++++------- tests/ui/modulo_one.rs | 3 +- tests/ui/modulo_one.stderr | 12 ++--- .../ui/msrv_attributes_without_early_lints.rs | 1 - tests/ui/multiple_unsafe_ops_per_block.rs | 6 +-- tests/ui/must_use_candidates.fixed | 6 --- tests/ui/must_use_candidates.rs | 6 --- tests/ui/must_use_candidates.stderr | 14 +++--- tests/ui/must_use_unit.fixed | 2 +- tests/ui/must_use_unit.rs | 2 +- tests/ui/mut_from_ref.rs | 9 ++-- tests/ui/mut_from_ref.stderr | 32 ++++++------ tests/ui/mut_mut.fixed | 8 --- tests/ui/mut_mut.rs | 8 --- tests/ui/mut_mut.stderr | 14 +++--- tests/ui/mut_mut_unfixable.rs | 1 - tests/ui/mut_mut_unfixable.stderr | 12 ++--- tests/ui/mut_mutex_lock.fixed | 1 - tests/ui/mut_mutex_lock.rs | 1 - tests/ui/mut_mutex_lock.stderr | 4 +- tests/ui/mut_range_bound.rs | 2 +- tests/ui/mutex_atomic.fixed | 5 +- tests/ui/mutex_atomic.rs | 5 +- tests/ui/mutex_atomic.stderr | 30 +++++------ tests/ui/needless_arbitrary_self_type.fixed | 2 +- tests/ui/needless_arbitrary_self_type.rs | 2 +- tests/ui/needless_bitwise_bool.fixed | 2 +- tests/ui/needless_bitwise_bool.rs | 2 +- tests/ui/needless_bool/fixable.fixed | 14 +----- tests/ui/needless_bool/fixable.rs | 14 +----- tests/ui/needless_bool/fixable.stderr | 50 +++++++++---------- tests/ui/needless_bool/simple.rs | 9 +--- tests/ui/needless_bool/simple.stderr | 8 +-- tests/ui/needless_bool_assign.fixed | 1 - tests/ui/needless_bool_assign.rs | 1 - tests/ui/needless_bool_assign.stderr | 14 +++--- 79 files changed, 278 insertions(+), 377 deletions(-) diff --git a/tests/ui/methods.rs b/tests/ui/methods.rs index f73ec563dceb..b45b7dcd56a4 100644 --- a/tests/ui/methods.rs +++ b/tests/ui/methods.rs @@ -1,25 +1,7 @@ //@aux-build:option_helpers.rs -#![allow( - clippy::disallowed_names, - clippy::default_trait_access, - clippy::let_underscore_untyped, - clippy::missing_docs_in_private_items, - clippy::missing_safety_doc, - clippy::non_ascii_literal, - clippy::new_without_default, - clippy::needless_pass_by_value, - clippy::needless_lifetimes, - clippy::elidable_lifetime_names, - clippy::print_stdout, - clippy::must_use_candidate, - clippy::use_self, - clippy::useless_format, - clippy::wrong_self_convention, - clippy::unused_async, - clippy::unused_self, - clippy::useless_vec -)] +#![warn(clippy::filter_next, clippy::new_ret_no_self)] +#![expect(clippy::disallowed_names, clippy::useless_vec)] #[macro_use] extern crate option_helpers; diff --git a/tests/ui/methods.stderr b/tests/ui/methods.stderr index 45efea4ee01c..a637818cee48 100644 --- a/tests/ui/methods.stderr +++ b/tests/ui/methods.stderr @@ -1,5 +1,5 @@ error: methods called `new` usually return `Self` - --> tests/ui/methods.rs:102:5 + --> tests/ui/methods.rs:84:5 | LL | / fn new() -> i32 { LL | | @@ -11,7 +11,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::new_ret_no_self)]` error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead - --> tests/ui/methods.rs:124:13 + --> tests/ui/methods.rs:106:13 | LL | let _ = v.iter().filter(|&x| { | _____________^ @@ -25,7 +25,7 @@ LL | | ).next(); = help: to override `-D warnings` add `#[allow(clippy::filter_next)]` error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead - --> tests/ui/methods.rs:143:13 + --> tests/ui/methods.rs:125:13 | LL | let _ = v.iter().filter(|&x| { | _____________^ diff --git a/tests/ui/methods_fixable.fixed b/tests/ui/methods_fixable.fixed index 287d8d881ec2..17a751eb7945 100644 --- a/tests/ui/methods_fixable.fixed +++ b/tests/ui/methods_fixable.fixed @@ -1,5 +1,5 @@ #![warn(clippy::filter_next)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] /// Checks implementation of `FILTER_NEXT` lint. fn main() { diff --git a/tests/ui/methods_fixable.rs b/tests/ui/methods_fixable.rs index 11ce1b63560d..b2520acc3638 100644 --- a/tests/ui/methods_fixable.rs +++ b/tests/ui/methods_fixable.rs @@ -1,5 +1,5 @@ #![warn(clippy::filter_next)] -#![allow(clippy::useless_vec)] +#![expect(clippy::useless_vec)] /// Checks implementation of `FILTER_NEXT` lint. fn main() { diff --git a/tests/ui/min_ident_chars.rs b/tests/ui/min_ident_chars.rs index e2f82e2a182f..298798be7a1e 100644 --- a/tests/ui/min_ident_chars.rs +++ b/tests/ui/min_ident_chars.rs @@ -1,7 +1,7 @@ //@aux-build:proc_macros.rs -#![allow(irrefutable_let_patterns, nonstandard_style, unused)] -#![allow(clippy::struct_field_names)] #![warn(clippy::min_ident_chars)] +#![expect(irrefutable_let_patterns, nonstandard_style)] +#![allow(clippy::struct_field_names)] extern crate proc_macros; use proc_macros::{external, with_span}; diff --git a/tests/ui/min_max.rs b/tests/ui/min_max.rs index ee19d3ff7142..cc97e496514b 100644 --- a/tests/ui/min_max.rs +++ b/tests/ui/min_max.rs @@ -1,4 +1,5 @@ -#![allow(clippy::manual_clamp)] +#![warn(clippy::min_max)] +#![expect(clippy::manual_clamp)] use std::cmp::{max as my_max, max, min as my_min, min}; diff --git a/tests/ui/min_max.stderr b/tests/ui/min_max.stderr index 87510a465a08..84b4d3754552 100644 --- a/tests/ui/min_max.stderr +++ b/tests/ui/min_max.stderr @@ -1,79 +1,80 @@ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:21:5 + --> tests/ui/min_max.rs:22:5 | LL | min(1, max(3, x)); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(clippy::min_max)]` on by default + = note: `-D clippy::min-max` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::min_max)]` error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:24:5 + --> tests/ui/min_max.rs:25:5 | LL | min(max(3, x), 1); | ^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:27:5 + --> tests/ui/min_max.rs:28:5 | LL | max(min(x, 1), 3); | ^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:30:5 + --> tests/ui/min_max.rs:31:5 | LL | max(3, min(x, 1)); | ^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:33:5 + --> tests/ui/min_max.rs:34:5 | LL | my_max(3, my_min(x, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:44:5 + --> tests/ui/min_max.rs:45:5 | LL | min("Apple", max("Zoo", s)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:47:5 + --> tests/ui/min_max.rs:48:5 | LL | max(min(s, "Apple"), "Zoo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:53:5 + --> tests/ui/min_max.rs:54:5 | LL | x.min(1).max(3); | ^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:56:5 + --> tests/ui/min_max.rs:57:5 | LL | x.max(3).min(1); | ^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:59:5 + --> tests/ui/min_max.rs:60:5 | LL | f.max(3f32).min(1f32); | ^^^^^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:66:5 + --> tests/ui/min_max.rs:67:5 | LL | max(x.min(1), 3); | ^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:71:5 + --> tests/ui/min_max.rs:72:5 | LL | s.max("Zoo").min("Apple"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: this `min`/`max` combination leads to constant result - --> tests/ui/min_max.rs:74:5 + --> tests/ui/min_max.rs:75:5 | LL | s.min("Apple").max("Zoo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/min_rust_version_attr.rs b/tests/ui/min_rust_version_attr.rs index 4627bef28a29..c624774a8a9c 100644 --- a/tests/ui/min_rust_version_attr.rs +++ b/tests/ui/min_rust_version_attr.rs @@ -1,4 +1,3 @@ -#![allow(clippy::redundant_clone)] #![feature(custom_inner_attributes)] fn main() {} diff --git a/tests/ui/min_rust_version_attr.stderr b/tests/ui/min_rust_version_attr.stderr index 809b1cfe73bf..842bd5c23861 100644 --- a/tests/ui/min_rust_version_attr.stderr +++ b/tests/ui/min_rust_version_attr.stderr @@ -1,5 +1,5 @@ error: approximate value of `f{32, 64}::consts::LOG2_10` found - --> tests/ui/min_rust_version_attr.rs:13:19 + --> tests/ui/min_rust_version_attr.rs:12:19 | LL | let log2_10 = 3.321928094887362; | ^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let log2_10 = 3.321928094887362; = note: `#[deny(clippy::approx_constant)]` on by default error: approximate value of `f{32, 64}::consts::LOG2_10` found - --> tests/ui/min_rust_version_attr.rs:19:19 + --> tests/ui/min_rust_version_attr.rs:18:19 | LL | let log2_10 = 3.321928094887362; | ^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | let log2_10 = 3.321928094887362; = help: consider using the constant directly error: approximate value of `f{32, 64}::consts::LOG2_10` found - --> tests/ui/min_rust_version_attr.rs:30:19 + --> tests/ui/min_rust_version_attr.rs:29:19 | LL | let log2_10 = 3.321928094887362; | ^^^^^^^^^^^^^^^^^ @@ -24,7 +24,7 @@ LL | let log2_10 = 3.321928094887362; = help: consider using the constant directly error: approximate value of `f{32, 64}::consts::LOG2_10` found - --> tests/ui/min_rust_version_attr.rs:41:19 + --> tests/ui/min_rust_version_attr.rs:40:19 | LL | let log2_10 = 3.321928094887362; | ^^^^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ LL | let log2_10 = 3.321928094887362; = help: consider using the constant directly error: approximate value of `f{32, 64}::consts::LOG2_10` found - --> tests/ui/min_rust_version_attr.rs:52:19 + --> tests/ui/min_rust_version_attr.rs:51:19 | LL | let log2_10 = 3.321928094887362; | ^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | let log2_10 = 3.321928094887362; = help: consider using the constant directly error: approximate value of `f{32, 64}::consts::LOG2_10` found - --> tests/ui/min_rust_version_attr.rs:60:27 + --> tests/ui/min_rust_version_attr.rs:59:27 | LL | let log2_10 = 3.321928094887362; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/mismatching_type_param_order.rs b/tests/ui/mismatching_type_param_order.rs index 11ff865b583b..49d703144106 100644 --- a/tests/ui/mismatching_type_param_order.rs +++ b/tests/ui/mismatching_type_param_order.rs @@ -1,5 +1,4 @@ #![warn(clippy::mismatching_type_param_order)] -#![allow(clippy::disallowed_names, clippy::needless_lifetimes)] fn main() { struct Foo { diff --git a/tests/ui/mismatching_type_param_order.stderr b/tests/ui/mismatching_type_param_order.stderr index 214d9d734d1b..a1b5ca7ec26c 100644 --- a/tests/ui/mismatching_type_param_order.stderr +++ b/tests/ui/mismatching_type_param_order.stderr @@ -1,5 +1,5 @@ error: `Foo` has a similarly named generic type parameter `B` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:11:20 + --> tests/ui/mismatching_type_param_order.rs:10:20 | LL | impl Foo {} | ^ @@ -9,7 +9,7 @@ LL | impl Foo {} = help: to override `-D warnings` add `#[allow(clippy::mismatching_type_param_order)]` error: `Foo` has a similarly named generic type parameter `A` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:11:23 + --> tests/ui/mismatching_type_param_order.rs:10:23 | LL | impl Foo {} | ^ @@ -17,7 +17,7 @@ LL | impl Foo {} = help: try `B`, or a name that does not conflict with `Foo`'s generic params error: `Foo` has a similarly named generic type parameter `A` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:16:23 + --> tests/ui/mismatching_type_param_order.rs:15:23 | LL | impl Foo {} | ^ @@ -25,7 +25,7 @@ LL | impl Foo {} = help: try `B`, or a name that does not conflict with `Foo`'s generic params error: `FooLifetime` has a similarly named generic type parameter `B` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:28:44 + --> tests/ui/mismatching_type_param_order.rs:27:44 | LL | impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {} | ^ @@ -33,7 +33,7 @@ LL | impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {} = help: try `A`, or a name that does not conflict with `FooLifetime`'s generic params error: `FooLifetime` has a similarly named generic type parameter `A` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:28:47 + --> tests/ui/mismatching_type_param_order.rs:27:47 | LL | impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {} | ^ @@ -41,7 +41,7 @@ LL | impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {} = help: try `B`, or a name that does not conflict with `FooLifetime`'s generic params error: `FooEnum` has a similarly named generic type parameter `C` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:46:27 + --> tests/ui/mismatching_type_param_order.rs:45:27 | LL | impl FooEnum {} | ^ @@ -49,7 +49,7 @@ LL | impl FooEnum {} = help: try `A`, or a name that does not conflict with `FooEnum`'s generic params error: `FooEnum` has a similarly named generic type parameter `A` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:46:30 + --> tests/ui/mismatching_type_param_order.rs:45:30 | LL | impl FooEnum {} | ^ @@ -57,7 +57,7 @@ LL | impl FooEnum {} = help: try `B`, or a name that does not conflict with `FooEnum`'s generic params error: `FooEnum` has a similarly named generic type parameter `B` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:46:33 + --> tests/ui/mismatching_type_param_order.rs:45:33 | LL | impl FooEnum {} | ^ @@ -65,7 +65,7 @@ LL | impl FooEnum {} = help: try `C`, or a name that does not conflict with `FooEnum`'s generic params error: `FooUnion` has a similarly named generic type parameter `B` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:60:31 + --> tests/ui/mismatching_type_param_order.rs:59:31 | LL | impl FooUnion where A: Copy {} | ^ @@ -73,7 +73,7 @@ LL | impl FooUnion where A: Copy {} = help: try `A`, or a name that does not conflict with `FooUnion`'s generic params error: `FooUnion` has a similarly named generic type parameter `A` in its declaration, but in a different order - --> tests/ui/mismatching_type_param_order.rs:60:34 + --> tests/ui/mismatching_type_param_order.rs:59:34 | LL | impl FooUnion where A: Copy {} | ^ diff --git a/tests/ui/misnamed_getters.fixed b/tests/ui/misnamed_getters.fixed index bc123d1a40ba..479d5f91492d 100644 --- a/tests/ui/misnamed_getters.fixed +++ b/tests/ui/misnamed_getters.fixed @@ -1,6 +1,5 @@ -#![allow(unused)] -#![allow(clippy::struct_field_names)] #![warn(clippy::misnamed_getters)] +#![expect(clippy::struct_field_names)] struct A { a: u8, diff --git a/tests/ui/misnamed_getters.rs b/tests/ui/misnamed_getters.rs index 6590101157c3..985c273c59ed 100644 --- a/tests/ui/misnamed_getters.rs +++ b/tests/ui/misnamed_getters.rs @@ -1,6 +1,5 @@ -#![allow(unused)] -#![allow(clippy::struct_field_names)] #![warn(clippy::misnamed_getters)] +#![expect(clippy::struct_field_names)] struct A { a: u8, diff --git a/tests/ui/misnamed_getters.stderr b/tests/ui/misnamed_getters.stderr index aaf21cecb925..37f57d7f79e5 100644 --- a/tests/ui/misnamed_getters.stderr +++ b/tests/ui/misnamed_getters.stderr @@ -1,5 +1,5 @@ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:12:5 + --> tests/ui/misnamed_getters.rs:11:5 | LL | / fn a(&self) -> &u8 { LL | | @@ -13,7 +13,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::misnamed_getters)]` error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:17:5 + --> tests/ui/misnamed_getters.rs:16:5 | LL | / fn a_mut(&mut self) -> &mut u8 { LL | | @@ -24,7 +24,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:23:5 + --> tests/ui/misnamed_getters.rs:22:5 | LL | / fn b(self) -> u8 { LL | | @@ -35,7 +35,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:29:5 + --> tests/ui/misnamed_getters.rs:28:5 | LL | / fn b_mut(&mut self) -> &mut u8 { LL | | @@ -46,7 +46,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:35:5 + --> tests/ui/misnamed_getters.rs:34:5 | LL | / fn c(&self) -> &u8 { LL | | @@ -57,7 +57,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:41:5 + --> tests/ui/misnamed_getters.rs:40:5 | LL | / fn c_mut(&mut self) -> &mut u8 { LL | | @@ -68,7 +68,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:54:5 + --> tests/ui/misnamed_getters.rs:53:5 | LL | / unsafe fn a(&self) -> &u8 { LL | | @@ -79,7 +79,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:59:5 + --> tests/ui/misnamed_getters.rs:58:5 | LL | / unsafe fn a_mut(&mut self) -> &mut u8 { LL | | @@ -90,7 +90,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:65:5 + --> tests/ui/misnamed_getters.rs:64:5 | LL | / unsafe fn b(self) -> u8 { LL | | @@ -101,7 +101,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:71:5 + --> tests/ui/misnamed_getters.rs:70:5 | LL | / unsafe fn b_mut(&mut self) -> &mut u8 { LL | | @@ -112,7 +112,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:85:5 + --> tests/ui/misnamed_getters.rs:84:5 | LL | / unsafe fn a_unchecked(&self) -> &u8 { LL | | @@ -123,7 +123,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:90:5 + --> tests/ui/misnamed_getters.rs:89:5 | LL | / unsafe fn a_unchecked_mut(&mut self) -> &mut u8 { LL | | @@ -134,7 +134,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:96:5 + --> tests/ui/misnamed_getters.rs:95:5 | LL | / unsafe fn b_unchecked(self) -> u8 { LL | | @@ -145,7 +145,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:102:5 + --> tests/ui/misnamed_getters.rs:101:5 | LL | / unsafe fn b_unchecked_mut(&mut self) -> &mut u8 { LL | | @@ -156,7 +156,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:136:5 + --> tests/ui/misnamed_getters.rs:135:5 | LL | / fn a(&self) -> &u8 { LL | | @@ -167,7 +167,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:141:5 + --> tests/ui/misnamed_getters.rs:140:5 | LL | / fn a_mut(&mut self) -> &mut u8 { LL | | @@ -178,7 +178,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:147:5 + --> tests/ui/misnamed_getters.rs:146:5 | LL | / fn d(&self) -> &u8 { LL | | @@ -189,7 +189,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters.rs:152:5 + --> tests/ui/misnamed_getters.rs:151:5 | LL | / fn d_mut(&mut self) -> &mut u8 { LL | | diff --git a/tests/ui/misnamed_getters_2021.fixed b/tests/ui/misnamed_getters_2021.fixed index 7112719a9f28..a923da1962fb 100644 --- a/tests/ui/misnamed_getters_2021.fixed +++ b/tests/ui/misnamed_getters_2021.fixed @@ -1,6 +1,4 @@ //@edition: 2021 -#![allow(unused)] -#![allow(clippy::struct_field_names)] #![warn(clippy::misnamed_getters)] // Edition 2021 specific check, where `unsafe` blocks are not required diff --git a/tests/ui/misnamed_getters_2021.rs b/tests/ui/misnamed_getters_2021.rs index 19b5d086041f..bdb011939da6 100644 --- a/tests/ui/misnamed_getters_2021.rs +++ b/tests/ui/misnamed_getters_2021.rs @@ -1,6 +1,4 @@ //@edition: 2021 -#![allow(unused)] -#![allow(clippy::struct_field_names)] #![warn(clippy::misnamed_getters)] // Edition 2021 specific check, where `unsafe` blocks are not required diff --git a/tests/ui/misnamed_getters_2021.stderr b/tests/ui/misnamed_getters_2021.stderr index 5495e2e3733f..9771d2d8b119 100644 --- a/tests/ui/misnamed_getters_2021.stderr +++ b/tests/ui/misnamed_getters_2021.stderr @@ -1,5 +1,5 @@ error: getter function appears to return the wrong field - --> tests/ui/misnamed_getters_2021.rs:15:5 + --> tests/ui/misnamed_getters_2021.rs:13:5 | LL | / unsafe fn a(&self) -> &u8 { LL | | diff --git a/tests/ui/misrefactored_assign_op.1.fixed b/tests/ui/misrefactored_assign_op.1.fixed index 882ff6bf8944..c5628f2486b0 100644 --- a/tests/ui/misrefactored_assign_op.1.fixed +++ b/tests/ui/misrefactored_assign_op.1.fixed @@ -1,5 +1,6 @@ +#![warn(clippy::misrefactored_assign_op)] +#![deny(clippy::assign_op_pattern)] #![allow(clippy::eq_op)] -#![warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)] fn main() { let mut a = 5; diff --git a/tests/ui/misrefactored_assign_op.2.fixed b/tests/ui/misrefactored_assign_op.2.fixed index de3a0f1710d2..02c4383f45ab 100644 --- a/tests/ui/misrefactored_assign_op.2.fixed +++ b/tests/ui/misrefactored_assign_op.2.fixed @@ -1,5 +1,6 @@ +#![warn(clippy::misrefactored_assign_op)] +#![deny(clippy::assign_op_pattern)] #![allow(clippy::eq_op)] -#![warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)] fn main() { let mut a = 5; diff --git a/tests/ui/misrefactored_assign_op.rs b/tests/ui/misrefactored_assign_op.rs index 62d83d1619c1..dcb284574ce4 100644 --- a/tests/ui/misrefactored_assign_op.rs +++ b/tests/ui/misrefactored_assign_op.rs @@ -1,5 +1,6 @@ +#![warn(clippy::misrefactored_assign_op)] +#![deny(clippy::assign_op_pattern)] #![allow(clippy::eq_op)] -#![warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)] fn main() { let mut a = 5; diff --git a/tests/ui/misrefactored_assign_op.stderr b/tests/ui/misrefactored_assign_op.stderr index 63f3a3e28f12..50547a91dedc 100644 --- a/tests/ui/misrefactored_assign_op.stderr +++ b/tests/ui/misrefactored_assign_op.stderr @@ -1,5 +1,5 @@ error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:6:5 + --> tests/ui/misrefactored_assign_op.rs:7:5 | LL | a += a + 1; | ^^^^^^^^^^ @@ -18,7 +18,7 @@ LL + a = a + a + 1; | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:9:5 + --> tests/ui/misrefactored_assign_op.rs:10:5 | LL | a += 1 + a; | ^^^^^^^^^^ @@ -35,7 +35,7 @@ LL + a = a + 1 + a; | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:12:5 + --> tests/ui/misrefactored_assign_op.rs:13:5 | LL | a -= a - 1; | ^^^^^^^^^^ @@ -52,7 +52,7 @@ LL + a = a - (a - 1); | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:15:5 + --> tests/ui/misrefactored_assign_op.rs:16:5 | LL | a *= a * 99; | ^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL + a = a * a * 99; | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:18:5 + --> tests/ui/misrefactored_assign_op.rs:19:5 | LL | a *= 42 * a; | ^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL + a = a * 42 * a; | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:21:5 + --> tests/ui/misrefactored_assign_op.rs:22:5 | LL | a /= a / 2; | ^^^^^^^^^^ @@ -103,7 +103,7 @@ LL + a = a / (a / 2); | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:24:5 + --> tests/ui/misrefactored_assign_op.rs:25:5 | LL | a %= a % 5; | ^^^^^^^^^^ @@ -120,7 +120,7 @@ LL + a = a % (a % 5); | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:27:5 + --> tests/ui/misrefactored_assign_op.rs:28:5 | LL | a &= a & 1; | ^^^^^^^^^^ @@ -137,7 +137,7 @@ LL + a = a & a & 1; | error: variable appears on both sides of an assignment operation - --> tests/ui/misrefactored_assign_op.rs:30:5 + --> tests/ui/misrefactored_assign_op.rs:31:5 | LL | a *= a * a; | ^^^^^^^^^^ diff --git a/tests/ui/missing_asserts_for_indexing_unfixable.rs b/tests/ui/missing_asserts_for_indexing_unfixable.rs index eb98969efa47..b8cdb71bd30a 100644 --- a/tests/ui/missing_asserts_for_indexing_unfixable.rs +++ b/tests/ui/missing_asserts_for_indexing_unfixable.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::missing_asserts_for_indexing)] fn sum(v: &[u8]) -> u8 { diff --git a/tests/ui/missing_asserts_for_indexing_unfixable.stderr b/tests/ui/missing_asserts_for_indexing_unfixable.stderr index 2929646494a4..fe929aa36dba 100644 --- a/tests/ui/missing_asserts_for_indexing_unfixable.stderr +++ b/tests/ui/missing_asserts_for_indexing_unfixable.stderr @@ -1,5 +1,5 @@ error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:5:5 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:4:5 | LL | v[0] + v[1] + v[2] + v[3] + v[4] | ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ @@ -10,7 +10,7 @@ LL | v[0] + v[1] + v[2] + v[3] + v[4] = help: to override `-D warnings` add `#[allow(clippy::missing_asserts_for_indexing)]` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:10:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:9:13 | LL | let _ = v[0]; | ^^^^ @@ -21,7 +21,7 @@ LL | let _ = v[1..4]; = help: consider asserting the length before indexing: `assert!(v.len() > 3);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:17:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:16:13 | LL | let a = v[0]; | ^^^^ @@ -34,7 +34,7 @@ LL | let c = v[2]; = help: consider asserting the length before indexing: `assert!(v.len() > 2);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:26:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:25:13 | LL | let _ = v1[0] + v1[12]; | ^^^^^ ^^^^^^ @@ -42,7 +42,7 @@ LL | let _ = v1[0] + v1[12]; = help: consider asserting the length before indexing: `assert!(v1.len() > 12);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:28:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:27:13 | LL | let _ = v2[5] + v2[15]; | ^^^^^ ^^^^^^ @@ -50,7 +50,7 @@ LL | let _ = v2[5] + v2[15]; = help: consider asserting the length before indexing: `assert!(v2.len() > 15);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:35:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:34:13 | LL | let _ = v2[5] + v2[15]; | ^^^^^ ^^^^^^ @@ -58,7 +58,7 @@ LL | let _ = v2[5] + v2[15]; = help: consider asserting the length before indexing: `assert!(v2.len() > 15);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:45:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:44:13 | LL | let _ = f.v[0] + f.v[1]; | ^^^^^^ ^^^^^^ @@ -66,7 +66,7 @@ LL | let _ = f.v[0] + f.v[1]; = help: consider asserting the length before indexing: `assert!(f.v.len() > 1);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:59:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:58:13 | LL | let _ = x[0] + x[1]; | ^^^^ ^^^^ @@ -74,7 +74,7 @@ LL | let _ = x[0] + x[1]; = help: consider asserting the length before indexing: `assert!(x.len() > 1);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:77:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:76:13 | LL | let _ = v1[1] + v1[2]; | ^^^^^ ^^^^^ @@ -82,7 +82,7 @@ LL | let _ = v1[1] + v1[2]; = help: consider asserting the length before indexing: `assert!(v1.len() > 2);` error: indexing into a slice multiple times without an `assert` - --> tests/ui/missing_asserts_for_indexing_unfixable.rs:85:13 + --> tests/ui/missing_asserts_for_indexing_unfixable.rs:84:13 | LL | let _ = v1[0] + v1[1] + v1[2]; | ^^^^^ ^^^^^ ^^^^^ diff --git a/tests/ui/missing_const_for_fn/could_be_const.fixed b/tests/ui/missing_const_for_fn/could_be_const.fixed index 46a7f79ac16c..bc2d5b9d1c7b 100644 --- a/tests/ui/missing_const_for_fn/could_be_const.fixed +++ b/tests/ui/missing_const_for_fn/could_be_const.fixed @@ -1,5 +1,5 @@ #![warn(clippy::missing_const_for_fn)] -#![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)] +#![expect(clippy::let_and_return)] #![feature(const_trait_impl)] use std::mem::transmute; diff --git a/tests/ui/missing_const_for_fn/could_be_const.rs b/tests/ui/missing_const_for_fn/could_be_const.rs index 78e1939a8597..26baebfc535e 100644 --- a/tests/ui/missing_const_for_fn/could_be_const.rs +++ b/tests/ui/missing_const_for_fn/could_be_const.rs @@ -1,5 +1,5 @@ #![warn(clippy::missing_const_for_fn)] -#![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)] +#![expect(clippy::let_and_return)] #![feature(const_trait_impl)] use std::mem::transmute; diff --git a/tests/ui/missing_fields_in_debug.rs b/tests/ui/missing_fields_in_debug.rs index 14803b5485a1..e52630408f03 100644 --- a/tests/ui/missing_fields_in_debug.rs +++ b/tests/ui/missing_fields_in_debug.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::missing_fields_in_debug)] use std::fmt; diff --git a/tests/ui/missing_fields_in_debug.stderr b/tests/ui/missing_fields_in_debug.stderr index 75b551e1f5c7..4ea837e47836 100644 --- a/tests/ui/missing_fields_in_debug.stderr +++ b/tests/ui/missing_fields_in_debug.stderr @@ -1,5 +1,5 @@ error: manual `Debug` impl does not include all fields - --> tests/ui/missing_fields_in_debug.rs:14:1 + --> tests/ui/missing_fields_in_debug.rs:13:1 | LL | / impl fmt::Debug for NamedStruct1Ignored { ... | @@ -7,7 +7,7 @@ LL | | } | |_^ | note: this field is unused - --> tests/ui/missing_fields_in_debug.rs:11:5 + --> tests/ui/missing_fields_in_debug.rs:10:5 | LL | hidden: u32, | ^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | hidden: u32, = help: to override `-D warnings` add `#[allow(clippy::missing_fields_in_debug)]` error: manual `Debug` impl does not include all fields - --> tests/ui/missing_fields_in_debug.rs:34:1 + --> tests/ui/missing_fields_in_debug.rs:33:1 | LL | / impl fmt::Debug for NamedStructMultipleIgnored { ... | @@ -25,17 +25,17 @@ LL | | } | |_^ | note: this field is unused - --> tests/ui/missing_fields_in_debug.rs:28:5 + --> tests/ui/missing_fields_in_debug.rs:27:5 | LL | hidden: u32, | ^^^^^^^^^^^ note: this field is unused - --> tests/ui/missing_fields_in_debug.rs:29:5 + --> tests/ui/missing_fields_in_debug.rs:28:5 | LL | hidden2: String, | ^^^^^^^^^^^^^^^ note: this field is unused - --> tests/ui/missing_fields_in_debug.rs:31:5 + --> tests/ui/missing_fields_in_debug.rs:30:5 | LL | hidden4: ((((u8), u16), u32), u64), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | hidden4: ((((u8), u16), u32), u64), = help: consider calling `.finish_non_exhaustive()` if you intend to ignore fields error: manual `Debug` impl does not include all fields - --> tests/ui/missing_fields_in_debug.rs:97:1 + --> tests/ui/missing_fields_in_debug.rs:96:1 | LL | / impl fmt::Debug for MultiExprDebugImpl { LL | | @@ -54,7 +54,7 @@ LL | | } | |_^ | note: this field is unused - --> tests/ui/missing_fields_in_debug.rs:93:5 + --> tests/ui/missing_fields_in_debug.rs:92:5 | LL | b: String, | ^^^^^^^^^ diff --git a/tests/ui/missing_inline.rs b/tests/ui/missing_inline.rs index 8e937d609512..0adaeaa9cab8 100644 --- a/tests/ui/missing_inline.rs +++ b/tests/ui/missing_inline.rs @@ -2,7 +2,7 @@ #![crate_type = "dylib"] // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![allow(dead_code, non_snake_case)] +#![expect(non_snake_case)] type Typedef = String; pub type PubTypedef = String; diff --git a/tests/ui/missing_panics_doc.rs b/tests/ui/missing_panics_doc.rs index d016e099e303..63e84ffaab63 100644 --- a/tests/ui/missing_panics_doc.rs +++ b/tests/ui/missing_panics_doc.rs @@ -1,6 +1,6 @@ //@aux-build:macro_rules.rs #![warn(clippy::missing_panics_doc)] -#![allow(clippy::option_map_unit_fn, clippy::unnecessary_literal_unwrap)] +#![expect(clippy::option_map_unit_fn, clippy::unnecessary_literal_unwrap)] #[macro_use] extern crate macro_rules; diff --git a/tests/ui/missing_spin_loop.fixed b/tests/ui/missing_spin_loop.fixed index 03fbf8ccc8a3..7876a0c47d5e 100644 --- a/tests/ui/missing_spin_loop.fixed +++ b/tests/ui/missing_spin_loop.fixed @@ -1,6 +1,5 @@ #![warn(clippy::missing_spin_loop)] -#![allow(clippy::bool_comparison)] -#![allow(unused_braces)] +#![expect(clippy::bool_comparison)] use core::sync::atomic::{AtomicBool, Ordering}; diff --git a/tests/ui/missing_spin_loop.rs b/tests/ui/missing_spin_loop.rs index bf18590b9408..06bfe8eeaab8 100644 --- a/tests/ui/missing_spin_loop.rs +++ b/tests/ui/missing_spin_loop.rs @@ -1,6 +1,5 @@ #![warn(clippy::missing_spin_loop)] -#![allow(clippy::bool_comparison)] -#![allow(unused_braces)] +#![expect(clippy::bool_comparison)] use core::sync::atomic::{AtomicBool, Ordering}; diff --git a/tests/ui/missing_spin_loop.stderr b/tests/ui/missing_spin_loop.stderr index 98c32d042346..d4a93bb2d75b 100644 --- a/tests/ui/missing_spin_loop.stderr +++ b/tests/ui/missing_spin_loop.stderr @@ -1,5 +1,5 @@ error: busy-waiting loop should at least have a spin loop hint - --> tests/ui/missing_spin_loop.rs:10:37 + --> tests/ui/missing_spin_loop.rs:9:37 | LL | while b.load(Ordering::Acquire) {} | ^^ help: try: `{ std::hint::spin_loop() }` @@ -8,31 +8,31 @@ LL | while b.load(Ordering::Acquire) {} = help: to override `-D warnings` add `#[allow(clippy::missing_spin_loop)]` error: busy-waiting loop should at least have a spin loop hint - --> tests/ui/missing_spin_loop.rs:13:37 + --> tests/ui/missing_spin_loop.rs:12:37 | LL | while !b.load(Ordering::SeqCst) {} | ^^ help: try: `{ std::hint::spin_loop() }` error: busy-waiting loop should at least have a spin loop hint - --> tests/ui/missing_spin_loop.rs:16:46 + --> tests/ui/missing_spin_loop.rs:15:46 | LL | while b.load(Ordering::Acquire) == false {} | ^^ help: try: `{ std::hint::spin_loop() }` error: busy-waiting loop should at least have a spin loop hint - --> tests/ui/missing_spin_loop.rs:19:49 + --> tests/ui/missing_spin_loop.rs:18:49 | LL | while { true == b.load(Ordering::Acquire) } {} | ^^ help: try: `{ std::hint::spin_loop() }` error: busy-waiting loop should at least have a spin loop hint - --> tests/ui/missing_spin_loop.rs:22:93 + --> tests/ui/missing_spin_loop.rs:21:93 | LL | while b.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed) != Ok(true) {} | ^^ help: try: `{ std::hint::spin_loop() }` error: busy-waiting loop should at least have a spin loop hint - --> tests/ui/missing_spin_loop.rs:25:94 + --> tests/ui/missing_spin_loop.rs:24:94 | LL | while Ok(false) != b.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) {} | ^^ help: try: `{ std::hint::spin_loop() }` diff --git a/tests/ui/missing_trait_methods.rs b/tests/ui/missing_trait_methods.rs index 67070a299951..90349a0de101 100644 --- a/tests/ui/missing_trait_methods.rs +++ b/tests/ui/missing_trait_methods.rs @@ -1,5 +1,5 @@ -#![allow(unused, clippy::needless_lifetimes)] #![warn(clippy::missing_trait_methods)] +#![expect(clippy::needless_lifetimes)] trait A { fn provided() {} diff --git a/tests/ui/missing_transmute_annotations.fixed b/tests/ui/missing_transmute_annotations.fixed index 58faeaee09d4..2602a2fda513 100644 --- a/tests/ui/missing_transmute_annotations.fixed +++ b/tests/ui/missing_transmute_annotations.fixed @@ -1,7 +1,7 @@ //@aux-build:macro_rules.rs #![warn(clippy::missing_transmute_annotations)] -#![allow(clippy::let_with_type_underscore)] +#![expect(clippy::let_with_type_underscore)] #[macro_use] extern crate macro_rules; diff --git a/tests/ui/missing_transmute_annotations.rs b/tests/ui/missing_transmute_annotations.rs index c9a4c5fa83b2..fe7b7238d33f 100644 --- a/tests/ui/missing_transmute_annotations.rs +++ b/tests/ui/missing_transmute_annotations.rs @@ -1,7 +1,7 @@ //@aux-build:macro_rules.rs #![warn(clippy::missing_transmute_annotations)] -#![allow(clippy::let_with_type_underscore)] +#![expect(clippy::let_with_type_underscore)] #[macro_use] extern crate macro_rules; diff --git a/tests/ui/mistyped_literal_suffix.fixed b/tests/ui/mistyped_literal_suffix.fixed index a0190acc5d4b..3a7d714375a7 100644 --- a/tests/ui/mistyped_literal_suffix.fixed +++ b/tests/ui/mistyped_literal_suffix.fixed @@ -1,10 +1,8 @@ //@aux-build: proc_macros.rs -#![allow( - dead_code, - unused_variables, +#![warn(clippy::mistyped_literal_suffixes)] +#![expect( overflowing_literals, - clippy::excessive_precision, clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings )] diff --git a/tests/ui/mistyped_literal_suffix.rs b/tests/ui/mistyped_literal_suffix.rs index 12a26204e755..02e76a468d21 100644 --- a/tests/ui/mistyped_literal_suffix.rs +++ b/tests/ui/mistyped_literal_suffix.rs @@ -1,10 +1,8 @@ //@aux-build: proc_macros.rs -#![allow( - dead_code, - unused_variables, +#![warn(clippy::mistyped_literal_suffixes)] +#![expect( overflowing_literals, - clippy::excessive_precision, clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings )] diff --git a/tests/ui/mistyped_literal_suffix.stderr b/tests/ui/mistyped_literal_suffix.stderr index 9c6b2fab21c3..a986bc0e69ec 100644 --- a/tests/ui/mistyped_literal_suffix.stderr +++ b/tests/ui/mistyped_literal_suffix.stderr @@ -1,97 +1,98 @@ error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:16:18 + --> tests/ui/mistyped_literal_suffix.rs:14:18 | LL | let fail14 = 2_32; | ^^^^ help: did you mean to write: `2_i32` | - = note: `#[deny(clippy::mistyped_literal_suffixes)]` on by default + = note: `-D clippy::mistyped-literal-suffixes` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::mistyped_literal_suffixes)]` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:18:18 + --> tests/ui/mistyped_literal_suffix.rs:16:18 | LL | let fail15 = 4_64; | ^^^^ help: did you mean to write: `4_i64` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:20:18 + --> tests/ui/mistyped_literal_suffix.rs:18:18 | LL | let fail16 = 7_8; // | ^^^ help: did you mean to write: `7_i8` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:23:18 + --> tests/ui/mistyped_literal_suffix.rs:21:18 | LL | let fail17 = 23_16; // | ^^^^^ help: did you mean to write: `23_i16` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:28:18 + --> tests/ui/mistyped_literal_suffix.rs:26:18 | LL | let fail20 = 2__8; // | ^^^^ help: did you mean to write: `2_i8` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:31:18 + --> tests/ui/mistyped_literal_suffix.rs:29:18 | LL | let fail21 = 4___16; // | ^^^^^^ help: did you mean to write: `4_i16` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:36:18 + --> tests/ui/mistyped_literal_suffix.rs:34:18 | LL | let fail25 = 1E2_32; | ^^^^^^ help: did you mean to write: `1E2_f32` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:38:18 + --> tests/ui/mistyped_literal_suffix.rs:36:18 | LL | let fail26 = 43E7_64; | ^^^^^^^ help: did you mean to write: `43E7_f64` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:40:18 + --> tests/ui/mistyped_literal_suffix.rs:38:18 | LL | let fail27 = 243E17_32; | ^^^^^^^^^ help: did you mean to write: `243E17_f32` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:42:18 + --> tests/ui/mistyped_literal_suffix.rs:40:18 | LL | let fail28 = 241251235E723_64; | ^^^^^^^^^^^^^^^^ help: did you mean to write: `241_251_235E723_f64` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:47:18 + --> tests/ui/mistyped_literal_suffix.rs:45:18 | LL | let fail30 = 127_8; // should be i8 | ^^^^^ help: did you mean to write: `127_i8` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:50:18 + --> tests/ui/mistyped_literal_suffix.rs:48:18 | LL | let fail31 = 240_8; // should be u8 | ^^^^^ help: did you mean to write: `240_u8` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:54:18 + --> tests/ui/mistyped_literal_suffix.rs:52:18 | LL | let fail33 = 0x1234_16; | ^^^^^^^^^ help: did you mean to write: `0x1234_i16` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:56:18 + --> tests/ui/mistyped_literal_suffix.rs:54:18 | LL | let fail34 = 0xABCD_16; | ^^^^^^^^^ help: did you mean to write: `0xABCD_u16` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:59:18 + --> tests/ui/mistyped_literal_suffix.rs:57:18 | LL | let fail36 = 0xFFFF_FFFF_FFFF_FFFF_64; // u64 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean to write: `0xFFFF_FFFF_FFFF_FFFF_u64` error: mistyped literal suffix - --> tests/ui/mistyped_literal_suffix.rs:67:13 + --> tests/ui/mistyped_literal_suffix.rs:65:13 | LL | let _ = 1.12345E1_32; | ^^^^^^^^^^^^ help: did you mean to write: `1.123_45E1_f32` diff --git a/tests/ui/module_name_repetitions.rs b/tests/ui/module_name_repetitions.rs index 5d16858bf85e..8fdce71d0552 100644 --- a/tests/ui/module_name_repetitions.rs +++ b/tests/ui/module_name_repetitions.rs @@ -1,7 +1,6 @@ //@compile-flags: --test #![warn(clippy::module_name_repetitions)] -#![allow(dead_code)] pub mod foo { pub fn foo() {} diff --git a/tests/ui/module_name_repetitions.stderr b/tests/ui/module_name_repetitions.stderr index 9000c44a3902..e4c3daacdbea 100644 --- a/tests/ui/module_name_repetitions.stderr +++ b/tests/ui/module_name_repetitions.stderr @@ -1,5 +1,5 @@ error: item name starts with its containing module's name - --> tests/ui/module_name_repetitions.rs:8:12 + --> tests/ui/module_name_repetitions.rs:7:12 | LL | pub fn foo_bar() {} | ^^^^^^^ @@ -8,31 +8,31 @@ LL | pub fn foo_bar() {} = help: to override `-D warnings` add `#[allow(clippy::module_name_repetitions)]` error: item name ends with its containing module's name - --> tests/ui/module_name_repetitions.rs:11:12 + --> tests/ui/module_name_repetitions.rs:10:12 | LL | pub fn bar_foo() {} | ^^^^^^^ error: item name starts with its containing module's name - --> tests/ui/module_name_repetitions.rs:14:16 + --> tests/ui/module_name_repetitions.rs:13:16 | LL | pub struct FooCake; | ^^^^^^^ error: item name ends with its containing module's name - --> tests/ui/module_name_repetitions.rs:17:14 + --> tests/ui/module_name_repetitions.rs:16:14 | LL | pub enum CakeFoo {} | ^^^^^^^ error: item name starts with its containing module's name - --> tests/ui/module_name_repetitions.rs:20:16 + --> tests/ui/module_name_repetitions.rs:19:16 | LL | pub struct Foo7Bar; | ^^^^^^^ error: item name starts with its containing module's name - --> tests/ui/module_name_repetitions.rs:33:20 + --> tests/ui/module_name_repetitions.rs:32:20 | LL | pub use error::FooError; | ^^^^^^^^ diff --git a/tests/ui/modulo_arithmetic_float.rs b/tests/ui/modulo_arithmetic_float.rs index 0e08174f686e..46d554616f8d 100644 --- a/tests/ui/modulo_arithmetic_float.rs +++ b/tests/ui/modulo_arithmetic_float.rs @@ -1,7 +1,7 @@ #![feature(f128)] #![feature(f16)] #![warn(clippy::modulo_arithmetic)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one)] +#![expect(clippy::no_effect)] fn main() { // Lint when both sides are const and of the opposite sign diff --git a/tests/ui/modulo_arithmetic_integral.rs b/tests/ui/modulo_arithmetic_integral.rs index d7cd910e43cb..583637dbc285 100644 --- a/tests/ui/modulo_arithmetic_integral.rs +++ b/tests/ui/modulo_arithmetic_integral.rs @@ -1,5 +1,5 @@ #![warn(clippy::modulo_arithmetic)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one)] +#![expect(clippy::no_effect)] fn main() { // Lint on signed integral numbers diff --git a/tests/ui/modulo_arithmetic_integral_const.rs b/tests/ui/modulo_arithmetic_integral_const.rs index 9f5fb697df0e..160bc8662924 100644 --- a/tests/ui/modulo_arithmetic_integral_const.rs +++ b/tests/ui/modulo_arithmetic_integral_const.rs @@ -1,10 +1,5 @@ #![warn(clippy::modulo_arithmetic)] -#![allow( - clippy::no_effect, - clippy::unnecessary_operation, - clippy::modulo_one, - clippy::identity_op -)] +#![expect(clippy::identity_op, clippy::modulo_one, clippy::no_effect)] fn main() { // Lint when both sides are const and of the opposite sign diff --git a/tests/ui/modulo_arithmetic_integral_const.stderr b/tests/ui/modulo_arithmetic_integral_const.stderr index 12edee8cf425..e09673213f79 100644 --- a/tests/ui/modulo_arithmetic_integral_const.stderr +++ b/tests/ui/modulo_arithmetic_integral_const.stderr @@ -1,5 +1,5 @@ error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:11:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:6:5 | LL | -1 % 2; | ^^^^^^ @@ -10,7 +10,7 @@ LL | -1 % 2; = help: to override `-D warnings` add `#[allow(clippy::modulo_arithmetic)]` error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:14:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:9:5 | LL | 1 % -2; | ^^^^^^ @@ -19,7 +19,7 @@ LL | 1 % -2; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 3` - --> tests/ui/modulo_arithmetic_integral_const.rs:17:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:12:5 | LL | (1 - 2) % (1 + 2); | ^^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | (1 - 2) % (1 + 2); = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `3 % -1` - --> tests/ui/modulo_arithmetic_integral_const.rs:20:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:15:5 | LL | (1 + 2) % (1 - 2); | ^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | (1 + 2) % (1 - 2); = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-35 % 300000` - --> tests/ui/modulo_arithmetic_integral_const.rs:23:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:18:5 | LL | 35 * (7 - 4 * 2) % (-500 * -600); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -46,7 +46,7 @@ LL | 35 * (7 - 4 * 2) % (-500 * -600); = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:26:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:21:5 | LL | -1i8 % 2i8; | ^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | -1i8 % 2i8; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:29:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:24:5 | LL | 1i8 % -2i8; | ^^^^^^^^^^ @@ -64,7 +64,7 @@ LL | 1i8 % -2i8; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:32:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:27:5 | LL | -1i16 % 2i16; | ^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | -1i16 % 2i16; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:35:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:30:5 | LL | 1i16 % -2i16; | ^^^^^^^^^^^^ @@ -82,7 +82,7 @@ LL | 1i16 % -2i16; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:38:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:33:5 | LL | -1i32 % 2i32; | ^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL | -1i32 % 2i32; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:41:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:36:5 | LL | 1i32 % -2i32; | ^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | 1i32 % -2i32; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:44:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:39:5 | LL | -1i64 % 2i64; | ^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | -1i64 % 2i64; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:47:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:42:5 | LL | 1i64 % -2i64; | ^^^^^^^^^^^^ @@ -118,7 +118,7 @@ LL | 1i64 % -2i64; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:50:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:45:5 | LL | -1i128 % 2i128; | ^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | -1i128 % 2i128; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:53:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:48:5 | LL | 1i128 % -2i128; | ^^^^^^^^^^^^^^ @@ -136,7 +136,7 @@ LL | 1i128 % -2i128; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `-1 % 2` - --> tests/ui/modulo_arithmetic_integral_const.rs:56:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:51:5 | LL | -1isize % 2isize; | ^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | -1isize % 2isize; = note: or consider using `rem_euclid` or similar function error: you are using modulo operator on constants with different signs: `1 % -2` - --> tests/ui/modulo_arithmetic_integral_const.rs:59:5 + --> tests/ui/modulo_arithmetic_integral_const.rs:54:5 | LL | 1isize % -2isize; | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/modulo_one.rs b/tests/ui/modulo_one.rs index 63ae61059cb8..730c37d0e368 100644 --- a/tests/ui/modulo_one.rs +++ b/tests/ui/modulo_one.rs @@ -1,6 +1,5 @@ #![warn(clippy::modulo_one)] -#![allow(unconditional_panic)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::identity_op)] +#![expect(clippy::identity_op, clippy::no_effect)] static STATIC_ONE: usize = 2 - 1; static STATIC_NEG_ONE: i64 = 1 - 2; diff --git a/tests/ui/modulo_one.stderr b/tests/ui/modulo_one.stderr index 1c9c79d1c621..f841ac18bbc3 100644 --- a/tests/ui/modulo_one.stderr +++ b/tests/ui/modulo_one.stderr @@ -1,5 +1,5 @@ error: any number modulo 1 will be 0 - --> tests/ui/modulo_one.rs:9:5 + --> tests/ui/modulo_one.rs:8:5 | LL | 10 % 1; | ^^^^^^ @@ -8,31 +8,31 @@ LL | 10 % 1; = help: to override `-D warnings` add `#[allow(clippy::modulo_one)]` error: any number modulo -1 will panic/overflow or result in 0 - --> tests/ui/modulo_one.rs:12:5 + --> tests/ui/modulo_one.rs:11:5 | LL | 10 % -1; | ^^^^^^^ error: any number modulo -1 will panic/overflow or result in 0 - --> tests/ui/modulo_one.rs:17:5 + --> tests/ui/modulo_one.rs:16:5 | LL | i32::MIN % (-1); | ^^^^^^^^^^^^^^^ error: any number modulo 1 will be 0 - --> tests/ui/modulo_one.rs:24:5 + --> tests/ui/modulo_one.rs:23:5 | LL | 2 % ONE; | ^^^^^^^ error: any number modulo -1 will panic/overflow or result in 0 - --> tests/ui/modulo_one.rs:29:5 + --> tests/ui/modulo_one.rs:28:5 | LL | 2 % NEG_ONE; | ^^^^^^^^^^^ error: any number modulo -1 will panic/overflow or result in 0 - --> tests/ui/modulo_one.rs:35:5 + --> tests/ui/modulo_one.rs:34:5 | LL | INT_MIN % NEG_ONE; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/msrv_attributes_without_early_lints.rs b/tests/ui/msrv_attributes_without_early_lints.rs index dcef1a485fce..fe83023aaeb7 100644 --- a/tests/ui/msrv_attributes_without_early_lints.rs +++ b/tests/ui/msrv_attributes_without_early_lints.rs @@ -1,6 +1,5 @@ //@check-pass -#![allow(clippy::all, clippy::pedantic, clippy::restriction, clippy::nursery)] #![forbid(clippy::ptr_as_ptr)] /// MSRV checking in late passes skips checking the parent nodes if no early pass sees a diff --git a/tests/ui/multiple_unsafe_ops_per_block.rs b/tests/ui/multiple_unsafe_ops_per_block.rs index 0ff881472cbb..5d51c47eeed9 100644 --- a/tests/ui/multiple_unsafe_ops_per_block.rs +++ b/tests/ui/multiple_unsafe_ops_per_block.rs @@ -1,11 +1,11 @@ //@needs-asm-support //@aux-build:proc_macros.rs +#![warn(clippy::multiple_unsafe_ops_per_block)] #![expect( dropping_copy_types, - clippy::unnecessary_operation, - clippy::unnecessary_literal_unwrap + clippy::unnecessary_literal_unwrap, + clippy::unnecessary_operation )] -#![warn(clippy::multiple_unsafe_ops_per_block)] extern crate proc_macros; use proc_macros::external; diff --git a/tests/ui/must_use_candidates.fixed b/tests/ui/must_use_candidates.fixed index 17569884658b..226fafccddce 100644 --- a/tests/ui/must_use_candidates.fixed +++ b/tests/ui/must_use_candidates.fixed @@ -1,10 +1,4 @@ #![feature(never_type)] -#![allow( - unused_mut, - clippy::redundant_allocation, - clippy::needless_pass_by_ref_mut, - static_mut_refs -)] #![warn(clippy::must_use_candidate)] use std::rc::Rc; use std::sync::Arc; diff --git a/tests/ui/must_use_candidates.rs b/tests/ui/must_use_candidates.rs index 8b898533d01b..f9b6c2986504 100644 --- a/tests/ui/must_use_candidates.rs +++ b/tests/ui/must_use_candidates.rs @@ -1,10 +1,4 @@ #![feature(never_type)] -#![allow( - unused_mut, - clippy::redundant_allocation, - clippy::needless_pass_by_ref_mut, - static_mut_refs -)] #![warn(clippy::must_use_candidate)] use std::rc::Rc; use std::sync::Arc; diff --git a/tests/ui/must_use_candidates.stderr b/tests/ui/must_use_candidates.stderr index 38c733432250..24fda87cd16a 100644 --- a/tests/ui/must_use_candidates.stderr +++ b/tests/ui/must_use_candidates.stderr @@ -1,5 +1,5 @@ error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:16:8 + --> tests/ui/must_use_candidates.rs:10:8 | LL | pub fn pure(i: u8) -> u8 { | ^^^^ @@ -13,7 +13,7 @@ LL | pub fn pure(i: u8) -> u8 { | error: this method could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:22:12 + --> tests/ui/must_use_candidates.rs:16:12 | LL | pub fn inherent_pure(&self) -> u8 { | ^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL ~ pub fn inherent_pure(&self) -> u8 { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:54:8 + --> tests/ui/must_use_candidates.rs:48:8 | LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool { | ^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:67:8 + --> tests/ui/must_use_candidates.rs:61:8 | LL | pub fn rcd(_x: Rc) -> bool { | ^^^ @@ -49,7 +49,7 @@ LL | pub fn rcd(_x: Rc) -> bool { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:76:8 + --> tests/ui/must_use_candidates.rs:70:8 | LL | pub fn arcd(_x: Arc) -> bool { | ^^^^ @@ -61,7 +61,7 @@ LL | pub fn arcd(_x: Arc) -> bool { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:108:8 + --> tests/ui/must_use_candidates.rs:102:8 | LL | pub fn result_uninhabited() -> Result { | ^^^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | pub fn result_uninhabited() -> Result { | error: this function could have a `#[must_use]` attribute - --> tests/ui/must_use_candidates.rs:113:8 + --> tests/ui/must_use_candidates.rs:107:8 | LL | pub fn controlflow_uninhabited() -> std::ops::ControlFlow { | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/must_use_unit.fixed b/tests/ui/must_use_unit.fixed index b9871991b16f..5c1993f6575a 100644 --- a/tests/ui/must_use_unit.fixed +++ b/tests/ui/must_use_unit.fixed @@ -1,7 +1,7 @@ //@aux-build:proc_macros.rs #![warn(clippy::must_use_unit)] -#![allow(clippy::unused_unit)] +#![expect(clippy::unused_unit)] extern crate proc_macros; use proc_macros::external; diff --git a/tests/ui/must_use_unit.rs b/tests/ui/must_use_unit.rs index a5865681c8a8..86b4380a477a 100644 --- a/tests/ui/must_use_unit.rs +++ b/tests/ui/must_use_unit.rs @@ -1,7 +1,7 @@ //@aux-build:proc_macros.rs #![warn(clippy::must_use_unit)] -#![allow(clippy::unused_unit)] +#![expect(clippy::unused_unit)] extern crate proc_macros; use proc_macros::external; diff --git a/tests/ui/mut_from_ref.rs b/tests/ui/mut_from_ref.rs index 1b0b351518cb..f91e2992406b 100644 --- a/tests/ui/mut_from_ref.rs +++ b/tests/ui/mut_from_ref.rs @@ -1,11 +1,10 @@ -#![allow( - unused, +#![warn(clippy::mut_from_ref)] +#![expect( + clippy::boxed_local, clippy::needless_lifetimes, clippy::needless_pass_by_ref_mut, - clippy::redundant_allocation, - clippy::boxed_local + clippy::redundant_allocation )] -#![warn(clippy::mut_from_ref)] struct Foo; diff --git a/tests/ui/mut_from_ref.stderr b/tests/ui/mut_from_ref.stderr index 097426873465..92165eb9ae73 100644 --- a/tests/ui/mut_from_ref.stderr +++ b/tests/ui/mut_from_ref.stderr @@ -1,11 +1,11 @@ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:13:39 + --> tests/ui/mut_from_ref.rs:12:39 | LL | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:13:29 + --> tests/ui/mut_from_ref.rs:12:29 | LL | fn this_wont_hurt_a_bit(&self) -> &mut Foo { | ^^^^^ @@ -13,85 +13,85 @@ LL | fn this_wont_hurt_a_bit(&self) -> &mut Foo { = help: to override `-D warnings` add `#[allow(clippy::mut_from_ref)]` error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:21:25 + --> tests/ui/mut_from_ref.rs:20:25 | LL | fn ouch(x: &Foo) -> &mut Foo; | ^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:21:16 + --> tests/ui/mut_from_ref.rs:20:16 | LL | fn ouch(x: &Foo) -> &mut Foo; | ^^^^ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:31:21 + --> tests/ui/mut_from_ref.rs:30:21 | LL | fn fail(x: &u32) -> &mut u16 { | ^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:31:12 + --> tests/ui/mut_from_ref.rs:30:12 | LL | fn fail(x: &u32) -> &mut u16 { | ^^^^ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:37:50 + --> tests/ui/mut_from_ref.rs:36:50 | LL | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:37:25 + --> tests/ui/mut_from_ref.rs:36:25 | LL | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 { | ^^^^^^^ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:43:67 + --> tests/ui/mut_from_ref.rs:42:67 | LL | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:43:27 + --> tests/ui/mut_from_ref.rs:42:27 | LL | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 { | ^^^^^^^ ^^^^^^^ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:49:46 + --> tests/ui/mut_from_ref.rs:48:46 | LL | fn fail_tuples<'a>(x: (&'a u32, &'a u32)) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:49:24 + --> tests/ui/mut_from_ref.rs:48:24 | LL | fn fail_tuples<'a>(x: (&'a u32, &'a u32)) -> &'a mut u32 { | ^^^^^^^ ^^^^^^^ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:55:37 + --> tests/ui/mut_from_ref.rs:54:37 | LL | fn fail_box<'a>(x: Box<&'a u32>) -> &'a mut u32 { | ^^^^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:55:24 + --> tests/ui/mut_from_ref.rs:54:24 | LL | fn fail_box<'a>(x: Box<&'a u32>) -> &'a mut u32 { | ^^^^^^^ error: mutable borrow from immutable input(s) - --> tests/ui/mut_from_ref.rs:85:35 + --> tests/ui/mut_from_ref.rs:84:35 | LL | unsafe fn also_broken(x: &u32) -> &mut u32 { | ^^^^^^^^ | note: immutable borrow here - --> tests/ui/mut_from_ref.rs:85:26 + --> tests/ui/mut_from_ref.rs:84:26 | LL | unsafe fn also_broken(x: &u32) -> &mut u32 { | ^^^^ diff --git a/tests/ui/mut_mut.fixed b/tests/ui/mut_mut.fixed index f9a7f5dcb5a1..c34f605e3da6 100644 --- a/tests/ui/mut_mut.fixed +++ b/tests/ui/mut_mut.fixed @@ -1,13 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::mut_mut)] -#![allow(unused)] -#![allow( - clippy::no_effect, - clippy::uninlined_format_args, - clippy::unnecessary_operation, - clippy::needless_pass_by_ref_mut -)] extern crate proc_macros; use proc_macros::{external, inline_macros}; @@ -26,7 +19,6 @@ macro_rules! mut_ptr { }; } -#[allow(unused_mut, unused_variables)] #[inline_macros] fn main() { let mut x = &mut 1u32; diff --git a/tests/ui/mut_mut.rs b/tests/ui/mut_mut.rs index bbec48011a17..d17394dfe3f6 100644 --- a/tests/ui/mut_mut.rs +++ b/tests/ui/mut_mut.rs @@ -1,13 +1,6 @@ //@aux-build:proc_macros.rs #![warn(clippy::mut_mut)] -#![allow(unused)] -#![allow( - clippy::no_effect, - clippy::uninlined_format_args, - clippy::unnecessary_operation, - clippy::needless_pass_by_ref_mut -)] extern crate proc_macros; use proc_macros::{external, inline_macros}; @@ -26,7 +19,6 @@ macro_rules! mut_ptr { }; } -#[allow(unused_mut, unused_variables)] #[inline_macros] fn main() { let mut x = &mut &mut 1u32; diff --git a/tests/ui/mut_mut.stderr b/tests/ui/mut_mut.stderr index 85e9c5649b89..0a7a923e0f48 100644 --- a/tests/ui/mut_mut.stderr +++ b/tests/ui/mut_mut.stderr @@ -1,5 +1,5 @@ error: a type of form `&mut &mut _` - --> tests/ui/mut_mut.rs:15:11 + --> tests/ui/mut_mut.rs:8:11 | LL | fn fun(x: &mut &mut u32) { | ^^^^^^^^^^^^^ help: remove the extra `&mut`: `&mut u32` @@ -8,37 +8,37 @@ LL | fn fun(x: &mut &mut u32) { = help: to override `-D warnings` add `#[allow(clippy::mut_mut)]` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut.rs:32:17 + --> tests/ui/mut_mut.rs:24:17 | LL | let mut x = &mut &mut 1u32; | ^^^^^^^^^^^^^^ help: remove the extra `&mut`: `&mut 1u32` error: this expression mutably borrows a mutable reference - --> tests/ui/mut_mut.rs:35:21 + --> tests/ui/mut_mut.rs:27:21 | LL | let mut y = &mut x; | ^^^^^^ help: reborrow instead: `&mut *x` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut.rs:40:32 + --> tests/ui/mut_mut.rs:32:32 | LL | let y: &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^ help: remove the extra `&mut`: `&mut 2` error: a type of form `&mut &mut _` - --> tests/ui/mut_mut.rs:40:16 + --> tests/ui/mut_mut.rs:32:16 | LL | let y: &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ help: remove the extra `&mut`: `&mut u32` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut.rs:46:37 + --> tests/ui/mut_mut.rs:38:37 | LL | let y: &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^ help: remove the extra `&mut`s: `&mut 2` error: a type of form `&mut &mut _` - --> tests/ui/mut_mut.rs:46:16 + --> tests/ui/mut_mut.rs:38:16 | LL | let y: &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^^^ help: remove the extra `&mut`s: `&mut u32` diff --git a/tests/ui/mut_mut_unfixable.rs b/tests/ui/mut_mut_unfixable.rs index 271cb7b96889..0c6444fd9fa3 100644 --- a/tests/ui/mut_mut_unfixable.rs +++ b/tests/ui/mut_mut_unfixable.rs @@ -1,7 +1,6 @@ //@no-rustfix #![warn(clippy::mut_mut)] -#![allow(unused)] #![expect(clippy::no_effect)] //! removing the extra `&mut`s will break the derefs diff --git a/tests/ui/mut_mut_unfixable.stderr b/tests/ui/mut_mut_unfixable.stderr index cf66eb2ed1ec..7e7fb801ce1e 100644 --- a/tests/ui/mut_mut_unfixable.stderr +++ b/tests/ui/mut_mut_unfixable.stderr @@ -1,5 +1,5 @@ error: a type of form `&mut &mut _` - --> tests/ui/mut_mut_unfixable.rs:9:11 + --> tests/ui/mut_mut_unfixable.rs:8:11 | LL | fn fun(x: &mut &mut u32) -> bool { | ^^^^^^^^^^^^^ help: remove the extra `&mut`: `&mut u32` @@ -8,31 +8,31 @@ LL | fn fun(x: &mut &mut u32) -> bool { = help: to override `-D warnings` add `#[allow(clippy::mut_mut)]` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut_unfixable.rs:15:17 + --> tests/ui/mut_mut_unfixable.rs:14:17 | LL | let mut x = &mut &mut 1u32; | ^^^^^^^^^^^^^^ help: remove the extra `&mut`: `&mut 1u32` error: this expression mutably borrows a mutable reference - --> tests/ui/mut_mut_unfixable.rs:18:21 + --> tests/ui/mut_mut_unfixable.rs:17:21 | LL | let mut y = &mut x; | ^^^^^^ help: reborrow instead: `&mut *x` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut_unfixable.rs:24:17 + --> tests/ui/mut_mut_unfixable.rs:23:17 | LL | let y = &mut &mut 2; | ^^^^^^^^^^^ help: remove the extra `&mut`: `&mut 2` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut_unfixable.rs:30:17 + --> tests/ui/mut_mut_unfixable.rs:29:17 | LL | let y = &mut &mut &mut 2; | ^^^^^^^^^^^^^^^^ help: remove the extra `&mut`s: `&mut 2` error: an expression of form `&mut &mut _` - --> tests/ui/mut_mut_unfixable.rs:39:17 + --> tests/ui/mut_mut_unfixable.rs:38:17 | LL | let y = &mut &mut x; | ^^^^^^^^^^^ help: remove the extra `&mut`: `&mut x` diff --git a/tests/ui/mut_mutex_lock.fixed b/tests/ui/mut_mutex_lock.fixed index 5790ee8c1b02..44587b89ec83 100644 --- a/tests/ui/mut_mutex_lock.fixed +++ b/tests/ui/mut_mutex_lock.fixed @@ -1,4 +1,3 @@ -#![allow(dead_code, unused_mut)] #![warn(clippy::mut_mutex_lock)] use std::sync::{Arc, Mutex}; diff --git a/tests/ui/mut_mutex_lock.rs b/tests/ui/mut_mutex_lock.rs index 7286afac823b..eef4f26c0959 100644 --- a/tests/ui/mut_mutex_lock.rs +++ b/tests/ui/mut_mutex_lock.rs @@ -1,4 +1,3 @@ -#![allow(dead_code, unused_mut)] #![warn(clippy::mut_mutex_lock)] use std::sync::{Arc, Mutex}; diff --git a/tests/ui/mut_mutex_lock.stderr b/tests/ui/mut_mutex_lock.stderr index 67543c73c6ee..587405449523 100644 --- a/tests/ui/mut_mutex_lock.stderr +++ b/tests/ui/mut_mutex_lock.stderr @@ -1,5 +1,5 @@ error: calling `&mut Mutex::lock` unnecessarily locks an exclusive (mutable) reference - --> tests/ui/mut_mutex_lock.rs:10:33 + --> tests/ui/mut_mutex_lock.rs:9:33 | LL | let mut value = value_mutex.lock().unwrap(); | ^^^^ help: change this to: `get_mut` @@ -8,7 +8,7 @@ LL | let mut value = value_mutex.lock().unwrap(); = help: to override `-D warnings` add `#[allow(clippy::mut_mutex_lock)]` error: calling `&mut Mutex::lock` unnecessarily locks an exclusive (mutable) reference - --> tests/ui/mut_mutex_lock.rs:16:43 + --> tests/ui/mut_mutex_lock.rs:15:43 | LL | let mut value = mut_ref_mut_ref_mutex.lock().unwrap(); | ^^^^ help: change this to: `get_mut` diff --git a/tests/ui/mut_range_bound.rs b/tests/ui/mut_range_bound.rs index 107a6229b86d..4e1192a86c2c 100644 --- a/tests/ui/mut_range_bound.rs +++ b/tests/ui/mut_range_bound.rs @@ -1,4 +1,4 @@ -#![allow(unused)] +#![warn(clippy::mut_range_bound)] fn main() {} diff --git a/tests/ui/mutex_atomic.fixed b/tests/ui/mutex_atomic.fixed index dc05d8a2c61f..711aba8da37b 100644 --- a/tests/ui/mutex_atomic.fixed +++ b/tests/ui/mutex_atomic.fixed @@ -1,6 +1,5 @@ -#![warn(clippy::mutex_integer)] -#![warn(clippy::mutex_atomic)] -#![allow(clippy::borrow_as_ptr)] +#![warn(clippy::mutex_atomic, clippy::mutex_integer)] +#![expect(clippy::borrow_as_ptr)] use std::sync::Mutex; diff --git a/tests/ui/mutex_atomic.rs b/tests/ui/mutex_atomic.rs index 33745f8fc5e1..f0ca75458d10 100644 --- a/tests/ui/mutex_atomic.rs +++ b/tests/ui/mutex_atomic.rs @@ -1,6 +1,5 @@ -#![warn(clippy::mutex_integer)] -#![warn(clippy::mutex_atomic)] -#![allow(clippy::borrow_as_ptr)] +#![warn(clippy::mutex_atomic, clippy::mutex_integer)] +#![expect(clippy::borrow_as_ptr)] use std::sync::Mutex; diff --git a/tests/ui/mutex_atomic.stderr b/tests/ui/mutex_atomic.stderr index c1391e0111c8..85c1829f4412 100644 --- a/tests/ui/mutex_atomic.stderr +++ b/tests/ui/mutex_atomic.stderr @@ -1,5 +1,5 @@ error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:8:13 + --> tests/ui/mutex_atomic.rs:7:13 | LL | let _ = Mutex::new(true); | ^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL + let _ = std::sync::atomic::AtomicBool::new(true); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:11:13 + --> tests/ui/mutex_atomic.rs:10:13 | LL | let _ = Mutex::new(5usize); | ^^^^^^^^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL + let _ = std::sync::atomic::AtomicUsize::new(5usize); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:14:13 + --> tests/ui/mutex_atomic.rs:13:13 | LL | let _ = Mutex::new(9isize); | ^^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL + let _ = std::sync::atomic::AtomicIsize::new(9isize); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:21:13 + --> tests/ui/mutex_atomic.rs:20:13 | LL | let _ = Mutex::new(&mut x as *mut u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL + let _ = std::sync::atomic::AtomicPtr::new(&mut x as *mut u32); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:24:13 + --> tests/ui/mutex_atomic.rs:23:13 | LL | let _ = Mutex::new(0u32); | ^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL + let _ = std::sync::atomic::AtomicU32::new(0u32); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:27:13 + --> tests/ui/mutex_atomic.rs:26:13 | LL | let _ = Mutex::new(0i32); | ^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL + let _ = std::sync::atomic::AtomicI32::new(0i32); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:31:13 + --> tests/ui/mutex_atomic.rs:30:13 | LL | let _ = Mutex::new(0u8); | ^^^^^^^^^^^^^^^ @@ -94,7 +94,7 @@ LL + let _ = std::sync::atomic::AtomicU8::new(0u8); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:34:13 + --> tests/ui/mutex_atomic.rs:33:13 | LL | let _ = Mutex::new(0i16); | ^^^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL + let _ = std::sync::atomic::AtomicI16::new(0i16); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:37:25 + --> tests/ui/mutex_atomic.rs:36:25 | LL | let _x: Mutex = Mutex::new(0); | ^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ LL + let _x = std::sync::atomic::AtomicI8::new(0); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:41:13 + --> tests/ui/mutex_atomic.rs:40:13 | LL | let _ = Mutex::new(X); | ^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + let _ = std::sync::atomic::AtomicI64::new(X); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:53:30 + --> tests/ui/mutex_atomic.rs:52:30 | LL | static MTX: Mutex = Mutex::new(0); | ^^^^^^^^^^^^^ @@ -146,7 +146,7 @@ LL + static MTX: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32 | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:56:15 + --> tests/ui/mutex_atomic.rs:55:15 | LL | let mtx = Mutex::new(0); | ^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ LL + let mtx = std::sync::atomic::AtomicI32::new(0); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:60:22 + --> tests/ui/mutex_atomic.rs:59:22 | LL | let reassigned = mtx; | ^^^ @@ -168,7 +168,7 @@ LL | let reassigned = mtx; = help: if you just want the locking behavior and not the internal type, consider using `Mutex<()>` error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:65:35 + --> tests/ui/mutex_atomic.rs:64:35 | LL | let (funky_mtx): Mutex = Mutex::new(0); | ^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL + let (funky_mtx) = std::sync::atomic::AtomicU64::new(0); | error: using a `Mutex` where an atomic would do - --> tests/ui/mutex_atomic.rs:76:13 + --> tests/ui/mutex_atomic.rs:75:13 | LL | let _ = Mutex::new(test_expr!(1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/needless_arbitrary_self_type.fixed b/tests/ui/needless_arbitrary_self_type.fixed index adb9096c9f24..0eef094895dd 100644 --- a/tests/ui/needless_arbitrary_self_type.fixed +++ b/tests/ui/needless_arbitrary_self_type.fixed @@ -1,5 +1,5 @@ #![warn(clippy::needless_arbitrary_self_type)] -#![allow(unused_mut, clippy::needless_lifetimes)] +#![expect(clippy::needless_lifetimes)] pub enum ValType { A, diff --git a/tests/ui/needless_arbitrary_self_type.rs b/tests/ui/needless_arbitrary_self_type.rs index 550546ed24fd..0ea16ce89946 100644 --- a/tests/ui/needless_arbitrary_self_type.rs +++ b/tests/ui/needless_arbitrary_self_type.rs @@ -1,5 +1,5 @@ #![warn(clippy::needless_arbitrary_self_type)] -#![allow(unused_mut, clippy::needless_lifetimes)] +#![expect(clippy::needless_lifetimes)] pub enum ValType { A, diff --git a/tests/ui/needless_bitwise_bool.fixed b/tests/ui/needless_bitwise_bool.fixed index eedeecd8a8cb..a5c34939a5c9 100644 --- a/tests/ui/needless_bitwise_bool.fixed +++ b/tests/ui/needless_bitwise_bool.fixed @@ -1,5 +1,5 @@ #![warn(clippy::needless_bitwise_bool)] -#![allow(clippy::const_is_empty)] +#![expect(clippy::const_is_empty)] fn returns_bool() -> bool { true diff --git a/tests/ui/needless_bitwise_bool.rs b/tests/ui/needless_bitwise_bool.rs index 5c0a4ccf266c..ca03d888f365 100644 --- a/tests/ui/needless_bitwise_bool.rs +++ b/tests/ui/needless_bitwise_bool.rs @@ -1,5 +1,5 @@ #![warn(clippy::needless_bitwise_bool)] -#![allow(clippy::const_is_empty)] +#![expect(clippy::const_is_empty)] fn returns_bool() -> bool { true diff --git a/tests/ui/needless_bool/fixable.fixed b/tests/ui/needless_bool/fixable.fixed index 0af4f87bec67..c3eed4e3fd71 100644 --- a/tests/ui/needless_bool/fixable.fixed +++ b/tests/ui/needless_bool/fixable.fixed @@ -1,15 +1,6 @@ #![warn(clippy::needless_bool)] -#![allow( - unused, - dead_code, - clippy::no_effect, - clippy::if_same_then_else, - clippy::equatable_if_let, - clippy::needless_ifs, - clippy::needless_return, - clippy::self_named_constructors, - clippy::struct_field_names -)] +#![allow(clippy::no_effect)] +#![expect(clippy::needless_return)] use std::cell::Cell; @@ -21,7 +12,6 @@ macro_rules! bool_comparison_trigger { $($i: (Cell, bool, bool)),+ } - #[allow(dead_code)] impl Trigger { pub fn trigger(&self, key: &str) -> bool { $( diff --git a/tests/ui/needless_bool/fixable.rs b/tests/ui/needless_bool/fixable.rs index 2e8719bd041e..4571628be20e 100644 --- a/tests/ui/needless_bool/fixable.rs +++ b/tests/ui/needless_bool/fixable.rs @@ -1,15 +1,6 @@ #![warn(clippy::needless_bool)] -#![allow( - unused, - dead_code, - clippy::no_effect, - clippy::if_same_then_else, - clippy::equatable_if_let, - clippy::needless_ifs, - clippy::needless_return, - clippy::self_named_constructors, - clippy::struct_field_names -)] +#![allow(clippy::no_effect)] +#![expect(clippy::needless_return)] use std::cell::Cell; @@ -21,7 +12,6 @@ macro_rules! bool_comparison_trigger { $($i: (Cell, bool, bool)),+ } - #[allow(dead_code)] impl Trigger { pub fn trigger(&self, key: &str) -> bool { $( diff --git a/tests/ui/needless_bool/fixable.stderr b/tests/ui/needless_bool/fixable.stderr index e15260242f4d..f8cad52c2bbf 100644 --- a/tests/ui/needless_bool/fixable.stderr +++ b/tests/ui/needless_bool/fixable.stderr @@ -1,5 +1,5 @@ error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:41:5 + --> tests/ui/needless_bool/fixable.rs:31:5 | LL | / if x { LL | | true @@ -12,7 +12,7 @@ LL | | }; = help: to override `-D warnings` add `#[allow(clippy::needless_bool)]` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:47:5 + --> tests/ui/needless_bool/fixable.rs:37:5 | LL | / if x { LL | | false @@ -22,7 +22,7 @@ LL | | }; | |_____^ help: you can reduce it to: `!x` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:53:5 + --> tests/ui/needless_bool/fixable.rs:43:5 | LL | / if x && y { LL | | false @@ -32,7 +32,7 @@ LL | | }; | |_____^ help: you can reduce it to: `!(x && y)` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:62:5 + --> tests/ui/needless_bool/fixable.rs:52:5 | LL | / if a == b { LL | | false @@ -42,7 +42,7 @@ LL | | }; | |_____^ help: you can reduce it to: `a != b` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:68:5 + --> tests/ui/needless_bool/fixable.rs:58:5 | LL | / if a != b { LL | | false @@ -52,7 +52,7 @@ LL | | }; | |_____^ help: you can reduce it to: `a == b` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:74:5 + --> tests/ui/needless_bool/fixable.rs:64:5 | LL | / if a < b { LL | | false @@ -62,7 +62,7 @@ LL | | }; | |_____^ help: you can reduce it to: `a >= b` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:80:5 + --> tests/ui/needless_bool/fixable.rs:70:5 | LL | / if a <= b { LL | | false @@ -72,7 +72,7 @@ LL | | }; | |_____^ help: you can reduce it to: `a > b` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:86:5 + --> tests/ui/needless_bool/fixable.rs:76:5 | LL | / if a > b { LL | | false @@ -82,7 +82,7 @@ LL | | }; | |_____^ help: you can reduce it to: `a <= b` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:92:5 + --> tests/ui/needless_bool/fixable.rs:82:5 | LL | / if a >= b { LL | | false @@ -92,7 +92,7 @@ LL | | }; | |_____^ help: you can reduce it to: `a < b` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:121:5 + --> tests/ui/needless_bool/fixable.rs:111:5 | LL | / if x { LL | | return true; @@ -102,7 +102,7 @@ LL | | }; | |_____^ help: you can reduce it to: `return x` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:130:5 + --> tests/ui/needless_bool/fixable.rs:120:5 | LL | / if x { LL | | return false; @@ -112,7 +112,7 @@ LL | | }; | |_____^ help: you can reduce it to: `return !x` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:139:5 + --> tests/ui/needless_bool/fixable.rs:129:5 | LL | / if x && y { LL | | return true; @@ -122,7 +122,7 @@ LL | | }; | |_____^ help: you can reduce it to: `return x && y` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:148:5 + --> tests/ui/needless_bool/fixable.rs:138:5 | LL | / if x && y { LL | | return false; @@ -132,7 +132,7 @@ LL | | }; | |_____^ help: you can reduce it to: `return !(x && y)` error: equality checks against true are unnecessary - --> tests/ui/needless_bool/fixable.rs:157:8 + --> tests/ui/needless_bool/fixable.rs:147:8 | LL | if x == true {}; | ^^^^^^^^^ help: try: `x` @@ -141,25 +141,25 @@ LL | if x == true {}; = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` error: equality checks against false can be replaced by a negation - --> tests/ui/needless_bool/fixable.rs:162:8 + --> tests/ui/needless_bool/fixable.rs:152:8 | LL | if x == false {}; | ^^^^^^^^^^ help: try: `!x` error: equality checks against true are unnecessary - --> tests/ui/needless_bool/fixable.rs:173:8 + --> tests/ui/needless_bool/fixable.rs:163:8 | LL | if x == true {}; | ^^^^^^^^^ help: try: `x` error: equality checks against false can be replaced by a negation - --> tests/ui/needless_bool/fixable.rs:175:8 + --> tests/ui/needless_bool/fixable.rs:165:8 | LL | if x == false {}; | ^^^^^^^^^^ help: try: `!x` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:185:12 + --> tests/ui/needless_bool/fixable.rs:175:12 | LL | } else if returns_bool() { | ____________^ @@ -170,7 +170,7 @@ LL | | }; | |_____^ help: you can reduce it to: `{ !returns_bool() }` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:199:5 + --> tests/ui/needless_bool/fixable.rs:189:5 | LL | / if unsafe { no(4) } & 1 != 0 { LL | | true @@ -180,37 +180,37 @@ LL | | }; | |_____^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:205:30 + --> tests/ui/needless_bool/fixable.rs:195:30 | LL | let _brackets_unneeded = if unsafe { no(4) } & 1 != 0 { true } else { false }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `unsafe { no(4) } & 1 != 0` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:209:9 + --> tests/ui/needless_bool/fixable.rs:199:9 | LL | if unsafe { no(4) } & 1 != 0 { true } else { false } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:221:14 + --> tests/ui/needless_bool/fixable.rs:211:14 | LL | let _x = if a && b { true } else { false }.then(|| todo!()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(a && b)` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:223:14 + --> tests/ui/needless_bool/fixable.rs:213:14 | LL | let _x = if a && b { true } else { false } as u8; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(a && b)` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:227:14 + --> tests/ui/needless_bool/fixable.rs:217:14 | LL | let _x = if a { true } else { false }.then(|| todo!()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `a` error: this if-then-else expression returns a bool literal - --> tests/ui/needless_bool/fixable.rs:239:5 + --> tests/ui/needless_bool/fixable.rs:229:5 | LL | / if test_expr!(x) { LL | | true diff --git a/tests/ui/needless_bool/simple.rs b/tests/ui/needless_bool/simple.rs index 40ffeae6c56f..c5d2ef51fade 100644 --- a/tests/ui/needless_bool/simple.rs +++ b/tests/ui/needless_bool/simple.rs @@ -1,12 +1,5 @@ #![warn(clippy::needless_bool)] -#![allow( - unused, - dead_code, - clippy::no_effect, - clippy::if_same_then_else, - clippy::needless_return, - clippy::branches_sharing_code -)] +#![expect(clippy::if_same_then_else, clippy::needless_return)] fn main() { let x = true; diff --git a/tests/ui/needless_bool/simple.stderr b/tests/ui/needless_bool/simple.stderr index 077e9b5df47c..07711b9234cd 100644 --- a/tests/ui/needless_bool/simple.stderr +++ b/tests/ui/needless_bool/simple.stderr @@ -1,5 +1,5 @@ error: this if-then-else expression will always return true - --> tests/ui/needless_bool/simple.rs:14:5 + --> tests/ui/needless_bool/simple.rs:7:5 | LL | / if x { LL | | true @@ -12,7 +12,7 @@ LL | | }; = help: to override `-D warnings` add `#[allow(clippy::needless_bool)]` error: this if-then-else expression will always return false - --> tests/ui/needless_bool/simple.rs:20:5 + --> tests/ui/needless_bool/simple.rs:13:5 | LL | / if x { LL | | false @@ -22,7 +22,7 @@ LL | | }; | |_____^ error: this if-then-else expression will always return true - --> tests/ui/needless_bool/simple.rs:36:5 + --> tests/ui/needless_bool/simple.rs:29:5 | LL | / if x { LL | | return true; @@ -32,7 +32,7 @@ LL | | }; | |_____^ error: this if-then-else expression will always return false - --> tests/ui/needless_bool/simple.rs:45:5 + --> tests/ui/needless_bool/simple.rs:38:5 | LL | / if x { LL | | return false; diff --git a/tests/ui/needless_bool_assign.fixed b/tests/ui/needless_bool_assign.fixed index 8fd572038140..3bd592b471e4 100644 --- a/tests/ui/needless_bool_assign.fixed +++ b/tests/ui/needless_bool_assign.fixed @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::needless_bool_assign)] fn random() -> bool { diff --git a/tests/ui/needless_bool_assign.rs b/tests/ui/needless_bool_assign.rs index 4721ab433b32..1279176cb20a 100644 --- a/tests/ui/needless_bool_assign.rs +++ b/tests/ui/needless_bool_assign.rs @@ -1,4 +1,3 @@ -#![allow(unused)] #![warn(clippy::needless_bool_assign)] fn random() -> bool { diff --git a/tests/ui/needless_bool_assign.stderr b/tests/ui/needless_bool_assign.stderr index 34ff782f34a3..3dfea7cd1af9 100644 --- a/tests/ui/needless_bool_assign.stderr +++ b/tests/ui/needless_bool_assign.stderr @@ -1,5 +1,5 @@ error: this if-then-else expression assigns a bool literal - --> tests/ui/needless_bool_assign.rs:13:5 + --> tests/ui/needless_bool_assign.rs:12:5 | LL | / if random() && random() { LL | | a.field = true; @@ -12,7 +12,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::needless_bool_assign)]` error: this if-then-else expression assigns a bool literal - --> tests/ui/needless_bool_assign.rs:19:5 + --> tests/ui/needless_bool_assign.rs:18:5 | LL | / if random() && random() { LL | | a.field = false; @@ -22,7 +22,7 @@ LL | | } | |_____^ help: you can reduce it to: `a.field = !(random() && random());` error: this if-then-else expression assigns a bool literal - --> tests/ui/needless_bool_assign.rs:34:5 + --> tests/ui/needless_bool_assign.rs:33:5 | LL | / if random() { LL | | a.field = true; @@ -32,7 +32,7 @@ LL | | } | |_____^ help: you can reduce it to: `random(); a.field = true;` error: this `if` has identical blocks - --> tests/ui/needless_bool_assign.rs:34:17 + --> tests/ui/needless_bool_assign.rs:33:17 | LL | if random() { | _________________^ @@ -41,7 +41,7 @@ LL | | } else { | |_____^ | note: same as this - --> tests/ui/needless_bool_assign.rs:36:12 + --> tests/ui/needless_bool_assign.rs:35:12 | LL | } else { | ____________^ @@ -52,7 +52,7 @@ LL | | } = help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]` error: this if-then-else expression assigns a bool literal - --> tests/ui/needless_bool_assign.rs:54:12 + --> tests/ui/needless_bool_assign.rs:53:12 | LL | } else if x || y { | ____________^ @@ -63,7 +63,7 @@ LL | | } | |_____^ help: you can reduce it to: `{ z = x || y; }` error: this if-then-else expression assigns a bool literal - --> tests/ui/needless_bool_assign.rs:77:5 + --> tests/ui/needless_bool_assign.rs:76:5 | LL | / if invoke!(must_keep, x, y) { LL | | dot_0!(skip) = false; From 4ef709939c0e49bf8b4996c871af160da80c7261 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 27 May 2026 12:08:51 +0200 Subject: [PATCH 10/11] Cleanup attributes in Clippy source files This is needed to implement the new test which checks top-level inner attributes ordering and structure. --- clippy_config/src/lib.rs | 4 ++-- clippy_dev/src/lib.rs | 4 ++-- clippy_lints/src/doc/mod.rs | 2 -- clippy_lints/src/lib.rs | 8 ++------ clippy_lints/src/operators/const_comparisons.rs | 2 +- clippy_lints/src/suspicious_operation_groupings.rs | 2 +- clippy_lints/src/unnested_or_patterns.rs | 2 +- clippy_lints_internal/src/lib.rs | 9 +++------ clippy_utils/src/ast_utils/mod.rs | 2 +- clippy_utils/src/lib.rs | 4 ++-- clippy_utils/src/macros.rs | 2 +- clippy_utils/src/source.rs | 2 +- clippy_utils/src/sym.rs | 2 +- clippy_utils/src/ty/mod.rs | 2 +- lintcheck/src/main.rs | 10 ++++------ src/driver.rs | 5 ++--- 16 files changed, 25 insertions(+), 37 deletions(-) diff --git a/clippy_config/src/lib.rs b/clippy_config/src/lib.rs index 0a891e75eb3e..3dac01ae19d5 100644 --- a/clippy_config/src/lib.rs +++ b/clippy_config/src/lib.rs @@ -1,12 +1,12 @@ #![feature(rustc_private)] #![warn( + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - rust_2018_idioms, unused_lifetimes, unused_qualifications )] -#![allow(clippy::must_use_candidate, clippy::missing_panics_doc)] +#![expect(clippy::must_use_candidate)] extern crate rustc_data_structures; extern crate rustc_errors; diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs index 433d4e8cdcf1..70783118efed 100644 --- a/clippy_dev/src/lib.rs +++ b/clippy_dev/src/lib.rs @@ -7,13 +7,13 @@ rustc_private )] #![warn( + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - rust_2018_idioms, unused_lifetimes, unused_qualifications )] -#![allow(clippy::missing_panics_doc)] +#![expect(clippy::missing_panics_doc)] extern crate rustc_arena; extern crate rustc_data_structures; diff --git a/clippy_lints/src/doc/mod.rs b/clippy_lints/src/doc/mod.rs index 81da571bdd60..c474a532248d 100644 --- a/clippy_lints/src/doc/mod.rs +++ b/clippy_lints/src/doc/mod.rs @@ -1,5 +1,3 @@ -#![allow(clippy::lint_without_lint_pass)] - use clippy_config::Conf; use clippy_utils::attrs::is_doc_hidden; use clippy_utils::diagnostics::{span_lint, span_lint_and_help, span_lint_and_then}; diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 7b190c255888..3fbe80135abe 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -11,15 +11,11 @@ #![feature(stmt_expr_attributes)] #![feature(unwrap_infallible)] #![recursion_limit = "512"] -#![allow( - clippy::missing_docs_in_private_items, - clippy::must_use_candidate, - clippy::literal_string_with_formatting_args -)] +#![expect(clippy::literal_string_with_formatting_args, clippy::must_use_candidate)] #![warn( + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - rust_2018_idioms, unused_lifetimes, unused_qualifications, rustc::internal diff --git a/clippy_lints/src/operators/const_comparisons.rs b/clippy_lints/src/operators/const_comparisons.rs index 85128f9114e6..3a03258dcf17 100644 --- a/clippy_lints/src/operators/const_comparisons.rs +++ b/clippy_lints/src/operators/const_comparisons.rs @@ -1,4 +1,4 @@ -#![allow(clippy::match_same_arms)] +#![expect(clippy::match_same_arms)] use std::cmp::Ordering; diff --git a/clippy_lints/src/suspicious_operation_groupings.rs b/clippy_lints/src/suspicious_operation_groupings.rs index ac2d3741338a..f778c527e2b2 100644 --- a/clippy_lints/src/suspicious_operation_groupings.rs +++ b/clippy_lints/src/suspicious_operation_groupings.rs @@ -522,7 +522,7 @@ fn ident_difference_expr_with_base_location( // then we should be able to change this function to do the correct traversal, // without needing to change the rest of the code. - #![allow(clippy::enum_glob_use)] + #[allow(clippy::enum_glob_use)] use ExprKind::*; match ( diff --git a/clippy_lints/src/unnested_or_patterns.rs b/clippy_lints/src/unnested_or_patterns.rs index d1096a02fd63..e0f07270fdb6 100644 --- a/clippy_lints/src/unnested_or_patterns.rs +++ b/clippy_lints/src/unnested_or_patterns.rs @@ -1,4 +1,4 @@ -#![allow(clippy::wildcard_imports, clippy::enum_glob_use)] +#![allow(clippy::enum_glob_use, clippy::wildcard_imports)] use clippy_config::Conf; use clippy_utils::ast_utils::{eq_field_pat, eq_id, eq_maybe_qself, eq_pat, eq_path}; diff --git a/clippy_lints_internal/src/lib.rs b/clippy_lints_internal/src/lib.rs index 8e2166858fec..ac3f3035559c 100644 --- a/clippy_lints_internal/src/lib.rs +++ b/clippy_lints_internal/src/lib.rs @@ -1,21 +1,18 @@ #![feature(rustc_private)] -#![allow( - clippy::missing_docs_in_private_items, - clippy::must_use_candidate, +#![expect( + clippy::missing_clippy_version_attribute, // None of these lints need a version. clippy::symbol_as_str )] #![warn( + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - rust_2018_idioms, unused_lifetimes, unused_qualifications, rustc::internal )] // Disable this rustc lint for now, as it was also done in rustc #![allow(rustc::potential_query_instability)] -// None of these lints need a version. -#![allow(clippy::missing_clippy_version_attribute)] extern crate rustc_ast; extern crate rustc_attr_parsing; diff --git a/clippy_utils/src/ast_utils/mod.rs b/clippy_utils/src/ast_utils/mod.rs index e0a182523f67..f9e5e10ec252 100644 --- a/clippy_utils/src/ast_utils/mod.rs +++ b/clippy_utils/src/ast_utils/mod.rs @@ -2,7 +2,7 @@ //! //! - The `eq_foobar` functions test for semantic equality but ignores `NodeId`s and `Span`s. -#![allow(clippy::wildcard_imports, clippy::enum_glob_use)] +#![allow(clippy::enum_glob_use, clippy::wildcard_imports)] use crate::{both, over}; use rustc_ast::{self as ast, HasAttrs, *}; diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index fc80378c18aa..befb190c57b5 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -3,11 +3,11 @@ #![feature(rustc_private)] #![feature(unwrap_infallible)] #![recursion_limit = "512"] -#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate)] +#![expect(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate)] #![warn( + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - rust_2018_idioms, unused_lifetimes, unused_qualifications, rustc::internal diff --git a/clippy_utils/src/macros.rs b/clippy_utils/src/macros.rs index 76f9b50ca9f4..1d19b94323ea 100644 --- a/clippy_utils/src/macros.rs +++ b/clippy_utils/src/macros.rs @@ -1,4 +1,4 @@ -#![allow(clippy::similar_names)] // `expr` and `expn` +#![expect(clippy::similar_names)] // `expr` and `expn` use std::cell::Cell; use std::sync::{Arc, OnceLock}; diff --git a/clippy_utils/src/source.rs b/clippy_utils/src/source.rs index 02d502f8b67f..c634cc066516 100644 --- a/clippy_utils/src/source.rs +++ b/clippy_utils/src/source.rs @@ -1,6 +1,6 @@ //! Utils for extracting, inspecting or transforming source code -#![allow(clippy::module_name_repetitions)] +#![expect(clippy::module_name_repetitions)] use std::sync::Arc; diff --git a/clippy_utils/src/sym.rs b/clippy_utils/src/sym.rs index be2ed9b07f0e..5d6191f8a955 100644 --- a/clippy_utils/src/sym.rs +++ b/clippy_utils/src/sym.rs @@ -1,4 +1,4 @@ -#![allow(non_upper_case_globals)] +#![expect(non_upper_case_globals)] use rustc_span::symbol::PREDEFINED_SYMBOLS_COUNT; diff --git a/clippy_utils/src/ty/mod.rs b/clippy_utils/src/ty/mod.rs index 056eb818c1ac..d127bb23173c 100644 --- a/clippy_utils/src/ty/mod.rs +++ b/clippy_utils/src/ty/mod.rs @@ -1,6 +1,6 @@ //! Util methods for [`rustc_middle::ty`] -#![allow(clippy::module_name_repetitions)] +#![expect(clippy::module_name_repetitions)] use core::ops::ControlFlow; use rustc_abi::VariantIdx; diff --git a/lintcheck/src/main.rs b/lintcheck/src/main.rs index 6a9e6cab8957..55eda5b4c33a 100644 --- a/lintcheck/src/main.rs +++ b/lintcheck/src/main.rs @@ -7,17 +7,15 @@ #![feature(iter_collect_into)] #![warn( + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - rust_2018_idioms, unused_lifetimes, unused_qualifications )] -#![allow( - clippy::collapsible_else_if, - clippy::needless_borrows_for_generic_args, - clippy::module_name_repetitions, - clippy::literal_string_with_formatting_args +#![expect( + clippy::literal_string_with_formatting_args, + clippy::needless_borrows_for_generic_args )] mod config; diff --git a/src/driver.rs b/src/driver.rs index b73ddc3ae12c..13e8cb967732 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -1,8 +1,7 @@ #![feature(rustc_private)] // warn on lints, that are included in `rust-lang/rust`s bootstrap -#![warn(rust_2018_idioms, unused_lifetimes)] -// warn on rustc internal lints -#![warn(rustc::internal)] +// and on rustc internal lints +#![warn(rust_2018_idioms, unused_lifetimes, rustc::internal)] // FIXME: switch to something more ergonomic here, once available. // (Currently there is no way to opt into sysroot crates without `extern crate`.) From 28dccdf8cddc9312f209d15a0129063f404b1922 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 27 May 2026 12:08:51 +0200 Subject: [PATCH 11/11] New Clippy source test: lint-attributes-organization --- tests/lint-attributes-organization.rs | 129 ++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 tests/lint-attributes-organization.rs diff --git a/tests/lint-attributes-organization.rs b/tests/lint-attributes-organization.rs new file mode 100644 index 000000000000..b6b5006acbc0 --- /dev/null +++ b/tests/lint-attributes-organization.rs @@ -0,0 +1,129 @@ +//! This test checks that Clippy files (source and tests): +//! +//! - only have one top-level lint attribute of each kind (`allow`/`deny`/`expect`/`forbid`/`warn`) +//! - put unqualified lint names before the qualified ones +//! - use alphabetical order inside each qualification +//! +//! This test is disabled when ran as part of the compiler test suite, to prevent +//! changes from being difficult to make there. Incorrect organizations will be +//! fixed during the merge process. +//! +//! This test may eventually be replaced by a restriction lint which imposes +//! constraints on attributes. Right now, this regex-based one does the job +//! on Clippy test files. It only checks top-level beginning-of-the-line attributes, +//! so that it won't trigger on a `#![cfg_attr(…, warn(…))]` which can legitimately be +//! used in addition to another `#![warn(…)]` attribute. + +use regex::Regex; +use std::collections::HashSet; +use std::fs; +use test_utils::IS_RUSTC_TEST_SUITE; +use walkdir::{DirEntry, WalkDir}; + +mod test_utils; + +const SKIPPED_FILES: [&str; 7] = [ + "./tests/lint-attributes-organization.rs", // this file, for the sanity checks + "./tests/ui/blanket_clippy_restriction_lints.rs", // separate lines are better + "./tests/ui/deprecated.rs", // generated + "./tests/ui/duplicated_attributes.rs", // obviously + "./tests/ui/rename.rs", // generated + "./tests/ui/unknown_clippy_lints.rs", // separate lines are better + "./target/", // generated files +]; + +#[test] +fn lint_attribute_organization() { + if IS_RUSTC_TEST_SUITE { + return; + } + let attribute_regex = attribute_regex(); + let mut problem_found = false; + for path in WalkDir::new(".") + .into_iter() + .flatten() + .map(DirEntry::into_path) + .filter(|p| { + p.extension().is_some_and(|ext| ext == "rs") && !SKIPPED_FILES.iter().any(|&skipped| p.starts_with(skipped)) + }) + { + for diag in error_for_content(&fs::read_to_string(&path).unwrap(), &attribute_regex) { + eprintln!("ERROR: {}: {diag}", path.to_str().unwrap()); + problem_found = true; + } + } + assert!( + !problem_found, + "some lint attributes do not meet the attributes organization requirements" + ); +} + +fn attribute_regex() -> Regex { + Regex::new(r"(?ms)^#!\[(allow|deny|expect|forbid|warn)\((.+?)\)\]").unwrap() +} + +// Check if file content contains only ordered lint names in top-level inner attributes, and +// also that every attribute is present only once. +fn error_for_content(content: &str, attribute_regex: &Regex) -> Vec { + let mut diags = vec![]; + let mut attributes = HashSet::new(); + for cap in attribute_regex.captures_iter(content) { + let attribute = &cap[1]; + if !attributes.insert(attribute.to_owned()) { + diags.push(format!("duplicate top-level `#![{attribute}]` attribute")); + } + let lint_names = cap[2] + .lines() + .map(|l| l.split_once("//").map_or(l, |(b, _)| b).trim()) + .flat_map(|l| l.split_whitespace().map(|s| s.strip_suffix(',').unwrap_or(s))) + .collect::>(); + for (&a, &b) in lint_names.iter().zip(lint_names.iter().skip(1)) { + if a.contains("::") && !b.contains("::") { + diags.push(format!( + "qualified lint names (`{a}`) must come after unqualified ones (`{b}`)" + )); + } else if !a.contains("::") && b.contains("::") { + } else if a > b { + diags.push(format!("lint names must be ordered: `{b}` must come before `{a}`")); + } + } + } + diags +} + +#[test] +fn internal_sanity_check() { + let attribute_regex = attribute_regex(); + check_errors( + " +#![allow( + clippy::def, // Comment + clippy::abc +)] +#![allow(clippy::zyx, unknown)]", + vec![ + "lint names must be ordered: `clippy::abc` must come before `clippy::def`", + "duplicate top-level `#![allow]` attribute", + "qualified lint names (`clippy::zyx`) must come after unqualified ones (`unknown`)", + ], + &attribute_regex, + ); + check_errors( + "#![warn(before, after)]", + vec!["lint names must be ordered: `after` must come before `before`"], + &attribute_regex, + ); + check_errors( + "#![deny(clippy::abc, clippy::def, clippy::zyx)]", + vec![], + &attribute_regex, + ); +} + +fn check_errors(content: &str, expected: Vec<&str>, attribute_regex: &Regex) { + let errors = error_for_content(content, attribute_regex); + assert_eq!(errors.len(), expected.len()); + for (error, expected) in errors.into_iter().zip(expected) { + assert_eq!(&error, expected); + } +}