@@ -116,8 +116,7 @@ pub(crate) fn inline_into_callers(acc: &mut Assists, ctx: &AssistContext<'_>) ->
116
116
. into_iter ( )
117
117
. map ( |( call_info, mut_node) | {
118
118
let replacement =
119
- inline ( & ctx. sema , def_file, function, & func_body, & params, & call_info)
120
- . expect ( "inline() should return an Expr" ) ;
119
+ inline ( & ctx. sema , def_file, function, & func_body, & params, & call_info) ;
121
120
ted:: replace ( mut_node, replacement. syntax ( ) ) ;
122
121
} )
123
122
. count ( ) ;
@@ -219,7 +218,7 @@ pub(crate) fn inline_call(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<
219
218
}
220
219
221
220
let syntax = call_info. node . syntax ( ) . clone ( ) ;
222
- let replacement = inline ( & ctx. sema , file_id, function, & fn_body, & params, & call_info) ? ;
221
+ let replacement = inline ( & ctx. sema , file_id, function, & fn_body, & params, & call_info) ;
223
222
acc. add (
224
223
AssistId ( "inline_call" , AssistKind :: RefactorInline ) ,
225
224
label,
@@ -305,7 +304,7 @@ fn inline(
305
304
fn_body : & ast:: BlockExpr ,
306
305
params : & [ ( ast:: Pat , Option < ast:: Type > , hir:: Param ) ] ,
307
306
CallInfo { node, arguments, generic_arg_list } : & CallInfo ,
308
- ) -> Option < ast:: Expr > {
307
+ ) -> ast:: Expr {
309
308
let mut body = if sema. hir_file_for ( fn_body. syntax ( ) ) . is_macro ( ) {
310
309
cov_mark:: hit!( inline_call_defined_in_macro) ;
311
310
if let Some ( body) = ast:: BlockExpr :: cast ( insert_ws_into ( fn_body. syntax ( ) . clone ( ) ) ) {
@@ -376,7 +375,6 @@ fn inline(
376
375
ast:: NameLike :: NameRef ( _) => Some ( body. syntax ( ) . covering_element ( range) ) ,
377
376
_ => None ,
378
377
} )
379
- . into_iter ( )
380
378
. for_each ( |usage| {
381
379
ted:: replace ( usage, & this ( ) ) ;
382
380
} ) ;
@@ -490,7 +488,7 @@ fn inline(
490
488
} ;
491
489
body. reindent_to ( original_indentation) ;
492
490
493
- Some ( match body. tail_expr ( ) {
491
+ match body. tail_expr ( ) {
494
492
Some ( expr) if !is_async_fn && body. statements ( ) . next ( ) . is_none ( ) => expr,
495
493
_ => match node
496
494
. syntax ( )
@@ -503,7 +501,7 @@ fn inline(
503
501
}
504
502
_ => ast:: Expr :: BlockExpr ( body) ,
505
503
} ,
506
- } )
504
+ }
507
505
}
508
506
509
507
fn path_expr_as_record_field ( usage : & PathExpr ) -> Option < ast:: RecordExprField > {
0 commit comments