Skip to content

Commit 0a144f7

Browse files
committed
Use bind by-move to get the parent from the match
1 parent afe3dcd commit 0a144f7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,12 @@ fn is_consumed_lvalue(node: &SyntaxNode, local: &hir::Local, db: &RootDatabase)
675675

676676
/// Returns true if the parent nodes of `node` all match the `SyntaxKind`s in `kinds` exactly.
677677
fn parents_match(mut node: NodeOrToken<SyntaxNode, SyntaxToken>, mut kinds: &[SyntaxKind]) -> bool {
678-
while let (Some(parent), [kind, rest @ ..]) = (&node.parent(), kinds) {
678+
while let (Some(parent), [kind, rest @ ..]) = (node.parent(), kinds) {
679679
if parent.kind() != *kind {
680680
return false;
681681
}
682682

683-
// FIXME: Would be nice to get parent out of the match, but binding by-move and by-value
684-
// in the same pattern is unstable: rust-lang/rust#68354.
685-
node = node.parent().unwrap().into();
683+
node = parent.into();
686684
kinds = rest;
687685
}
688686

0 commit comments

Comments
 (0)