aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-06 15:48:16 +0100
committerGitHub <[email protected]>2021-05-06 15:48:16 +0100
commit3b4d5df840f1c6a077ad1886a98ef453811a599f (patch)
tree0dc716bd076239e29d84292794dcd430f4681fa0
parent6e99f42f30ad32fdba307d57c224bb046459f83b (diff)
parent1fb20e323106465bd2029ae8f6d4dac86422708c (diff)
Merge #8744
8744: minor: simplify r=edwin0cheng a=edwin0cheng cc #8742 bors r+ Co-authored-by: Edwin Cheng <[email protected]>
-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}