Uh oh!
There was an error while loading. Please reload this page.
Update functions in Result and Either to be iterator-based - #8471
Closed
bluss wants to merge 3 commits into
Closed
Conversation
added 3 commits
August 13, 2013 16:20
Remove the only use of either::partition since it was better accomplished with vector methods. Update either::partition so that it sizes the vectors correctly before it starts.
Replace these with three functions based on iterators: collect, fold, and fold_. The mapping part is replaced by iterator .map(), so the part that these functions do is to accumulate the final Result<,> value. * `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>` * `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>` * `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
bluss
commented
Aug 13, 2013
ContributorAuthor
Rebased to squash together some changes to the PR. Keep |
emberian
commented
Aug 14, 2013
Contributor
rollup candidate |
bluss
commented
Aug 14, 2013
ContributorAuthor
failed to build on win-32-nopt http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/20/steps/compile/logs/stdio |
bors added a commit
that referenced
this pull request
Aug 16, 2013
Retry of PR #8471 Replace the remaining functions marked for issue #8228 with similar functions that are iterator-based. Change `either::{lefts, rights}` to be iterator-filtering instead of returning a vector. Replace `map_vec`, `map_vec2`, `iter_vec2` in std::result with three functions: * `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>` * `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>` * `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
flip1995 pushed a commit
to flip1995/rust
that referenced
this pull request
Mar 14, 2022
new lint that detects useless match expression fixesrust-lang#7040 changelog: Add new lint [`needless_match`] under complexity lint group
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the remaining functions marked for issue #8228 with similar functions that are iterator-based.
Change
either::{lefts, rights}to be iterator-filtering instead of returning a vector.Replace
map_vec,map_vec2,iter_vec2in std::result with three functions:result::collectgathersIterator<Result<V, U>>toResult<~[V], U>result::foldfoldsIterator<Result<T, E>>toResult<V, E>result::fold_foldsIterator<Result<T, E>>toResult<(), E>