Skip to content

Commit 0ffba7a

Browse files
committed
Simplify wildcard_enum_match_arm test
1 parent 38569c0 commit 0ffba7a

File tree

4 files changed

+3
-56
lines changed

4 files changed

+3
-56
lines changed
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1+
// Stripped down version of the ErrorKind enum of std
12
#[non_exhaustive]
23
pub enum ErrorKind {
34
NotFound,
45
PermissionDenied,
5-
ConnectionRefused,
6-
ConnectionReset,
7-
ConnectionAborted,
8-
NotConnected,
9-
AddrInUse,
10-
AddrNotAvailable,
11-
BrokenPipe,
12-
AlreadyExists,
13-
WouldBlock,
14-
InvalidInput,
15-
InvalidData,
16-
TimedOut,
17-
WriteZero,
18-
Interrupted,
19-
Other,
20-
UnexpectedEof,
21-
Unsupported,
22-
OutOfMemory,
236
#[doc(hidden)]
247
Uncategorized,
258
}

tests/ui/wildcard_enum_match_arm.fixed

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,11 @@ fn main() {
8080
let error_kind = ErrorKind::NotFound;
8181
match error_kind {
8282
ErrorKind::NotFound => {},
83-
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 | _ => {},
83+
ErrorKind::PermissionDenied | _ => {},
8484
}
8585
match error_kind {
8686
ErrorKind::NotFound => {},
8787
ErrorKind::PermissionDenied => {},
88-
ErrorKind::ConnectionRefused => {},
89-
ErrorKind::ConnectionReset => {},
90-
ErrorKind::ConnectionAborted => {},
91-
ErrorKind::NotConnected => {},
92-
ErrorKind::AddrInUse => {},
93-
ErrorKind::AddrNotAvailable => {},
94-
ErrorKind::BrokenPipe => {},
95-
ErrorKind::AlreadyExists => {},
96-
ErrorKind::WouldBlock => {},
97-
ErrorKind::InvalidInput => {},
98-
ErrorKind::InvalidData => {},
99-
ErrorKind::TimedOut => {},
100-
ErrorKind::WriteZero => {},
101-
ErrorKind::Interrupted => {},
102-
ErrorKind::Other => {},
103-
ErrorKind::UnexpectedEof => {},
104-
ErrorKind::Unsupported => {},
105-
ErrorKind::OutOfMemory => {},
10688
_ => {},
10789
}
10890
}

tests/ui/wildcard_enum_match_arm.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,6 @@ fn main() {
8585
match error_kind {
8686
ErrorKind::NotFound => {},
8787
ErrorKind::PermissionDenied => {},
88-
ErrorKind::ConnectionRefused => {},
89-
ErrorKind::ConnectionReset => {},
90-
ErrorKind::ConnectionAborted => {},
91-
ErrorKind::NotConnected => {},
92-
ErrorKind::AddrInUse => {},
93-
ErrorKind::AddrNotAvailable => {},
94-
ErrorKind::BrokenPipe => {},
95-
ErrorKind::AlreadyExists => {},
96-
ErrorKind::WouldBlock => {},
97-
ErrorKind::InvalidInput => {},
98-
ErrorKind::InvalidData => {},
99-
ErrorKind::TimedOut => {},
100-
ErrorKind::WriteZero => {},
101-
ErrorKind::Interrupted => {},
102-
ErrorKind::Other => {},
103-
ErrorKind::UnexpectedEof => {},
104-
ErrorKind::Unsupported => {},
105-
ErrorKind::OutOfMemory => {},
10688
_ => {},
10789
}
10890
}

tests/ui/wildcard_enum_match_arm.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ error: wildcard matches known variants and will also match future added variants
3232
--> $DIR/wildcard_enum_match_arm.rs:83:9
3333
|
3434
LL | _ => {},
35-
| ^ 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 | _`
35+
| ^ help: try this: `ErrorKind::PermissionDenied | _`
3636

3737
error: aborting due to 5 previous errors
3838

0 commit comments

Comments
 (0)