Skip to content

Commit 742922a

Browse files
committed
Make expr_fallback FnMut
1 parent 4ac14f9 commit 742922a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clippy_lints/src/utils/hir_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct SpanlessEq<'a, 'tcx> {
2626
cx: &'a LateContext<'tcx>,
2727
maybe_typeck_results: Option<&'tcx TypeckResults<'tcx>>,
2828
allow_side_effects: bool,
29-
expr_fallback: Option<Box<dyn Fn(&Expr<'_>, &Expr<'_>) -> bool + 'a>>,
29+
expr_fallback: Option<Box<dyn FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a>>,
3030
}
3131

3232
impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
@@ -47,7 +47,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
4747
}
4848
}
4949

50-
pub fn expr_fallback(self, expr_fallback: impl Fn(&Expr<'_>, &Expr<'_>) -> bool + 'a) -> Self {
50+
pub fn expr_fallback(self, expr_fallback: impl FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a) -> Self {
5151
Self {
5252
expr_fallback: Some(Box::new(expr_fallback)),
5353
..self
@@ -209,7 +209,7 @@ impl HirEqInterExpr<'_, '_, '_> {
209209
(&ExprKind::DropTemps(ref le), &ExprKind::DropTemps(ref re)) => self.eq_expr(le, re),
210210
_ => false,
211211
};
212-
is_eq || self.inner.expr_fallback.as_ref().map_or(false, |f| f(left, right))
212+
is_eq || self.inner.expr_fallback.as_mut().map_or(false, |f| f(left, right))
213213
}
214214

215215
fn eq_exprs(&mut self, left: &[Expr<'_>], right: &[Expr<'_>]) -> bool {

0 commit comments

Comments
 (0)