@@ -492,7 +492,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
492492 ) -> bool /* did we suggest to call a function because of missing parentheses? */ {
493493 err. span_label ( span, ty. to_string ( ) ) ;
494494 if let FnDef ( def_id, _) = * ty. kind ( ) {
495- let source_map = self . tcx . sess . source_map ( ) ;
496495 if !self . tcx . has_typeck_results ( def_id) {
497496 return false ;
498497 }
@@ -517,20 +516,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
517516 . lookup_op_method ( fn_sig. output ( ) , & [ other_ty] , Op :: Binary ( op, is_assign) )
518517 . is_ok ( )
519518 {
520- if let Ok ( snippet) = source_map. span_to_snippet ( span) {
521- let ( variable_snippet, applicability) = if !fn_sig. inputs ( ) . is_empty ( ) {
522- ( format ! ( "{}( /* arguments */ )" , snippet) , Applicability :: HasPlaceholders )
523- } else {
524- ( format ! ( "{}()" , snippet) , Applicability :: MaybeIncorrect )
525- } ;
519+ let ( variable_snippet, applicability) = if !fn_sig. inputs ( ) . is_empty ( ) {
520+ ( "( /* arguments */ )" . to_string ( ) , Applicability :: HasPlaceholders )
521+ } else {
522+ ( "()" . to_string ( ) , Applicability :: MaybeIncorrect )
523+ } ;
526524
527- err. span_suggestion (
528- span,
529- "you might have forgotten to call this function" ,
530- variable_snippet,
531- applicability,
532- ) ;
533- }
525+ err. span_suggestion_verbose (
526+ span. shrink_to_hi ( ) ,
527+ "you might have forgotten to call this function" ,
528+ variable_snippet,
529+ applicability,
530+ ) ;
534531 return true ;
535532 }
536533 }
0 commit comments