@@ -112,9 +112,7 @@ fn report_single_pattern(
112112 let ( sugg, help) = if is_unit_expr ( arm. body ) {
113113 ( String :: new ( ) , "`match` expression can be removed" )
114114 } else {
115- let mut sugg = snippet_block_with_context ( cx, arm. body . span , ctxt, ".." , Some ( expr. span ) , & mut app)
116- . 0
117- . to_string ( ) ;
115+ let mut sugg = snippet_block_with_context ( cx, arm. body . span , ctxt, ".." , Some ( expr. span ) , & mut app) . 0 ;
118116 if let Node :: Stmt ( stmt) = cx. tcx . parent_hir_node ( expr. hir_id )
119117 && let StmtKind :: Expr ( _) = stmt. kind
120118 && match arm. body . kind {
@@ -127,7 +125,7 @@ fn report_single_pattern(
127125 ( sugg, "try" )
128126 } ;
129127 span_lint_and_then ( cx, lint, expr. span , msg, |diag| {
130- diag. span_suggestion ( expr. span , help, sugg. to_string ( ) , app) ;
128+ diag. span_suggestion ( expr. span , help, sugg, app) ;
131129 note ( diag) ;
132130 } ) ;
133131 return ;
@@ -188,7 +186,7 @@ fn report_single_pattern(
188186 } ;
189187
190188 span_lint_and_then ( cx, lint, expr. span , msg, |diag| {
191- diag. span_suggestion ( expr. span , "try" , sugg. to_string ( ) , app) ;
189+ diag. span_suggestion ( expr. span , "try" , sugg, app) ;
192190 note ( diag) ;
193191 } ) ;
194192}
0 commit comments