diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-08 22:38:23 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-08 22:38:23 +0300 |
| commit | 25b05147b3ec0a1ed9df9614910a10171b8cf211 (patch) | |
| tree | 40e348a9fd8394e15c873a56c24957131ba3a977 /src/libsyntax/parse/token.rs | |
| parent | 0ca3c2f881fc4bc51bfa92f1adcd1b845b812534 (diff) | |
| download | rust-25b05147b3ec0a1ed9df9614910a10171b8cf211.tar.gz rust-25b05147b3ec0a1ed9df9614910a10171b8cf211.zip | |
syntax: Remove `Deref` impl from `Token`
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 0ece5b57935..9b845ca524e 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -17,7 +17,6 @@ use log::info; use std::fmt; use std::mem; -use std::ops::Deref; #[cfg(target_arch = "x86_64")] use rustc_data_structures::static_assert_size; use rustc_data_structures::sync::Lrc; @@ -553,11 +552,11 @@ impl TokenKind { impl Token { // See comments in `Nonterminal::to_tokenstream` for why we care about // *probably* equal here rather than actual equality - crate fn probably_equal_for_proc_macro(&self, other: &TokenKind) -> bool { - if mem::discriminant(&self.kind) != mem::discriminant(other) { + crate fn probably_equal_for_proc_macro(&self, other: &Token) -> bool { + if mem::discriminant(&self.kind) != mem::discriminant(&other.kind) { return false } - match (&self.kind, other) { + match (&self.kind, &other.kind) { (&Eq, &Eq) | (&Lt, &Lt) | (&Le, &Le) | @@ -631,14 +630,6 @@ impl PartialEq<TokenKind> for Token { } } -// FIXME: Remove this after all necessary methods are moved from `TokenKind` to `Token`. -impl Deref for Token { - type Target = TokenKind; - fn deref(&self) -> &Self::Target { - &self.kind - } -} - #[derive(Clone, RustcEncodable, RustcDecodable)] /// For interpolation during macro expansion. pub enum Nonterminal { @@ -778,12 +769,14 @@ impl Nonterminal { } } -crate fn is_op(tok: &TokenKind) -> bool { - match *tok { - OpenDelim(..) | CloseDelim(..) | Literal(..) | DocComment(..) | - Ident(..) | Lifetime(..) | Interpolated(..) | - Whitespace | Comment | Shebang(..) | Eof => false, - _ => true, +impl Token { + crate fn is_op(&self) -> bool { + match self.kind { + OpenDelim(..) | CloseDelim(..) | Literal(..) | DocComment(..) | + Ident(..) | Lifetime(..) | Interpolated(..) | + Whitespace | Comment | Shebang(..) | Eof => false, + _ => true, + } } } |
