Replace a try_fold in rustc_transmute to use ControlFlow instead of Result
This commit is contained in:
parent
83f081fc01
commit
39809c5f68
1 changed files with 4 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
use super::{Byte, Def, Ref};
|
use super::{Byte, Def, Ref};
|
||||||
|
use std::ops::ControlFlow;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -90,13 +91,13 @@ where
|
||||||
Tree::unit(),
|
Tree::unit(),
|
||||||
|elts, elt| {
|
|elts, elt| {
|
||||||
if elt == Tree::uninhabited() {
|
if elt == Tree::uninhabited() {
|
||||||
Err(Tree::uninhabited())
|
ControlFlow::Break(Tree::uninhabited())
|
||||||
} else {
|
} else {
|
||||||
Ok(elts.then(elt))
|
ControlFlow::Continue(elts.then(elt))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Err(node) | Ok(node) => node,
|
ControlFlow::Break(node) | ControlFlow::Continue(node) => node,
|
||||||
},
|
},
|
||||||
Self::Alt(alts) => alts
|
Self::Alt(alts) => alts
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue