@@ -27,9 +27,8 @@ use crate::{
2727 builtin_type:: { BuiltinFloat , BuiltinInt , BuiltinUint } ,
2828 db:: DefDatabase ,
2929 expr:: {
30- dummy_expr_id, ArithOp , Array , BinaryOp , BindingAnnotation , CmpOp , Expr , ExprId , Label ,
31- LabelId , Literal , LogicOp , MatchArm , MatchGuard , Ordering , Pat , PatId , RecordFieldPat ,
32- RecordLitField , Statement ,
30+ dummy_expr_id, Array , BindingAnnotation , Expr , ExprId , Label , LabelId , Literal , MatchArm ,
31+ MatchGuard , Pat , PatId , RecordFieldPat , RecordLitField , Statement ,
3332 } ,
3433 intern:: Interned ,
3534 item_scope:: BuiltinShadowMode ,
@@ -509,7 +508,7 @@ impl ExprCollector<'_> {
509508 ast:: Expr :: BinExpr ( e) => {
510509 let lhs = self . collect_expr_opt ( e. lhs ( ) ) ;
511510 let rhs = self . collect_expr_opt ( e. rhs ( ) ) ;
512- let op = e. op_kind ( ) . map ( BinaryOp :: from ) ;
511+ let op = e. op_kind ( ) ;
513512 self . alloc_expr ( Expr :: BinaryOp { lhs, rhs, op } , syntax_ptr)
514513 }
515514 ast:: Expr :: TupleExpr ( e) => {
@@ -954,50 +953,6 @@ impl ExprCollector<'_> {
954953 }
955954}
956955
957- impl From < ast:: BinOp > for BinaryOp {
958- fn from ( ast_op : ast:: BinOp ) -> Self {
959- match ast_op {
960- ast:: BinOp :: BooleanOr => BinaryOp :: LogicOp ( LogicOp :: Or ) ,
961- ast:: BinOp :: BooleanAnd => BinaryOp :: LogicOp ( LogicOp :: And ) ,
962- ast:: BinOp :: EqualityTest => BinaryOp :: CmpOp ( CmpOp :: Eq { negated : false } ) ,
963- ast:: BinOp :: NegatedEqualityTest => BinaryOp :: CmpOp ( CmpOp :: Eq { negated : true } ) ,
964- ast:: BinOp :: LesserEqualTest => {
965- BinaryOp :: CmpOp ( CmpOp :: Ord { ordering : Ordering :: Less , strict : false } )
966- }
967- ast:: BinOp :: GreaterEqualTest => {
968- BinaryOp :: CmpOp ( CmpOp :: Ord { ordering : Ordering :: Greater , strict : false } )
969- }
970- ast:: BinOp :: LesserTest => {
971- BinaryOp :: CmpOp ( CmpOp :: Ord { ordering : Ordering :: Less , strict : true } )
972- }
973- ast:: BinOp :: GreaterTest => {
974- BinaryOp :: CmpOp ( CmpOp :: Ord { ordering : Ordering :: Greater , strict : true } )
975- }
976- ast:: BinOp :: Addition => BinaryOp :: ArithOp ( ArithOp :: Add ) ,
977- ast:: BinOp :: Multiplication => BinaryOp :: ArithOp ( ArithOp :: Mul ) ,
978- ast:: BinOp :: Subtraction => BinaryOp :: ArithOp ( ArithOp :: Sub ) ,
979- ast:: BinOp :: Division => BinaryOp :: ArithOp ( ArithOp :: Div ) ,
980- ast:: BinOp :: Remainder => BinaryOp :: ArithOp ( ArithOp :: Rem ) ,
981- ast:: BinOp :: LeftShift => BinaryOp :: ArithOp ( ArithOp :: Shl ) ,
982- ast:: BinOp :: RightShift => BinaryOp :: ArithOp ( ArithOp :: Shr ) ,
983- ast:: BinOp :: BitwiseXor => BinaryOp :: ArithOp ( ArithOp :: BitXor ) ,
984- ast:: BinOp :: BitwiseOr => BinaryOp :: ArithOp ( ArithOp :: BitOr ) ,
985- ast:: BinOp :: BitwiseAnd => BinaryOp :: ArithOp ( ArithOp :: BitAnd ) ,
986- ast:: BinOp :: Assignment => BinaryOp :: Assignment { op : None } ,
987- ast:: BinOp :: AddAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Add ) } ,
988- ast:: BinOp :: DivAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Div ) } ,
989- ast:: BinOp :: MulAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Mul ) } ,
990- ast:: BinOp :: RemAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Rem ) } ,
991- ast:: BinOp :: ShlAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Shl ) } ,
992- ast:: BinOp :: ShrAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Shr ) } ,
993- ast:: BinOp :: SubAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: Sub ) } ,
994- ast:: BinOp :: BitOrAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: BitOr ) } ,
995- ast:: BinOp :: BitAndAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: BitAnd ) } ,
996- ast:: BinOp :: BitXorAssign => BinaryOp :: Assignment { op : Some ( ArithOp :: BitXor ) } ,
997- }
998- }
999- }
1000-
1001956impl From < ast:: LiteralKind > for Literal {
1002957 fn from ( ast_lit_kind : ast:: LiteralKind ) -> Self {
1003958 match ast_lit_kind {
0 commit comments