mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Merge #8744
8744: minor: simplify r=edwin0cheng a=edwin0cheng cc #8742 bors r+ Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
3b4d5df840
1 changed files with 2 additions and 6 deletions
|
@ -242,13 +242,9 @@ fn replacement_range(ctx: &CompletionContext, item: &SyntaxNode) -> TextRange {
|
|||
let first_child = item
|
||||
.children_with_tokens()
|
||||
.find(|child| {
|
||||
let kind = child.kind();
|
||||
match kind {
|
||||
SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR => false,
|
||||
_ => true,
|
||||
}
|
||||
!matches!(child.kind(), SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR)
|
||||
})
|
||||
.unwrap_or(SyntaxElement::Node(item.clone()));
|
||||
.unwrap_or_else(|| SyntaxElement::Node(item.clone()));
|
||||
|
||||
TextRange::new(first_child.text_range().start(), ctx.source_range().end())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue