@@ -116,8 +116,7 @@ pub(crate) fn inline_into_callers(acc: &mut Assists, ctx: &AssistContext<'_>) ->
116116 . into_iter ( )
117117 . map ( |( call_info, mut_node) | {
118118 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) ;
121120 ted:: replace ( mut_node, replacement. syntax ( ) ) ;
122121 } )
123122 . count ( ) ;
@@ -219,7 +218,7 @@ pub(crate) fn inline_call(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<
219218 }
220219
221220 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) ;
223222 acc. add (
224223 AssistId ( "inline_call" , AssistKind :: RefactorInline ) ,
225224 label,
@@ -305,7 +304,7 @@ fn inline(
305304 fn_body : & ast:: BlockExpr ,
306305 params : & [ ( ast:: Pat , Option < ast:: Type > , hir:: Param ) ] ,
307306 CallInfo { node, arguments, generic_arg_list } : & CallInfo ,
308- ) -> Option < ast:: Expr > {
307+ ) -> ast:: Expr {
309308 let mut body = if sema. hir_file_for ( fn_body. syntax ( ) ) . is_macro ( ) {
310309 cov_mark:: hit!( inline_call_defined_in_macro) ;
311310 if let Some ( body) = ast:: BlockExpr :: cast ( insert_ws_into ( fn_body. syntax ( ) . clone ( ) ) ) {
@@ -376,7 +375,6 @@ fn inline(
376375 ast:: NameLike :: NameRef ( _) => Some ( body. syntax ( ) . covering_element ( range) ) ,
377376 _ => None ,
378377 } )
379- . into_iter ( )
380378 . for_each ( |usage| {
381379 ted:: replace ( usage, & this ( ) ) ;
382380 } ) ;
@@ -490,7 +488,7 @@ fn inline(
490488 } ;
491489 body. reindent_to ( original_indentation) ;
492490
493- Some ( match body. tail_expr ( ) {
491+ match body. tail_expr ( ) {
494492 Some ( expr) if !is_async_fn && body. statements ( ) . next ( ) . is_none ( ) => expr,
495493 _ => match node
496494 . syntax ( )
@@ -503,7 +501,7 @@ fn inline(
503501 }
504502 _ => ast:: Expr :: BlockExpr ( body) ,
505503 } ,
506- } )
504+ }
507505}
508506
509507fn path_expr_as_record_field ( usage : & PathExpr ) -> Option < ast:: RecordExprField > {
0 commit comments