]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | #[test] |
2 | fn test_borrowed_clone() { | |
85aaf69f | 3 | let x = 5; |
b039eaaf SL |
4 | let y: &i32 = &x; |
5 | let z: &i32 = (&y).clone(); | |
1a4d82fc JJ |
6 | assert_eq!(*z, 5); |
7 | } | |
8 | ||
9 | #[test] | |
10 | fn test_clone_from() { | |
85aaf69f SL |
11 | let a = box 5; |
12 | let mut b = box 10; | |
1a4d82fc JJ |
13 | b.clone_from(&a); |
14 | assert_eq!(*b, 5); | |
15 | } |