]> git.lizzy.rs Git - rust.git/commitdiff
Some reformatting
authorvarkor <github@varkor.com>
Sun, 12 Aug 2018 23:56:13 +0000 (00:56 +0100)
committervarkor <github@varkor.com>
Thu, 16 Aug 2018 19:09:05 +0000 (20:09 +0100)
src/librustc_mir/hair/pattern/_match.rs
src/librustc_mir/hair/pattern/check_match.rs

index 26df06663401580d029486d793f8c1be5e300210..5af9173be03375a3c830d8922f43110299b564a7 100644 (file)
@@ -814,8 +814,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
         // FIXME: this might lead to "unstable" behavior with macro hygiene
         // introducing uninhabited patterns for inaccessible fields. We
         // need to figure out how to model that.
-        ty: rows.iter().map(|r| r[0].ty).find(|ty| !ty.references_error())
-            .unwrap_or(v[0].ty),
+        ty: rows.iter().map(|r| r[0].ty).find(|ty| !ty.references_error()).unwrap_or(v[0].ty),
         max_slice_length: max_slice_length(cx, rows.iter().map(|r| r[0]).chain(Some(v[0])))
     };
 
@@ -1046,7 +1045,7 @@ fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>(
 /// Slice patterns, however, can match slices of different lengths. For instance,
 /// `[a, b, ..tail]` can match a slice of length 2, 3, 4 and so on.
 ///
-/// Returns None in case of a catch-all, which can't be specialized.
+/// Returns `None` in case of a catch-all, which can't be specialized.
 fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt,
                           pat: &Pattern<'tcx>,
                           pcx: PatternContext)
@@ -1319,13 +1318,13 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>(
                         span_bug!(pat.span,
                         "unexpected const-val {:?} with ctor {:?}", value, constructor)
                     }
-                },
+                }
                 _ => {
                     match constructor_covered_by_range(
                         cx.tcx,
                         constructor, value, value, RangeEnd::Included,
                         value.ty,
-                            ) {
+                    ) {
                         Ok(true) => Some(vec![]),
                         Ok(false) => None,
                         Err(ErrorReported) => None,
index 35f9dcee99f82b684c1852f4e01065b8518e434d..3a1e29dfe97b0ac4ab483fbb19da41715be41bfa 100644 (file)
@@ -272,7 +272,7 @@ fn check_irrefutable(&self, pat: &'tcx Pat, origin: &str) {
                                                 self.tables);
             let pattern = patcx.lower_pattern(pat);
             let pattern_ty = pattern.ty;
-            let pats : Matrix = vec![vec![
+            let pats: Matrix = vec![vec![
                 expand_pattern(cx, pattern)
             ]].into_iter().collect();