@@ -21,7 +21,7 @@ const HARD_CODED_ALLOWED_BINARY: &[[&str; 2]] = &[
21
21
[ "f64" , "f64" ] ,
22
22
[ "std::num::Saturating" , "std::num::Saturating" ] ,
23
23
[ "std::num::Wrapping" , "std::num::Wrapping" ] ,
24
- [ "std::string::String" , "& str" ] ,
24
+ [ "std::string::String" , "str" ] ,
25
25
] ;
26
26
const HARD_CODED_ALLOWED_UNARY : & [ & str ] = & [ "f32" , "f64" , "std::num::Saturating" , "std::num::Wrapping" ] ;
27
27
const INTEGER_METHODS : & [ & str ] = & [ "saturating_div" , "wrapping_div" , "wrapping_rem" , "wrapping_rem_euclid" ] ;
@@ -144,8 +144,10 @@ impl ArithmeticSideEffects {
144
144
) {
145
145
return ;
146
146
} ;
147
- let lhs_ty = cx. typeck_results ( ) . expr_ty ( lhs) ;
148
- let rhs_ty = cx. typeck_results ( ) . expr_ty ( rhs) ;
147
+ let ( actual_lhs, lhs_ref_counter) = peel_hir_expr_refs ( lhs) ;
148
+ let ( actual_rhs, rhs_ref_counter) = peel_hir_expr_refs ( rhs) ;
149
+ let lhs_ty = cx. typeck_results ( ) . expr_ty ( actual_lhs) . peel_refs ( ) ;
150
+ let rhs_ty = cx. typeck_results ( ) . expr_ty ( actual_rhs) . peel_refs ( ) ;
149
151
if self . has_allowed_binary ( lhs_ty, rhs_ty) {
150
152
return ;
151
153
}
@@ -154,8 +156,6 @@ impl ArithmeticSideEffects {
154
156
// At least for integers, shifts are already handled by the CTFE
155
157
return ;
156
158
}
157
- let ( actual_lhs, lhs_ref_counter) = peel_hir_expr_refs ( lhs) ;
158
- let ( actual_rhs, rhs_ref_counter) = peel_hir_expr_refs ( rhs) ;
159
159
match (
160
160
Self :: literal_integer ( cx, actual_lhs) ,
161
161
Self :: literal_integer ( cx, actual_rhs) ,
0 commit comments