Skip to content

Commit

Permalink
Do not unconditionally clone the context on the right-hand side of pi…
Browse files Browse the repository at this point in the history
…pes.
  • Loading branch information
01mf02 committed Oct 29, 2023
1 parent 0ffea7d commit 508fd66
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jaq-interpret/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ impl<'a> FilterT<'a> for Ref<'a> {
Ast::Neg(f) => Box::new(w(f).run(cv).map(|v| -v?)),

// `l | r`
Ast::Pipe(l, false, r) => Box::new(
w(l).run((cv.0.clone(), cv.1))
.flat_map(move |y| then(y, |y| w(r).run((cv.0.clone(), y)))),
),
Ast::Pipe(l, false, r) => {
let l = w(l).run((cv.0.clone(), cv.1));
flat_map_with(l, cv.0, move |y, ctx| then(y, |y| w(r).run((ctx, y))))
}
// `l as $x | r`
Ast::Pipe(l, true, r) => w(l).pipe(cv, move |cv, y| w(r).run((cv.0.cons_var(y), cv.1))),

Expand Down

0 comments on commit 508fd66

Please sign in to comment.