@@ -64,23 +64,22 @@ pub fn concat_string_exprs(lhs: Expression, rhs: Expression) -> Result<Expressio
64
64
end : rhs. node . end ,
65
65
} ;
66
66
let concatnated_string = match ( lhs. value , rhs. value ) {
67
- ( ConstantValue :: Str ( lhs_val ) , ConstantValue :: Str ( rhs_val ) ) => {
67
+ ( ConstantValue :: Str , ConstantValue :: Str ) => {
68
68
Expression :: Constant ( Box :: new ( Constant {
69
69
node,
70
- value : ConstantValue :: Str ( lhs_val + & rhs_val ) ,
70
+ value : ConstantValue :: Str ,
71
71
} ) )
72
72
}
73
- ( ConstantValue :: Bytes ( mut lhs) , ConstantValue :: Bytes ( rhs) ) => {
74
- lhs. append ( & mut rhs. clone ( ) ) ;
73
+ ( ConstantValue :: Bytes , ConstantValue :: Bytes ) => {
75
74
Expression :: Constant ( Box :: new ( Constant {
76
75
node,
77
- value : ConstantValue :: Bytes ( lhs ) ,
76
+ value : ConstantValue :: Bytes ,
78
77
} ) )
79
78
}
80
- ( ConstantValue :: Bytes ( _lhs ) , _) => {
79
+ ( ConstantValue :: Bytes , _) => {
81
80
panic ! ( "Cannot concat bytes and string" ) ;
82
81
}
83
- ( _, ConstantValue :: Bytes ( _rhs ) ) => {
82
+ ( _, ConstantValue :: Bytes ) => {
84
83
panic ! ( "Can only concat bytes with other bytes" ) ;
85
84
}
86
85
_ => panic ! ( "Cannot concat string" ) ,
@@ -101,13 +100,13 @@ pub fn concat_string_exprs(lhs: Expression, rhs: Expression) -> Result<Expressio
101
100
( Expression :: JoinedStr ( fstring_lhs) , Expression :: Constant ( const_rhs) ) => {
102
101
let mut values = fstring_lhs. values ;
103
102
match const_rhs. value {
104
- ConstantValue :: Str ( rhs_val ) => {
103
+ ConstantValue :: Str => {
105
104
values. push ( Expression :: Constant ( Box :: new ( Constant {
106
105
node : const_rhs. node ,
107
- value : ConstantValue :: Str ( rhs_val ) ,
106
+ value : ConstantValue :: Str ,
108
107
} ) ) ) ;
109
108
}
110
- ConstantValue :: Bytes ( _ ) => {
109
+ ConstantValue :: Bytes => {
111
110
panic ! ( "Cannot concat string and bytes" ) ;
112
111
}
113
112
_ => panic ! ( "Cannot concat string" ) ,
@@ -122,11 +121,11 @@ pub fn concat_string_exprs(lhs: Expression, rhs: Expression) -> Result<Expressio
122
121
}
123
122
( Expression :: Constant ( const_lhs) , Expression :: JoinedStr ( fstring_rhs) ) => {
124
123
let const_expr = match const_lhs. value {
125
- ConstantValue :: Str ( rhs_val ) => Expression :: Constant ( Box :: new ( Constant {
124
+ ConstantValue :: Str => Expression :: Constant ( Box :: new ( Constant {
126
125
node : const_lhs. node ,
127
- value : ConstantValue :: Str ( rhs_val ) ,
126
+ value : ConstantValue :: Str ,
128
127
} ) ) ,
129
- ConstantValue :: Bytes ( _ ) => {
128
+ ConstantValue :: Bytes => {
130
129
panic ! ( "Cannot concat string and bytes" ) ;
131
130
}
132
131
_ => panic ! ( "Cannot concat string" ) ,
0 commit comments