Skip to content

Commit 3b4d5df

Browse files
Merge #8744
8744: minor: simplify r=edwin0cheng a=edwin0cheng cc #8742 bors r+ Co-authored-by: Edwin Cheng <[email protected]>
2 parents 6e99f42 + 1fb20e3 commit 3b4d5df

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

crates/ide_completion/src/completions/trait_impl.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,9 @@ fn replacement_range(ctx: &CompletionContext, item: &SyntaxNode) -> TextRange {
242242
let first_child = item
243243
.children_with_tokens()
244244
.find(|child| {
245-
let kind = child.kind();
246-
match kind {
247-
SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR => false,
248-
_ => true,
249-
}
245+
!matches!(child.kind(), SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR)
250246
})
251-
.unwrap_or(SyntaxElement::Node(item.clone()));
247+
.unwrap_or_else(|| SyntaxElement::Node(item.clone()));
252248

253249
TextRange::new(first_child.text_range().start(), ctx.source_range().end())
254250
}

0 commit comments

Comments
 (0)