]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/match_same_arms.rs
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / match_same_arms.rs
index 880518b010a74e5da1ed4aa8c830df5a36c1dd63..b53ca79adb5b5a6fbdcbbb720ae3742fe9e0de0a 100644 (file)
@@ -1,3 +1,4 @@
+#![warn(clippy::match_same_arms)]
 #![allow(
     clippy::blacklisted_name,
     clippy::collapsible_if,
@@ -21,7 +22,6 @@ pub enum Abc {
     C,
 }
 
-#[warn(clippy::match_same_arms)]
 #[allow(clippy::unused_unit)]
 fn match_same_arms() {
     let _ = match 42 {
@@ -126,4 +126,21 @@ fn match_same_arms() {
     };
 }
 
+mod issue4244 {
+    #[derive(PartialEq, PartialOrd, Eq, Ord)]
+    pub enum CommandInfo {
+        BuiltIn { name: String, about: Option<String> },
+        External { name: String, path: std::path::PathBuf },
+    }
+
+    impl CommandInfo {
+        pub fn name(&self) -> String {
+            match self {
+                CommandInfo::BuiltIn { name, .. } => name.to_string(),
+                CommandInfo::External { name, .. } => name.to_string(),
+            }
+        }
+    }
+}
+
 fn main() {}