We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
is_comparison
BinOpKind
AssocOp
1 parent bb78dba commit 07a9854Copy full SHA for 07a9854
compiler/rustc_ast/src/ast.rs
@@ -920,14 +920,8 @@ impl BinOpKind {
920
matches!(self, BinOpKind::And | BinOpKind::Or)
921
}
922
923
- pub fn is_comparison(&self) -> bool {
924
- use BinOpKind::*;
925
- // Note for developers: please keep this match exhaustive;
926
- // we want compilation to fail if another variant is added.
927
- match *self {
928
- Eq | Lt | Le | Ne | Gt | Ge => true,
929
- And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
930
- }
+ pub fn is_comparison(self) -> bool {
+ crate::util::parser::AssocOp::from_ast_binop(self).is_comparison()
931
932
933
/// Returns `true` if the binary operator takes its arguments by value.
0 commit comments