diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index b7aa2aebbfa..b83b42c73e7 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -86,33 +86,17 @@ pub fn is_shift_binop(b: BinOp_) -> bool { pub fn is_comparison_binop(b: BinOp_) -> bool { match b { - BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true, - _ => false + BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => + true, + BiAnd | BiOr | BiAdd | BiSub | BiMul | BiDiv | BiRem | + BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr => + false, } } /// Returns `true` if the binary operator takes its arguments by value pub fn is_by_value_binop(b: BinOp_) -> bool { - match b { - BiAdd | BiSub | BiMul | BiDiv | BiRem | BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr => { - true - } - _ => false - } -} - -/// Returns `true` if the binary operator is symmetric in the sense that LHS -/// and RHS must have the same type. So the type of LHS can serve as an hint -/// for the type of RHS and vice versa. -pub fn is_symmetric_binop(b: BinOp_) -> bool { - match b { - BiAdd | BiSub | BiMul | BiDiv | BiRem | - BiBitXor | BiBitAnd | BiBitOr | - BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => { - true - } - _ => false - } + !is_comparison_binop(b) } /// Returns `true` if the unary operator takes its argument by value |
