@@ -117,7 +117,7 @@ pub(crate) fn inline_into_callers(acc: &mut Assists, ctx: &AssistContext<'_>) ->
117
117
. map ( |( call_info, mut_node) | {
118
118
let replacement =
119
119
inline ( & ctx. sema , def_file, function, & func_body, & params, & call_info)
120
- . unwrap ( ) ;
120
+ . expect ( "inline() should return an Expr" ) ;
121
121
ted:: replace ( mut_node, replacement. syntax ( ) ) ;
122
122
} )
123
123
. count ( ) ;
@@ -363,17 +363,23 @@ fn inline(
363
363
. collect ( ) ;
364
364
365
365
if function. self_param ( sema. db ) . is_some ( ) {
366
- let this = || make:: name_ref ( "this" ) . syntax ( ) . clone_for_update ( ) . first_token ( ) ;
366
+ let this = || {
367
+ make:: name_ref ( "this" )
368
+ . syntax ( )
369
+ . clone_for_update ( )
370
+ . first_token ( )
371
+ . expect ( "NameRef should have had a token." )
372
+ } ;
367
373
if let Some ( self_local) = params[ 0 ] . 2 . as_local ( sema. db ) {
368
- let usages = usages_for_locals ( self_local) . filter_map (
369
- |FileReference { name, range, .. } | match name {
374
+ usages_for_locals ( self_local)
375
+ . filter_map ( |FileReference { name, range, .. } | match name {
370
376
ast:: NameLike :: NameRef ( _) => Some ( body. syntax ( ) . covering_element ( range) ) ,
371
377
_ => None ,
372
- } ,
373
- ) ;
374
- for usage in usages {
375
- ted:: replace ( usage, & this ( ) ? ) ;
376
- }
378
+ } )
379
+ . into_iter ( )
380
+ . for_each ( |usage| {
381
+ ted:: replace ( usage, & this ( ) ) ;
382
+ } ) ;
377
383
}
378
384
}
379
385
@@ -471,7 +477,9 @@ fn inline(
471
477
}
472
478
} else if let Some ( stmt_list) = body. stmt_list ( ) {
473
479
ted:: insert_all (
474
- ted:: Position :: after ( stmt_list. l_curly_token ( ) ?) ,
480
+ ted:: Position :: after (
481
+ stmt_list. l_curly_token ( ) . expect ( "L_CURLY for StatementList is missing." ) ,
482
+ ) ,
475
483
let_stmts. into_iter ( ) . map ( |stmt| stmt. syntax ( ) . clone ( ) . into ( ) ) . collect ( ) ,
476
484
) ;
477
485
}
0 commit comments