diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index ad096630127c..66945ad251f1 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -219,7 +219,6 @@ fn test_ord() { assert!(big > None); } -/* FIXME(#20575) #[test] fn test_collect() { let v: Option> = (0..0).map(|_| Some(0)).collect(); @@ -241,28 +240,26 @@ fn test_collect() { assert!(v == None); } -*/ + #[test] fn test_cloned() { - let val1 = 1u32; - let mut val2 = 2u32; - let val1_ref = &val1; + let val = 1u32; + let val_ref = &val; let opt_none: Option<&'static u32> = None; - let opt_ref = Some(&val1); - let opt_ref_ref = Some(&val1_ref); - let opt_mut_ref = Some(&mut val2); + let opt_ref = Some(&val); + let opt_ref_ref = Some(&val_ref); // None works assert_eq!(opt_none.clone(), None); assert_eq!(opt_none.cloned(), None); // Immutable ref works - assert_eq!(opt_ref.clone(), Some(&val1)); + assert_eq!(opt_ref.clone(), Some(&val)); assert_eq!(opt_ref.cloned(), Some(1u32)); // Double Immutable ref works - assert_eq!(opt_ref_ref.clone(), Some(&val1_ref)); - assert_eq!(opt_ref_ref.clone().cloned(), Some(&val1)); + assert_eq!(opt_ref_ref.clone(), Some(&val_ref)); + assert_eq!(opt_ref_ref.clone().cloned(), Some(&val)); assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32)); } diff --git a/src/libcoretest/result.rs b/src/libcoretest/result.rs index ac8c2b953ae9..3fdb10287533 100644 --- a/src/libcoretest/result.rs +++ b/src/libcoretest/result.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn op1() -> Result { Ok(666) } -pub fn op2() -> Result { Err("sadface") } +fn op1() -> Result { Ok(666) } +fn op2() -> Result { Err("sadface") } #[test] -pub fn test_and() { +fn test_and() { assert_eq!(op1().and(Ok(667)).unwrap(), 667); assert_eq!(op1().and(Err::("bad")).unwrap_err(), "bad"); @@ -23,7 +23,7 @@ pub fn test_and() { } #[test] -pub fn test_and_then() { +fn test_and_then() { assert_eq!(op1().and_then(|i| Ok::(i + 1)).unwrap(), 667); assert_eq!(op1().and_then(|_| Err::("bad")).unwrap_err(), "bad"); @@ -35,7 +35,7 @@ pub fn test_and_then() { } #[test] -pub fn test_or() { +fn test_or() { assert_eq!(op1().or(Ok::<_, &'static str>(667)).unwrap(), 666); assert_eq!(op1().or(Err("bad")).unwrap(), 666); @@ -44,7 +44,7 @@ pub fn test_or() { } #[test] -pub fn test_or_else() { +fn test_or_else() { assert_eq!(op1().or_else(|_| Ok::(667)).unwrap(), 666); assert_eq!(op1().or_else(|e| Err::(e)).unwrap(), 666); @@ -54,18 +54,17 @@ pub fn test_or_else() { } #[test] -pub fn test_impl_map() { +fn test_impl_map() { assert!(Ok::(1).map(|x| x + 1) == Ok(2)); assert!(Err::(1).map(|x| x + 1) == Err(1)); } #[test] -pub fn test_impl_map_err() { +fn test_impl_map_err() { assert!(Ok::(1).map_err(|x| x + 1) == Ok(1)); assert!(Err::(1).map_err(|x| x + 1) == Err(2)); } -/* FIXME(#20575) #[test] fn test_collect() { let v: Result, ()> = (0..0).map(|_| Ok::(0)).collect(); @@ -86,10 +85,9 @@ fn test_collect() { let v: Result, isize> = functions.iter_mut().map(|f| (*f)()).collect(); assert!(v == Err(1)); } -*/ #[test] -pub fn test_fmt_default() { +fn test_fmt_default() { let ok: Result = Ok(100); let err: Result = Err("Err"); @@ -100,7 +98,7 @@ pub fn test_fmt_default() { } #[test] -pub fn test_unwrap_or() { +fn test_unwrap_or() { let ok: Result = Ok(100); let ok_err: Result = Err("Err"); @@ -109,7 +107,7 @@ pub fn test_unwrap_or() { } #[test] -pub fn test_unwrap_or_else() { +fn test_unwrap_or_else() { fn handler(msg: &'static str) -> isize { if msg == "I got this." { 50