Skip to content

Fix clippy warning about needless collect

smitop requested to merge smitop/arti:fix-clippy-warn into main

This is causing builds to fail on newer versions of Clippy when -D warnings is specified (as it is for CI). Clippy was complaining about collecting an Iterator and then turning that back into an iterator. This MR fixes it by wrapping the std::iter::Map<std::vec::IntoIter<(Attempt, E)>, fn((Attempt, E)) -> E> created as a result of the Iterator pipeline and wrapping it in a struct. The std::iter::Map<std::vec::IntoIter<(Attempt, E)>, fn((Attempt, E)) -> E> can't be returned directly since that would leak the private Attempt type, which is disallowed. Also, closures are opaque types, so the closure is turned into a private inner function.

Merge request reports