mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Simplify
This commit is contained in:
parent
65bdf84bea
commit
1fb20e3231
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…
Add table
Add a link
Reference in a new issue