@@ -2692,6 +2692,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26922692 return false ;
26932693 }
26942694
2695+ if expr. span . in_derive_expansion ( ) {
2696+ // Ignore if span is from derive macro.
2697+ return false ;
2698+ }
2699+
26952700 let Ok ( src) = self . tcx . sess . source_map ( ) . span_to_snippet ( expr. span ) else {
26962701 return false ;
26972702 } ;
@@ -2896,12 +2901,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
28962901 ( None , _) | ( _, None ) => ( true , true ) ,
28972902 _ => ( false , false ) ,
28982903 } ;
2899- if !expr. span . in_derive_expansion ( ) {
2900- suggest_to_change_suffix_or_into ( err, f2e_is_fallible, e2f_is_fallible) ;
2901- true
2902- } else {
2903- false
2904- }
2904+ suggest_to_change_suffix_or_into ( err, f2e_is_fallible, e2f_is_fallible) ;
2905+ true
29052906 }
29062907 ( ty:: Uint ( exp) , ty:: Uint ( found) ) => {
29072908 let ( f2e_is_fallible, e2f_is_fallible) = match ( exp. bit_width ( ) , found. bit_width ( ) )
@@ -2913,12 +2914,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
29132914 ( None , _) | ( _, None ) => ( true , true ) ,
29142915 _ => ( false , false ) ,
29152916 } ;
2916- if !expr. span . in_derive_expansion ( ) {
2917- suggest_to_change_suffix_or_into ( err, f2e_is_fallible, e2f_is_fallible) ;
2918- true
2919- } else {
2920- false
2921- }
2917+ suggest_to_change_suffix_or_into ( err, f2e_is_fallible, e2f_is_fallible) ;
2918+ true
29222919 }
29232920 ( & ty:: Int ( exp) , & ty:: Uint ( found) ) => {
29242921 let ( f2e_is_fallible, e2f_is_fallible) = match ( exp. bit_width ( ) , found. bit_width ( ) )
0 commit comments