diff options
| author | DropDemBits <r3usrlnd@gmail.com> | 2023-03-31 17:48:59 -0400 |
|---|---|---|
| committer | DropDemBits <r3usrlnd@gmail.com> | 2023-03-31 17:48:59 -0400 |
| commit | 0a144f7fffda62e2d4fe52dca41a8c39a96cce36 (patch) | |
| tree | f06869f37dd241c6a7ef5453919bb973fb15e2c2 | |
| parent | afe3dcd3ff6a5d64fc27311c2768070300c055d1 (diff) | |
| download | rust-0a144f7fffda62e2d4fe52dca41a8c39a96cce36.tar.gz rust-0a144f7fffda62e2d4fe52dca41a8c39a96cce36.zip | |
Use bind by-move to get the parent from the match
| -rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 2111baad74d..936362914ae 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -675,14 +675,12 @@ fn is_consumed_lvalue(node: &SyntaxNode, local: &hir::Local, db: &RootDatabase) /// Returns true if the parent nodes of `node` all match the `SyntaxKind`s in `kinds` exactly. fn parents_match(mut node: NodeOrToken<SyntaxNode, SyntaxToken>, mut kinds: &[SyntaxKind]) -> bool { - while let (Some(parent), [kind, rest @ ..]) = (&node.parent(), kinds) { + while let (Some(parent), [kind, rest @ ..]) = (node.parent(), kinds) { if parent.kind() != *kind { return false; } - // FIXME: Would be nice to get parent out of the match, but binding by-move and by-value - // in the same pattern is unstable: rust-lang/rust#68354. - node = node.parent().unwrap().into(); + node = parent.into(); kinds = rest; } |
