rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Add iterator reduction coverage to never_loop

Open cuongleqq opened this issue 1 month ago • 1 comments

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

cuongleqq avatar Dec 12 '25 03:12 cuongleqq