mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
Simplify wildcard_enum_match_arm test
This commit is contained in:
parent
38569c03eb
commit
0ffba7a684
4 changed files with 3 additions and 56 deletions
|
@ -1,25 +1,8 @@
|
|||
// Stripped down version of the ErrorKind enum of std
|
||||
#[non_exhaustive]
|
||||
pub enum ErrorKind {
|
||||
NotFound,
|
||||
PermissionDenied,
|
||||
ConnectionRefused,
|
||||
ConnectionReset,
|
||||
ConnectionAborted,
|
||||
NotConnected,
|
||||
AddrInUse,
|
||||
AddrNotAvailable,
|
||||
BrokenPipe,
|
||||
AlreadyExists,
|
||||
WouldBlock,
|
||||
InvalidInput,
|
||||
InvalidData,
|
||||
TimedOut,
|
||||
WriteZero,
|
||||
Interrupted,
|
||||
Other,
|
||||
UnexpectedEof,
|
||||
Unsupported,
|
||||
OutOfMemory,
|
||||
#[doc(hidden)]
|
||||
Uncategorized,
|
||||
}
|
||||
|
|
|
@ -80,29 +80,11 @@ fn main() {
|
|||
let error_kind = ErrorKind::NotFound;
|
||||
match error_kind {
|
||||
ErrorKind::NotFound => {},
|
||||
ErrorKind::PermissionDenied | ErrorKind::ConnectionRefused | ErrorKind::ConnectionReset | ErrorKind::ConnectionAborted | ErrorKind::NotConnected | ErrorKind::AddrInUse | ErrorKind::AddrNotAvailable | ErrorKind::BrokenPipe | ErrorKind::AlreadyExists | ErrorKind::WouldBlock | ErrorKind::InvalidInput | ErrorKind::InvalidData | ErrorKind::TimedOut | ErrorKind::WriteZero | ErrorKind::Interrupted | ErrorKind::Other | ErrorKind::UnexpectedEof | ErrorKind::Unsupported | ErrorKind::OutOfMemory | _ => {},
|
||||
ErrorKind::PermissionDenied | _ => {},
|
||||
}
|
||||
match error_kind {
|
||||
ErrorKind::NotFound => {},
|
||||
ErrorKind::PermissionDenied => {},
|
||||
ErrorKind::ConnectionRefused => {},
|
||||
ErrorKind::ConnectionReset => {},
|
||||
ErrorKind::ConnectionAborted => {},
|
||||
ErrorKind::NotConnected => {},
|
||||
ErrorKind::AddrInUse => {},
|
||||
ErrorKind::AddrNotAvailable => {},
|
||||
ErrorKind::BrokenPipe => {},
|
||||
ErrorKind::AlreadyExists => {},
|
||||
ErrorKind::WouldBlock => {},
|
||||
ErrorKind::InvalidInput => {},
|
||||
ErrorKind::InvalidData => {},
|
||||
ErrorKind::TimedOut => {},
|
||||
ErrorKind::WriteZero => {},
|
||||
ErrorKind::Interrupted => {},
|
||||
ErrorKind::Other => {},
|
||||
ErrorKind::UnexpectedEof => {},
|
||||
ErrorKind::Unsupported => {},
|
||||
ErrorKind::OutOfMemory => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,24 +85,6 @@ fn main() {
|
|||
match error_kind {
|
||||
ErrorKind::NotFound => {},
|
||||
ErrorKind::PermissionDenied => {},
|
||||
ErrorKind::ConnectionRefused => {},
|
||||
ErrorKind::ConnectionReset => {},
|
||||
ErrorKind::ConnectionAborted => {},
|
||||
ErrorKind::NotConnected => {},
|
||||
ErrorKind::AddrInUse => {},
|
||||
ErrorKind::AddrNotAvailable => {},
|
||||
ErrorKind::BrokenPipe => {},
|
||||
ErrorKind::AlreadyExists => {},
|
||||
ErrorKind::WouldBlock => {},
|
||||
ErrorKind::InvalidInput => {},
|
||||
ErrorKind::InvalidData => {},
|
||||
ErrorKind::TimedOut => {},
|
||||
ErrorKind::WriteZero => {},
|
||||
ErrorKind::Interrupted => {},
|
||||
ErrorKind::Other => {},
|
||||
ErrorKind::UnexpectedEof => {},
|
||||
ErrorKind::Unsupported => {},
|
||||
ErrorKind::OutOfMemory => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ error: wildcard matches known variants and will also match future added variants
|
|||
--> $DIR/wildcard_enum_match_arm.rs:83:9
|
||||
|
|
||||
LL | _ => {},
|
||||
| ^ help: try this: `ErrorKind::PermissionDenied | ErrorKind::ConnectionRefused | ErrorKind::ConnectionReset | ErrorKind::ConnectionAborted | ErrorKind::NotConnected | ErrorKind::AddrInUse | ErrorKind::AddrNotAvailable | ErrorKind::BrokenPipe | ErrorKind::AlreadyExists | ErrorKind::WouldBlock | ErrorKind::InvalidInput | ErrorKind::InvalidData | ErrorKind::TimedOut | ErrorKind::WriteZero | ErrorKind::Interrupted | ErrorKind::Other | ErrorKind::UnexpectedEof | ErrorKind::Unsupported | ErrorKind::OutOfMemory | _`
|
||||
| ^ help: try this: `ErrorKind::PermissionDenied | _`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue