aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2021-05-06 15:39:51 +0100
committerEdwin Cheng <[email protected]>2021-05-06 15:39:51 +0100
commit1fb20e323106465bd2029ae8f6d4dac86422708c (patch)
tree050818fafbced95df25c262f925e5ba9b69aefc7 /crates/ide_completion
parent65bdf84beaee439d8a122ae6ec2ee921e5a9e0bb (diff)
Simplify
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/trait_impl.rs8
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}