diff options
| author | Agustin Chiappe Berrini <jnieve@gmail.com> | 2017-12-06 04:28:01 -0500 |
|---|---|---|
| committer | Agustin Chiappe Berrini <jnieve@gmail.com> | 2017-12-06 04:28:01 -0500 |
| commit | 65ccf24ce8e51b199d60d06ad41ea35f4cdee15c (patch) | |
| tree | 733ff2b5a3998cc91517bb2aa1fae3ea5f42ad7c /src/libsyntax/parse/token.rs | |
| parent | a2899408dd162bfe349e7ff8bceaee60b34e77cc (diff) | |
| download | rust-65ccf24ce8e51b199d60d06ad41ea35f4cdee15c.tar.gz rust-65ccf24ce8e51b199d60d06ad41ea35f4cdee15c.zip | |
and refactor to just move the checking
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index ff87f146c0a..94b279d2bdc 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -364,18 +364,12 @@ impl Token { /// Returns `true` if the token is a keyword used in the language. pub fn is_used_keyword(&self) -> bool { - match self.ident() { - Some(id) => id.name >= keywords::As.name() && id.name <= keywords::While.name(), - _ => false, - } + self.ident().map(|id| id.name.is_used_keyword()).unwrap_or(false) } /// Returns `true` if the token is a keyword reserved for possible future use. pub fn is_unused_keyword(&self) -> bool { - match self.ident() { - Some(id) => id.name >= keywords::Abstract.name() && id.name <= keywords::Yield.name(), - _ => false, - } + self.ident().map(|id| id.name.is_unused_keyword()).unwrap_or(false) } pub fn glue(self, joint: Token) -> Option<Token> { |
