Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-ssr/src/replacing.rs')
| -rw-r--r-- | crates/ide-ssr/src/replacing.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ide-ssr/src/replacing.rs b/crates/ide-ssr/src/replacing.rs index 1726d5701a..e27ef6e35e 100644 --- a/crates/ide-ssr/src/replacing.rs +++ b/crates/ide-ssr/src/replacing.rs @@ -209,8 +209,10 @@ impl ReplacementRenderer<'_> { fn token_is_method_call_receiver(token: &SyntaxToken) -> bool { // Find the first method call among the ancestors of `token`, then check if the only token // within the receiver is `token`. - if let Some(receiver) = - token.ancestors().find_map(ast::MethodCallExpr::cast).and_then(|call| call.receiver()) + if let Some(receiver) = token + .parent_ancestors() + .find_map(ast::MethodCallExpr::cast) + .and_then(|call| call.receiver()) { let tokens = receiver.syntax().descendants_with_tokens().filter_map(|node_or_token| { match node_or_token { |