move check_fold_with_op function out

This commit is contained in:
y21 2023-06-14 22:38:06 +02:00
parent 69e892e3a1
commit d102e2296c

View File

@ -52,13 +52,6 @@ struct Replacement {
has_generic_return: bool,
}
pub(super) fn check(
cx: &LateContext<'_>,
expr: &hir::Expr<'_>,
init: &hir::Expr<'_>,
acc: &hir::Expr<'_>,
fold_span: Span,
) {
fn check_fold_with_op(
cx: &LateContext<'_>,
expr: &hir::Expr<'_>,
@ -121,6 +114,13 @@ fn check_fold_with_op(
}
}
pub(super) fn check(
cx: &LateContext<'_>,
expr: &hir::Expr<'_>,
init: &hir::Expr<'_>,
acc: &hir::Expr<'_>,
fold_span: Span,
) {
// Check that this is a call to Iterator::fold rather than just some function called fold
if !is_trait_method(cx, expr, sym::Iterator) {
return;