An iterator over Result<T, E>
can be collect()
-ed directly into a Result<Vec<T>, E>
; that is, your entire function can be replaced with:
let new: Result<Vec<T>, E> = v.into_iter().collect()
An iterator over Result<T, E>
can be collect()
-ed directly into a Result<Vec<T>, E>
; that is, your entire function can be replaced with:
let new: Result<Vec<T>, E> = v.into_iter().collect()