Suggest replacing Iterator::fold
with Iterator::try_fold
when appropriate
#10208
Labels
A-lint
Area: New lints
What it does
Replaces instances of
Iterator::fold
which replicate the behavior ofIterator::try_fold
Lint Name
manual_try_fold
Category
complexity, perf
Advantage
Iterator::try_fold
is more efficient, because it terminates early in theErr
/None
caseIterator::try_fold
Drawbacks
Iterator::try_fold
is newer thanIterator::fold
, so may be unfamiliar to some users or not available on projects that want to work on old versions of RustExample
Could be written as:
The text was updated successfully, but these errors were encountered: