Move to complexity and adapt test
- test wildcard_enum_match_arm has been impacted by this new lint
This commit is contained in:
parent
649af71f9e
commit
d60c6f9398
@ -1002,7 +1002,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
|
||||
LintId::of(&integer_division::INTEGER_DIVISION),
|
||||
LintId::of(&let_underscore::LET_UNDERSCORE_MUST_USE),
|
||||
LintId::of(&literal_representation::DECIMAL_LITERAL_REPRESENTATION),
|
||||
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
|
||||
LintId::of(&matches::WILDCARD_ENUM_MATCH_ARM),
|
||||
LintId::of(&mem_forget::MEM_FORGET),
|
||||
LintId::of(&methods::CLONE_ON_REF_PTR),
|
||||
@ -1189,6 +1188,7 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
|
||||
LintId::of(&matches::MATCH_OVERLAPPING_ARM),
|
||||
LintId::of(&matches::MATCH_REF_PATS),
|
||||
LintId::of(&matches::MATCH_WILD_ERR_ARM),
|
||||
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
|
||||
LintId::of(&matches::SINGLE_MATCH),
|
||||
LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
|
||||
LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
|
||||
@ -1463,6 +1463,7 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
|
||||
LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
|
||||
LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
|
||||
LintId::of(&matches::MATCH_AS_REF),
|
||||
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
|
||||
LintId::of(&methods::CHARS_NEXT_CMP),
|
||||
LintId::of(&methods::CLONE_ON_COPY),
|
||||
LintId::of(&methods::FILTER_NEXT),
|
||||
|
@ -1570,7 +1570,7 @@ pub const ALL_LINTS: [Lint; 345] = [
|
||||
},
|
||||
Lint {
|
||||
name: "pats_with_wild_match_arm",
|
||||
group: "restriction",
|
||||
group: "complexity",
|
||||
desc: "a wildcard pattern used with others patterns in same match arm",
|
||||
deprecation: None,
|
||||
module: "matches",
|
||||
|
@ -1,7 +1,13 @@
|
||||
// run-rustfix
|
||||
|
||||
#![deny(clippy::wildcard_enum_match_arm)]
|
||||
#![allow(unreachable_code, unused_variables, dead_code, clippy::single_match)]
|
||||
#![allow(
|
||||
unreachable_code,
|
||||
unused_variables,
|
||||
dead_code,
|
||||
clippy::single_match,
|
||||
clippy::pats_with_wild_match_arm
|
||||
)]
|
||||
|
||||
use std::io::ErrorKind;
|
||||
|
||||
|
@ -1,7 +1,13 @@
|
||||
// run-rustfix
|
||||
|
||||
#![deny(clippy::wildcard_enum_match_arm)]
|
||||
#![allow(unreachable_code, unused_variables, dead_code, clippy::single_match)]
|
||||
#![allow(
|
||||
unreachable_code,
|
||||
unused_variables,
|
||||
dead_code,
|
||||
clippy::single_match,
|
||||
clippy::pats_with_wild_match_arm
|
||||
)]
|
||||
|
||||
use std::io::ErrorKind;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:31:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:37:9
|
||||
|
|
||||
LL | _ => eprintln!("Not red"),
|
||||
| ^ help: try this: `Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan`
|
||||
@ -11,25 +11,25 @@ LL | #![deny(clippy::wildcard_enum_match_arm)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:35:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:41:9
|
||||
|
|
||||
LL | _not_red => eprintln!("Not red"),
|
||||
| ^^^^^^^^ help: try this: `_not_red @ Color::Green | _not_red @ Color::Blue | _not_red @ Color::Rgb(..) | _not_red @ Color::Cyan`
|
||||
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:39:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:45:9
|
||||
|
|
||||
LL | not_red => format!("{:?}", not_red),
|
||||
| ^^^^^^^ help: try this: `not_red @ Color::Green | not_red @ Color::Blue | not_red @ Color::Rgb(..) | not_red @ Color::Cyan`
|
||||
|
||||
error: wildcard match will miss any future added variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:55:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:61:9
|
||||
|
|
||||
LL | _ => "No red",
|
||||
| ^ help: try this: `Color::Red | Color::Green | Color::Blue | Color::Rgb(..) | Color::Cyan`
|
||||
|
||||
error: match on non-exhaustive enum doesn't explicitly match all known variants
|
||||
--> $DIR/wildcard_enum_match_arm.rs:72:9
|
||||
--> $DIR/wildcard_enum_match_arm.rs:78:9
|
||||
|
|
||||
LL | _ => {},
|
||||
| ^ help: try this: `std::io::ErrorKind::PermissionDenied | std::io::ErrorKind::ConnectionRefused | std::io::ErrorKind::ConnectionReset | std::io::ErrorKind::ConnectionAborted | std::io::ErrorKind::NotConnected | std::io::ErrorKind::AddrInUse | std::io::ErrorKind::AddrNotAvailable | std::io::ErrorKind::BrokenPipe | std::io::ErrorKind::AlreadyExists | std::io::ErrorKind::WouldBlock | std::io::ErrorKind::InvalidInput | std::io::ErrorKind::InvalidData | std::io::ErrorKind::TimedOut | std::io::ErrorKind::WriteZero | std::io::ErrorKind::Interrupted | std::io::ErrorKind::Other | std::io::ErrorKind::UnexpectedEof | _`
|
||||
|
Loading…
x
Reference in New Issue
Block a user