unnecessary_fold: .any and .all may not always be safe replacements of .fold #3351
Labels
C-bug
Category: Clippy is not doing the correct thing
L-suggestion
Lint: Improving, adding or fixing lint suggestions
Uh oh!
There was an error while loading. Please reload this page.
Clippy version: 0.0.212
https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#unnecessary_fold
Both .any and .all are short-circuiting while .fold evaluates every element in the iterator, if the iterator incurs side effects these two methods will have different behavior than .fold.
For example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=893a485dc791c89d95d6ce6f744af9bf
The text was updated successfully, but these errors were encountered: