Skip to content

Remove unused Token::to_binop function #36471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions src/libsyntax/parse/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use self::DelimToken::*;
pub use self::Lit::*;
pub use self::Token::*;

use ast::{self, BinOpKind};
use ast::{self};
use ptr::P;
use util::interner::Interner;
use tokenstream;
Expand Down Expand Up @@ -258,31 +258,6 @@ impl Token {
self.is_path_segment_keyword() || self.is_ident() && !self.is_any_keyword()
}

/// Maps a token to its corresponding binary operator.
pub fn to_binop(&self) -> Option<BinOpKind> {
match *self {
BinOp(Star) => Some(BinOpKind::Mul),
BinOp(Slash) => Some(BinOpKind::Div),
BinOp(Percent) => Some(BinOpKind::Rem),
BinOp(Plus) => Some(BinOpKind::Add),
BinOp(Minus) => Some(BinOpKind::Sub),
BinOp(Shl) => Some(BinOpKind::Shl),
BinOp(Shr) => Some(BinOpKind::Shr),
BinOp(And) => Some(BinOpKind::BitAnd),
BinOp(Caret) => Some(BinOpKind::BitXor),
BinOp(Or) => Some(BinOpKind::BitOr),
Lt => Some(BinOpKind::Lt),
Le => Some(BinOpKind::Le),
Ge => Some(BinOpKind::Ge),
Gt => Some(BinOpKind::Gt),
EqEq => Some(BinOpKind::Eq),
Ne => Some(BinOpKind::Ne),
AndAnd => Some(BinOpKind::And),
OrOr => Some(BinOpKind::Or),
_ => None,
}
}

/// Returns `true` if the token is a given keyword, `kw`.
pub fn is_keyword(&self, kw: keywords::Keyword) -> bool {
match *self {
Expand Down