1
Fork 0

Remove unstable Result::into_ok_or_err

This commit is contained in:
David Tolnay 2022-08-15 11:11:56 -07:00
parent 9c20b2a8cc
commit 83f081fc01
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
6 changed files with 8 additions and 59 deletions

View file

@ -86,17 +86,18 @@ where
F: Fn(D) -> bool,
{
match self {
Self::Seq(elts) => elts
.into_iter()
.map(|elt| elt.prune(f))
.try_fold(Tree::unit(), |elts, elt| {
Self::Seq(elts) => match elts.into_iter().map(|elt| elt.prune(f)).try_fold(
Tree::unit(),
|elts, elt| {
if elt == Tree::uninhabited() {
Err(Tree::uninhabited())
} else {
Ok(elts.then(elt))
}
})
.into_ok_or_err(),
},
) {
Err(node) | Ok(node) => node,
},
Self::Alt(alts) => alts
.into_iter()
.map(|alt| alt.prune(f))