diff options
Diffstat (limited to 'library/core/tests/result.rs')
| -rw-r--r-- | library/core/tests/result.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/library/core/tests/result.rs b/library/core/tests/result.rs index 50926da3ce7..6c008ab2cb1 100644 --- a/library/core/tests/result.rs +++ b/library/core/tests/result.rs @@ -406,13 +406,14 @@ fn result_opt_conversions() { #[test] fn result_try_trait_v2_branch() { - use core::num::NonZeroU32; + use core::num::NonZero; use core::ops::{ControlFlow::*, Try}; + assert_eq!(Ok::<i32, i32>(4).branch(), Continue(4)); assert_eq!(Err::<i32, i32>(4).branch(), Break(Err(4))); - let one = NonZeroU32::new(1).unwrap(); - assert_eq!(Ok::<(), NonZeroU32>(()).branch(), Continue(())); - assert_eq!(Err::<(), NonZeroU32>(one).branch(), Break(Err(one))); - assert_eq!(Ok::<NonZeroU32, ()>(one).branch(), Continue(one)); - assert_eq!(Err::<NonZeroU32, ()>(()).branch(), Break(Err(()))); + let one = NonZero::new(1).unwrap(); + assert_eq!(Ok::<(), NonZero<u32>>(()).branch(), Continue(())); + assert_eq!(Err::<(), NonZero<u32>>(one).branch(), Break(Err(one))); + assert_eq!(Ok::<NonZero<u32>, ()>(one).branch(), Continue(one)); + assert_eq!(Err::<NonZero<u32>, ()>(()).branch(), Break(Err(()))); } |
