Skip to content

Commit 57a3368

Browse files
committed
---
yaml --- r: 155093 b: refs/heads/try2 c: 2c7f6ee h: refs/heads/master i: 155091: 9bd82da v: v3
1 parent 683bf61 commit 57a3368

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 7ccab3ae8aeb1b0d7002187990aaa56b1ff03d28
8+
refs/heads/try2: 2c7f6eee0c6a3d5b67e523aa5c8dc0bd27cf8c4b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)