Skip to content

Commit 412a637

Browse files
authored
Auto merge of #36471 - nnethercote:rm-to_binop, r=sanxiyn
Remove unused Token::to_binop function Just some dead code removal.
2 parents 5f6f838 + 4715985 commit 412a637

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

Diff for: src/libsyntax/parse/token.rs

+1-26
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub use self::DelimToken::*;
1414
pub use self::Lit::*;
1515
pub use self::Token::*;
1616

17-
use ast::{self, BinOpKind};
17+
use ast::{self};
1818
use ptr::P;
1919
use util::interner::Interner;
2020
use tokenstream;
@@ -258,31 +258,6 @@ impl Token {
258258
self.is_path_segment_keyword() || self.is_ident() && !self.is_any_keyword()
259259
}
260260

261-
/// Maps a token to its corresponding binary operator.
262-
pub fn to_binop(&self) -> Option<BinOpKind> {
263-
match *self {
264-
BinOp(Star) => Some(BinOpKind::Mul),
265-
BinOp(Slash) => Some(BinOpKind::Div),
266-
BinOp(Percent) => Some(BinOpKind::Rem),
267-
BinOp(Plus) => Some(BinOpKind::Add),
268-
BinOp(Minus) => Some(BinOpKind::Sub),
269-
BinOp(Shl) => Some(BinOpKind::Shl),
270-
BinOp(Shr) => Some(BinOpKind::Shr),
271-
BinOp(And) => Some(BinOpKind::BitAnd),
272-
BinOp(Caret) => Some(BinOpKind::BitXor),
273-
BinOp(Or) => Some(BinOpKind::BitOr),
274-
Lt => Some(BinOpKind::Lt),
275-
Le => Some(BinOpKind::Le),
276-
Ge => Some(BinOpKind::Ge),
277-
Gt => Some(BinOpKind::Gt),
278-
EqEq => Some(BinOpKind::Eq),
279-
Ne => Some(BinOpKind::Ne),
280-
AndAnd => Some(BinOpKind::And),
281-
OrOr => Some(BinOpKind::Or),
282-
_ => None,
283-
}
284-
}
285-
286261
/// Returns `true` if the token is a given keyword, `kw`.
287262
pub fn is_keyword(&self, kw: keywords::Keyword) -> bool {
288263
match *self {

0 commit comments

Comments
 (0)