rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.71k stars 309 forks source link

Migrate to edition 2021 #967

Open Philippe-Cholet opened 3 months ago

Philippe-Cholet commented 3 months ago

I noted 5 months ago that edition 2021 requires rustc 1.56+ so it's now possible. Is there any reason to not update?

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.72%. Comparing base (6814180) to head (8181f3f). Report is 111 commits behind head on master.

Files Patch % Lines
src/adaptors/mod.rs 91.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #967 +/- ## ========================================== + Coverage 94.38% 94.72% +0.33% ========================================== Files 48 49 +1 Lines 6665 7222 +557 ========================================== + Hits 6291 6841 +550 - Misses 374 381 +7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Philippe-Cholet commented 3 months ago

I added some marginal changes:

@jswrenn I remember your https://github.com/rust-itertools/itertools/pull/780#discussion_r1352664093 where you prefered ControlFlow over Result, I replaced some, left some aside for now. Can you elaborate on the reason?

jswrenn commented 2 months ago

I remember your #780 (comment) where you prefered ControlFlow over Result, I replaced some, left some aside for now. Can you elaborate on the reason?

Result::Err denotes "something went wrong"; ControlFlow::Break doesn't. Favor ControlFlow when we're trying to encode conditional iteration without judgement about error-ness, and favor Result when you're specifically dealing with an early return due to error.