Merge commit '9f9a822509' into clippy-subtree-update

This commit is contained in:
Philipp Krones 2025-02-28 23:20:48 +01:00
parent 222aaba5a1
commit fe01c44995
2648 changed files with 35461 additions and 16191 deletions

View file

@ -15,11 +15,13 @@ fn main() {
match Some(114514) {
Some(v) => v,
None {} => 0,
//~^ unneeded_struct_pattern
};
match Some(1919810) {
Some(v) => v,
None { .. } => 0,
//~^ unneeded_struct_pattern
};
match Some(123456) {
@ -30,15 +32,23 @@ fn main() {
match Some(Some(123456)) {
Some(Some(v)) => v,
Some(None {}) => 0,
//~^ unneeded_struct_pattern
None {} => 0,
//~^ unneeded_struct_pattern
};
if let None {} = Some(0) {}
//~^ unneeded_struct_pattern
if let None { .. } = Some(0) {}
//~^ unneeded_struct_pattern
if let Some(None {}) = Some(Some(0)) {}
//~^ unneeded_struct_pattern
let None {} = Some(0) else { panic!() };
//~^ unneeded_struct_pattern
let None { .. } = Some(0) else { panic!() };
//~^ unneeded_struct_pattern
let Some(None {}) = Some(Some(0)) else { panic!() };
//~^ unneeded_struct_pattern
enum Custom {
HasFields {
@ -54,26 +64,28 @@ fn main() {
match Custom::Init {
Custom::HasFields { field: value } => value,
Custom::HasBracketsNoFields {} => 0,
Custom::NoBrackets {} => 0, //~ ERROR: struct pattern is not needed for a unit variant
Custom::NoBracketsNonExhaustive {} => 0, //~ ERROR: struct pattern is not needed for a unit variant
Custom::NoBrackets {} => 0, //~ unneeded_struct_pattern
Custom::NoBracketsNonExhaustive {} => 0, //~ unneeded_struct_pattern
_ => 0,
};
match Custom::Init {
Custom::HasFields { field: value } => value,
Custom::HasBracketsNoFields { .. } => 0,
Custom::NoBrackets { .. } => 0, //~ ERROR: struct pattern is not needed for a unit variant
Custom::NoBracketsNonExhaustive { .. } => 0, //~ ERROR: struct pattern is not needed for a unit variant
Custom::NoBrackets { .. } => 0, //~ unneeded_struct_pattern
Custom::NoBracketsNonExhaustive { .. } => 0, //~ unneeded_struct_pattern
_ => 0,
};
match Custom::Init {
Custom::NoBrackets {} if true => 0, //~ ERROR: struct pattern is not needed for a unit variant
Custom::NoBrackets {} if true => 0, //~ unneeded_struct_pattern
_ => 0,
};
match Custom::Init {
Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} => 0, //~ ERROR: struct pattern is not needed for a unit variant
Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} => 0,
//~^ unneeded_struct_pattern
//~| unneeded_struct_pattern
_ => 0,
};
@ -87,23 +99,24 @@ fn main() {
noop();
}
if let Custom::NoBrackets {} = Custom::Init {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
noop();
}
if let Custom::NoBrackets { .. } = Custom::Init {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
noop();
}
if let Custom::NoBrackets {} | Custom::NoBracketsNonExhaustive {} = Custom::Init {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
//~| unneeded_struct_pattern
noop();
}
if let Custom::NoBracketsNonExhaustive {} = Custom::Init {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
noop();
}
if let Custom::NoBracketsNonExhaustive { .. } = Custom::Init {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
noop();
}
@ -118,18 +131,18 @@ fn main() {
let Custom::HasBracketsNoFields { .. } = Custom::Init else {
panic!()
};
let Custom::NoBrackets {} = Custom::Init else { panic!() }; //~ ERROR: struct pattern is not needed for a unit variant
let Custom::NoBrackets {} = Custom::Init else { panic!() }; //~ unneeded_struct_pattern
let Custom::NoBrackets { .. } = Custom::Init else {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
panic!()
};
let Custom::NoBracketsNonExhaustive {} = Custom::Init else {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
panic!()
};
let Custom::NoBracketsNonExhaustive { .. } = Custom::Init else {
//~^ ERROR: struct pattern is not needed for a unit variant
//~^ unneeded_struct_pattern
panic!()
};
@ -137,11 +150,11 @@ fn main() {
Variant,
}
fn pat_in_fn_param_1(Refutable::Variant {}: Refutable) {} //~ ERROR: struct pattern is not needed for a unit variant
fn pat_in_fn_param_2(Refutable::Variant { .. }: Refutable) {} //~ ERROR: struct pattern is not needed for a unit variant
fn pat_in_fn_param_1(Refutable::Variant {}: Refutable) {} //~ unneeded_struct_pattern
fn pat_in_fn_param_2(Refutable::Variant { .. }: Refutable) {} //~ unneeded_struct_pattern
for Refutable::Variant {} in [] {} //~ ERROR: struct pattern is not needed for a unit variant
for Refutable::Variant { .. } in [] {} //~ ERROR: struct pattern is not needed for a unit variant
for Refutable::Variant {} in [] {} //~ unneeded_struct_pattern
for Refutable::Variant { .. } in [] {} //~ unneeded_struct_pattern
}
fn external_crate() {
@ -155,13 +168,13 @@ fn external_crate() {
match ExhaustiveUnit {
// Exhaustive variant
ExhaustiveUnit { .. } => 0, //~ ERROR: struct pattern is not needed for a unit variant
ExhaustiveUnit { .. } => 0, //~ unneeded_struct_pattern
_ => 0,
};
match ExhaustiveUnit {
// Exhaustive variant
ExhaustiveUnit {} => 0, //~ ERROR: struct pattern is not needed for a unit variant
ExhaustiveUnit {} => 0, //~ unneeded_struct_pattern
_ => 0,
};