Skip to content

Commit

Permalink
CI fix: Fix CI failure: Adjust from_node_binding to accept a reference
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mentatbot[bot] committed Aug 3, 2024
1 parent 1cd789f commit 4b6b859
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait ResolvedPattern<'a, Q: QueryContext>: Clone + Debug + PartialEq {

fn from_list_parts(parts: impl Iterator<Item = Self>) -> 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))

Check failure on line 36 in crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs

View workflow job for this annotation

GitHub Actions / clippy

type mismatch resolving `<Q as QueryContext>::Node<'_> == &<Q as QueryContext>::Node<'a>`

error[E0271]: type mismatch resolving `<Q as QueryContext>::Node<'_> == &<Q as QueryContext>::Node<'a>` --> crates/grit-pattern-matcher/src/pattern/resolved_pattern.rs:36:28 | 36 | Self::from_binding(Binding::from_node(node)) | ^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `&<Q as QueryContext>::Node<'_>` | = note: expected associated type `<Q as context::QueryContext>::Node<'_>` found reference `&<Q as context::QueryContext>::Node<'a>`
}

Expand Down
4 changes: 2 additions & 2 deletions crates/grit-pattern-matcher/src/pattern/within.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<Q: QueryContext> Matcher<Q> for Within<Q> {
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,
Expand All @@ -65,7 +65,7 @@ impl<Q: QueryContext> Matcher<Q> for Within<Q> {

if let Some(until) = &self.until {
if until.execute(
&ResolvedPattern::from_node_binding(n),
&ResolvedPattern::from_node_binding(&n),
&mut cur_state,
context,
logs,
Expand Down

0 comments on commit 4b6b859

Please sign in to comment.