]> git.lizzy.rs Git - rust.git/commitdiff
battle of the Some
authorJeroen Vannevel <jer_vannevel@outlook.com>
Tue, 11 Jan 2022 21:53:39 +0000 (21:53 +0000)
committerJeroen Vannevel <jer_vannevel@outlook.com>
Fri, 14 Jan 2022 01:32:12 +0000 (01:32 +0000)
crates/ide_assists/src/handlers/merge_match_arms.rs

index 54de1c6c2fb79619f3d4b38ece7d8833529807d4..0ef4678d118c80637e600da8cd8b83b3ae9ab0a1 100644 (file)
@@ -101,11 +101,11 @@ fn are_same_types(
 ) -> bool {
     let arm_types = get_arm_types(&ctx, &arm);
     for (other_arm_type_name, other_arm_type) in arm_types {
-        if let Some((_, Some(current_arm_type))) = current_arm_types.get_key_value(&other_arm_type_name) {
-            if let Some(other_arm_type) = other_arm_type {
-                if other_arm_type.original != current_arm_type.original {
-                    return false;
-                }
+        if let (Some(Some(current_arm_type)), Some(other_arm_type)) =
+            (current_arm_types.get(&other_arm_type_name), other_arm_type)
+        {
+            if other_arm_type.original != current_arm_type.original {
+                return false;
             }
         } else {
             // No corresponding field found