diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-08-15 16:21:39 -0700 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-08-17 17:20:42 -0700 |
| commit | 39809c5f68e5618dc4183cfa95499df70357e617 (patch) | |
| tree | c981a1527f301ea6ea5f5dd953687d5f788a1871 | |
| parent | 83f081fc01f3173ef17a04da3cde313fa06d8502 (diff) | |
Replace a try_fold in rustc_transmute to use ControlFlow instead of Result
| -rw-r--r-- | compiler/rustc_transmute/src/layout/tree.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 402d2c95f5f..93cab7ca533 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -1,4 +1,5 @@ use super::{Byte, Def, Ref}; +use std::ops::ControlFlow; #[cfg(test)] mod tests; @@ -90,13 +91,13 @@ where Tree::unit(), |elts, elt| { if elt == Tree::uninhabited() { - Err(Tree::uninhabited()) + ControlFlow::Break(Tree::uninhabited()) } 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 .into_iter() |
