Skip to content

Commit 2b138b8

Browse files
committed
---
yaml --- r: 133715 b: refs/heads/try c: 2c7f6ee h: refs/heads/master i: 133713: 92b60fd 133711: d429206 v: v3
1 parent a99aa6c commit 2b138b8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e784e16840e8a0c623cc6166de26da9334db3d6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 828e075abd8ee2f8c16f6cb1b93c0d99307e704d
5-
refs/heads/try: 7ccab3ae8aeb1b0d7002187990aaa56b1ff03d28
5+
refs/heads/try: 2c7f6eee0c6a3d5b67e523aa5c8dc0bd27cf8c4b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcollections/vec.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,14 +1951,13 @@ impl<T> Vec<T> {
19511951
/// ```
19521952
/// let v = vec![0u, 1, 2];
19531953
/// let w = v.map_in_place(|i| i + 3);
1954-
/// assert_eq!(w.as_slice(), &[3, 4, 5]);
1954+
/// assert_eq!(w.as_slice(), [3, 4, 5].as_slice());
19551955
///
1956-
/// let big_endian_u16s = vec![0x1122u16, 0x3344];
1957-
/// let u8s = big_endian_u16s.map_in_place(|x| [
1958-
/// ((x >> 8) & 0xff) as u8,
1959-
/// (x & 0xff) as u8
1960-
/// ]);
1961-
/// assert_eq!(u8s.as_slice(), &[[0x11, 0x22], [0x33, 0x44]]);
1956+
/// #[deriving(PartialEq, Show)]
1957+
/// struct Newtype(u8);
1958+
/// let bytes = vec![0x11, 0x22];
1959+
/// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
1960+
/// assert_eq!(newtyped_bytes.as_slice(), [Newtype(0x11), Newtype(0x22)].as_slice());
19621961
/// ```
19631962
pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
19641963
let mut pv = PartialVec::from_vec(self);
@@ -2314,7 +2313,7 @@ mod tests {
23142313
#[test]
23152314
fn test_map_in_place() {
23162315
let v = vec![0u, 1, 2];
2317-
assert_eq!(v.map_in_place(|i: uint| i as int - 1).as_slice(), &[-1i, 0, 1]);
2316+
assert_eq!(v.map_in_place(|i: uint| i as int - 1).as_slice(), [-1i, 0, 1].as_slice());
23182317
}
23192318

23202319
#[bench]

0 commit comments

Comments
 (0)