Remove unused variable

This commit is contained in:
Tamir Duberstein 2015-04-28 21:22:06 -07:00
parent c48b499ea3
commit cd5abe7635

View file

@ -245,24 +245,22 @@ fn test_collect() {
#[test] #[test]
fn test_cloned() { fn test_cloned() {
let val1 = 1u32; let val = 1u32;
let mut val2 = 2u32; let val_ref = &val;
let val1_ref = &val1;
let opt_none: Option<&'static u32> = None; let opt_none: Option<&'static u32> = None;
let opt_ref = Some(&val1); let opt_ref = Some(&val);
let opt_ref_ref = Some(&val1_ref); let opt_ref_ref = Some(&val_ref);
let opt_mut_ref = Some(&mut val2);
// None works // None works
assert_eq!(opt_none.clone(), None); assert_eq!(opt_none.clone(), None);
assert_eq!(opt_none.cloned(), None); assert_eq!(opt_none.cloned(), None);
// Immutable ref works // Immutable ref works
assert_eq!(opt_ref.clone(), Some(&val1)); assert_eq!(opt_ref.clone(), Some(&val));
assert_eq!(opt_ref.cloned(), Some(1u32)); assert_eq!(opt_ref.cloned(), Some(1u32));
// Double Immutable ref works // Double Immutable ref works
assert_eq!(opt_ref_ref.clone(), Some(&val1_ref)); assert_eq!(opt_ref_ref.clone(), Some(&val_ref));
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val1)); assert_eq!(opt_ref_ref.clone().cloned(), Some(&val));
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32)); assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32));
} }