rust-clippy
rust-clippy copied to clipboard
Add iterator reduction coverage to never_loop
Fixes rust-lang/rust-clippy#16061.
Extend never_loop to also lint iterator reduction methods (e.g. for_each, try_for_each, fold, try_fold, reduce, all, any) when the closure’s body diverges (return type !). Add a UI test never_loop_iterator_reduction to cover these cases.
Testing:
- TESTNAME=never_loop_iterator_reduction cargo uitest
changelog: [never_loop]: lint diverging iterator reduction closures like for_each and fold