From f8b6449f80b75c8d42b1ebbe4c1fb6d4bfec7ace Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Mon, 18 Feb 2019 18:34:42 +0000 Subject: Fix style nits Fix style nits discovered in reading code. --- src/libsyntax/ast.rs | 7 +++++++ src/libsyntax/mut_visit.rs | 2 +- src/libsyntax/parse/parser.rs | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index ab62dd2bc9b..9c4945d74db 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -640,19 +640,26 @@ pub enum PatKind { /// If the `..` pattern fragment is present, then `Option` denotes its position. /// `0 <= position <= subpats.len()`. Tuple(Vec>, Option), + /// A `box` pattern. Box(P), + /// A reference pattern (e.g., `&mut (a, b)`). Ref(P, Mutability), + /// A literal. Lit(P), + /// A range pattern (e.g., `1...2`, `1..=2` or `1..2`). Range(P, P, Spanned), + /// `[a, b, ..i, y, z]` is represented as: /// `PatKind::Slice(box [a, b], Some(i), box [y, z])` Slice(Vec>, Option>, Vec>), + /// Parentheses in patterns used for grouping (i.e., `(PAT)`). Paren(P), + /// A macro pattern; pre-expansion. Mac(Mac), } diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 1e5eb0992bd..fd7003d30a1 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -1037,7 +1037,7 @@ pub fn noop_visit_pat(pat: &mut P, vis: &mut T) { vis.visit_expr(e1); vis.visit_expr(e2); vis.visit_span(span); - }, + } PatKind::Slice(before, slice, after) => { visit_vec(before, |pat| vis.visit_pat(pat)); visit_opt(slice, |slice| vis.visit_pat(slice)); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e22047938e5..b1fb38d8eaf 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4173,7 +4173,8 @@ impl<'a> Parser<'a> { err.emit(); self.bump(); } else if self.eat(&token::BinOp(token::Or)) { - // No op. + // This is a No-op. Continue the loop to parse the next + // pattern. } else { return Ok(pats); } -- cgit 1.4.1-3-g733a5