@@ -34,18 +34,22 @@ pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContex
3434 AssistId ( "change_return_type_to_result" ) ,
3535 "Change return type to Result" ,
3636 type_ref. syntax ( ) . text_range ( ) ,
37- |edit | {
37+ |builder | {
3838 let mut tail_return_expr_collector = TailReturnCollector :: new ( ) ;
3939 tail_return_expr_collector. collect_jump_exprs ( block_expr, false ) ;
4040 tail_return_expr_collector. collect_tail_exprs ( block_expr) ;
4141
4242 for ret_expr_arg in tail_return_expr_collector. exprs_to_wrap {
43- edit . replace_node_and_indent ( & ret_expr_arg, format ! ( "Ok({})" , ret_expr_arg) ) ;
43+ builder . replace_node_and_indent ( & ret_expr_arg, format ! ( "Ok({})" , ret_expr_arg) ) ;
4444 }
45- edit. replace_node_and_indent ( type_ref. syntax ( ) , format ! ( "Result<{}, >" , type_ref) ) ;
45+ match ctx. config . snippet_cap {
46+ Some ( _) => { }
47+ None => { }
48+ }
49+ builder. replace_node_and_indent ( type_ref. syntax ( ) , format ! ( "Result<{}, >" , type_ref) ) ;
4650
4751 if let Some ( node_start) = result_insertion_offset ( & type_ref) {
48- edit . set_cursor ( node_start + TextSize :: of ( & format ! ( "Result<{}, " , type_ref) ) ) ;
52+ builder . set_cursor ( node_start + TextSize :: of ( & format ! ( "Result<{}, " , type_ref) ) ) ;
4953 }
5054 } ,
5155 )
0 commit comments