@@ -13,7 +13,7 @@ use ide_db::{
1313use itertools:: { izip, Itertools } ;
1414use syntax:: {
1515 ast:: { self , edit_in_place:: Indent , HasArgList , PathExpr } ,
16- ted, AstNode , SyntaxKind ,
16+ ted, AstNode , NodeOrToken , SyntaxKind ,
1717} ;
1818
1919use crate :: {
@@ -311,15 +311,12 @@ fn inline(
311311 } else {
312312 fn_body. clone_for_update ( )
313313 } ;
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 ( ) ) ) ;
323320 }
324321 let usages_for_locals = |local| {
325322 Definition :: Local ( local)
0 commit comments