]> git.lizzy.rs Git - rust.git/commitdiff
libsyntax: Consolidate branch to benefit from exhaustive checking instead of unwrapping
authorKevin Butler <haqkrs@gmail.com>
Sun, 25 Oct 2015 00:07:12 +0000 (01:07 +0100)
committerKevin Butler <haqkrs@gmail.com>
Sun, 25 Oct 2015 00:34:45 +0000 (01:34 +0100)
src/libsyntax/parse/parser.rs

index 7bc9441fb9dbb716f0d79239485de67ec60dd38f..02faf315f01ca95c8420d707a550903bf1967ef2 100644 (file)
@@ -3304,13 +3304,13 @@ pub fn parse_pat_nopanic(&mut self) -> PResult<P<Pat>> {
                             pat = PatEnum(path, Some(args));
                         }
                       }
-                      _ if qself.is_some() => {
-                        // Parse qualified path
-                        pat = PatQPath(qself.unwrap(), path);
-                      }
                       _ => {
-                        // Parse nullary enum
-                        pat = PatEnum(path, Some(vec![]));
+                        pat = match qself {
+                            // Parse qualified path
+                            Some(qself) => PatQPath(qself, path),
+                            // Parse nullary enum
+                            None => PatEnum(path, Some(vec![]))
+                        };
                       }
                     }
                 }