From ff77ef2d704658a90493dc8210f52f88697ee326 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 9 Jul 2019 09:26:11 +0200 Subject: Introduce 'ast::Pat::is_rest(&self) -> bool'. --- src/libsyntax/ast.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/libsyntax') 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 -- cgit 1.4.1-3-g733a5