From 4b6b859761d81cb90f84507cb9968673ce9af34b Mon Sep 17 00:00:00 2001 From: MentatBot <160964065+MentatBot@users.noreply.github.com> Date: Sat, 3 Aug 2024 06:16:47 +0000 Subject: [PATCH] CI fix: Fix CI failure: Adjust `from_node_binding` to accept a reference This commit addresses the CI failure by modifying the `from_node_binding` method to accept a reference to the node instead of taking ownership. This change resolves the move error encountered during the compilation of the `grit-pattern-matcher` crate. Changes include: - Updated `from_node_binding` method in `ResolvedPattern` trait to accept a reference to the node. - Adjusted calls to `from_node_binding` in `within.rs` to pass a reference. --- crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs | 2 +- crates/grit-pattern-matcher/src/pattern/within.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs b/crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs index 17b673b3c..bee1e3476 100644 --- a/crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs +++ b/crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs @@ -32,7 +32,7 @@ pub trait ResolvedPattern<'a, Q: QueryContext>: Clone + Debug + PartialEq { fn from_list_parts(parts: impl Iterator) -> Self; - fn from_node_binding(node: Q::Node<'a>) -> Self { + fn from_node_binding(node: &Q::Node<'a>) -> Self { Self::from_binding(Binding::from_node(node)) } diff --git a/crates/grit-pattern-matcher/src/pattern/within.rs b/crates/grit-pattern-matcher/src/pattern/within.rs index 1e657c366..c88fff704 100644 --- a/crates/grit-pattern-matcher/src/pattern/within.rs +++ b/crates/grit-pattern-matcher/src/pattern/within.rs @@ -53,7 +53,7 @@ impl Matcher for Within { for n in node.ancestors() { let state = cur_state.clone(); if self.pattern.execute( - &ResolvedPattern::from_node_binding(n), + &ResolvedPattern::from_node_binding(&n), &mut cur_state, context, logs, @@ -65,7 +65,7 @@ impl Matcher for Within { if let Some(until) = &self.until { if until.execute( - &ResolvedPattern::from_node_binding(n), + &ResolvedPattern::from_node_binding(&n), &mut cur_state, context, logs,