@@ -13,7 +13,7 @@ use ide_db::{
13
13
use itertools:: { izip, Itertools } ;
14
14
use syntax:: {
15
15
ast:: { self , edit_in_place:: Indent , HasArgList , PathExpr } ,
16
- ted, AstNode , SyntaxKind ,
16
+ ted, AstNode , NodeOrToken , SyntaxKind ,
17
17
} ;
18
18
19
19
use crate :: {
@@ -311,15 +311,12 @@ fn inline(
311
311
} else {
312
312
fn_body. clone_for_update ( )
313
313
} ;
314
- // TODO: use if-let chains - https://github.com/rust-lang/rust/pull/94927
315
- if let Some ( i) = body. syntax ( ) . ancestors ( ) . find_map ( ast:: Impl :: cast) {
316
- if let Some ( st) = i. self_ty ( ) {
317
- for tok in body. syntax ( ) . descendants_with_tokens ( ) . filter_map ( |t| t. into_token ( ) ) {
318
- if tok. kind ( ) == SyntaxKind :: SELF_TYPE_KW {
319
- ted:: replace ( tok, st. syntax ( ) ) ;
320
- }
321
- }
322
- }
314
+ if let Some ( t) = body. syntax ( ) . ancestors ( ) . find_map ( ast:: Impl :: cast) . and_then ( |i| i. self_ty ( ) ) {
315
+ body. syntax ( )
316
+ . descendants_with_tokens ( )
317
+ . filter_map ( NodeOrToken :: into_token)
318
+ . filter ( |tok| tok. kind ( ) == SyntaxKind :: SELF_TYPE_KW )
319
+ . for_each ( |tok| ted:: replace ( tok, t. syntax ( ) ) ) ;
323
320
}
324
321
let usages_for_locals = |local| {
325
322
Definition :: Local ( local)
0 commit comments