// run-rustfix
+// aux-build:non-exhaustive-enum.rs
#![deny(clippy::wildcard_enum_match_arm)]
-#![allow(unreachable_code, unused_variables)]
+#![allow(
+ unreachable_code,
+ unused_variables,
+ dead_code,
+ clippy::single_match,
+ clippy::wildcard_in_or_patterns,
+ clippy::unnested_or_patterns,
+ clippy::diverging_sub_expression
+)]
+
+extern crate non_exhaustive_enum;
+
+use non_exhaustive_enum::ErrorKind;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum Color {
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 => {},
+ ErrorKind::PermissionDenied | _ => {},
+ }
+ match error_kind {
+ ErrorKind::NotFound => {},
+ ErrorKind::PermissionDenied => {},
+ _ => {},
+ }
+
+ {
+ #![allow(clippy::manual_non_exhaustive)]
+ pub enum Enum {
+ A,
+ B,
+ #[doc(hidden)]
+ __Private,
+ }
+ match Enum::A {
+ Enum::A => (),
+ Enum::B | _ => (),
+ }
+ }
}