about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-09 09:26:11 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-07-28 06:53:38 +0200
commitff77ef2d704658a90493dc8210f52f88697ee326 (patch)
treeaff95709693dbf94f9b4a4b333d69bbf4c7d9442 /src/libsyntax
parentf7c75cc11ac56535e3956a50a024296f94a67b8b (diff)
downloadrust-ff77ef2d704658a90493dc8210f52f88697ee326.tar.gz
rust-ff77ef2d704658a90493dc8210f52f88697ee326.zip
Introduce 'ast::Pat::is_rest(&self) -> bool'.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 37889c4918b..61a6c199701 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -580,6 +580,14 @@ impl Pat {
             | PatKind::Mac(_) => true,
         }
     }
+
+    /// Is this a `..` pattern?
+    pub fn is_rest(&self) -> bool {
+        match self.node {
+            PatKind::Rest => true,
+            _ => false,
+        }
+    }
 }
 
 /// A single field in a struct pattern