]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/wildcard_enum_match_arm.fixed
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / wildcard_enum_match_arm.fixed
index af67f326f856017682605c69d6def1019e16259e..2aa24ea1156aaa5a0b70e1d1ef11c41992b12b0f 100644 (file)
@@ -1,7 +1,15 @@
 // run-rustfix
 
 #![deny(clippy::wildcard_enum_match_arm)]
-#![allow(unreachable_code, unused_variables, dead_code)]
+#![allow(
+    unreachable_code,
+    unused_variables,
+    dead_code,
+    clippy::single_match,
+    clippy::wildcard_in_or_patterns
+)]
+
+use std::io::ErrorKind;
 
 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
 enum Color {
@@ -62,4 +70,32 @@ fn main() {
         140 => {},
         _ => {},
     };
+    // We need to use an enum not defined in this test because non_exhaustive is ignored for the
+    // purposes of dead code analysis within a crate.
+    let error_kind = ErrorKind::NotFound;
+    match error_kind {
+        ErrorKind::NotFound => {},
+        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 | _ => {},
+    }
+    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 => {},
+        _ => {},
+    }
 }