diff options
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/trait_impl.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/ide_completion/src/completions/trait_impl.rs b/crates/ide_completion/src/completions/trait_impl.rs index 78fbfcd97..968c0254d 100644 --- a/crates/ide_completion/src/completions/trait_impl.rs +++ b/crates/ide_completion/src/completions/trait_impl.rs | |||
@@ -242,13 +242,9 @@ fn replacement_range(ctx: &CompletionContext, item: &SyntaxNode) -> TextRange { | |||
242 | let first_child = item | 242 | let first_child = item |
243 | .children_with_tokens() | 243 | .children_with_tokens() |
244 | .find(|child| { | 244 | .find(|child| { |
245 | let kind = child.kind(); | 245 | !matches!(child.kind(), SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR) |
246 | match kind { | ||
247 | SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR => false, | ||
248 | _ => true, | ||
249 | } | ||
250 | }) | 246 | }) |
251 | .unwrap_or(SyntaxElement::Node(item.clone())); | 247 | .unwrap_or_else(|| SyntaxElement::Node(item.clone())); |
252 | 248 | ||
253 | TextRange::new(first_child.text_range().start(), ctx.source_range().end()) | 249 | TextRange::new(first_child.text_range().start(), ctx.source_range().end()) |
254 | } | 250 | } |