Skip to content

Commit 9dd698a

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163761 b: refs/heads/master c: 30ea64e h: refs/heads/master i: 163759: 4fd75e5 v: v3
1 parent 1d9bbaf commit 9dd698a

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 47acce498a9413f3d4b24993e231393cbbcb6346
2+
refs/heads/master: 30ea64ea77dd33d0af9271b032644120b4f5166a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8443b09e361b96d1f9b7f45a65ed0d31c0e86e70
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42

trunk/src/libcore/str.rs

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,17 +1352,21 @@ pub trait StrPrelude for Sized? {
13521352
/// # Example
13531353
///
13541354
/// ```rust
1355+
/// # #![feature(unboxed_closures)]
1356+
///
1357+
/// # fn main() {
13551358
/// let v: Vec<&str> = "Mary had a little lamb".split(' ').collect();
13561359
/// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]);
13571360
///
1358-
/// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).collect();
1361+
/// let v: Vec<&str> = "abc1def2ghi".split(|&: c: char| c.is_numeric()).collect();
13591362
/// assert_eq!(v, vec!["abc", "def", "ghi"]);
13601363
///
13611364
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').collect();
13621365
/// assert_eq!(v, vec!["lion", "", "tiger", "leopard"]);
13631366
///
13641367
/// let v: Vec<&str> = "".split('X').collect();
13651368
/// assert_eq!(v, vec![""]);
1369+
/// # }
13661370
/// ```
13671371
fn split<'a, Sep: CharEq>(&'a self, sep: Sep) -> CharSplits<'a, Sep>;
13681372

@@ -1373,10 +1377,13 @@ pub trait StrPrelude for Sized? {
13731377
/// # Example
13741378
///
13751379
/// ```rust
1380+
/// # #![feature(unboxed_closures)]
1381+
///
1382+
/// # fn main() {
13761383
/// let v: Vec<&str> = "Mary had a little lambda".splitn(2, ' ').collect();
13771384
/// assert_eq!(v, vec!["Mary", "had", "a little lambda"]);
13781385
///
1379-
/// let v: Vec<&str> = "abc1def2ghi".splitn(1, |c: char| c.is_numeric()).collect();
1386+
/// let v: Vec<&str> = "abc1def2ghi".splitn(1, |&: c: char| c.is_numeric()).collect();
13801387
/// assert_eq!(v, vec!["abc", "def2ghi"]);
13811388
///
13821389
/// let v: Vec<&str> = "lionXXtigerXleopard".splitn(2, 'X').collect();
@@ -1387,6 +1394,7 @@ pub trait StrPrelude for Sized? {
13871394
///
13881395
/// let v: Vec<&str> = "".splitn(1, 'X').collect();
13891396
/// assert_eq!(v, vec![""]);
1397+
/// # }
13901398
/// ```
13911399
fn splitn<'a, Sep: CharEq>(&'a self, count: uint, sep: Sep) -> CharSplitsN<'a, Sep>;
13921400

@@ -1399,6 +1407,9 @@ pub trait StrPrelude for Sized? {
13991407
/// # Example
14001408
///
14011409
/// ```rust
1410+
/// # #![feature(unboxed_closures)]
1411+
///
1412+
/// # fn main() {
14021413
/// let v: Vec<&str> = "A.B.".split_terminator('.').collect();
14031414
/// assert_eq!(v, vec!["A", "B"]);
14041415
///
@@ -1408,11 +1419,12 @@ pub trait StrPrelude for Sized? {
14081419
/// let v: Vec<&str> = "Mary had a little lamb".split(' ').rev().collect();
14091420
/// assert_eq!(v, vec!["lamb", "little", "a", "had", "Mary"]);
14101421
///
1411-
/// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).rev().collect();
1422+
/// let v: Vec<&str> = "abc1def2ghi".split(|&: c: char| c.is_numeric()).rev().collect();
14121423
/// assert_eq!(v, vec!["ghi", "def", "abc"]);
14131424
///
14141425
/// let v: Vec<&str> = "lionXXtigerXleopard".split('X').rev().collect();
14151426
/// assert_eq!(v, vec!["leopard", "tiger", "", "lion"]);
1427+
/// # }
14161428
/// ```
14171429
fn split_terminator<'a, Sep: CharEq>(&'a self, sep: Sep) -> CharSplits<'a, Sep>;
14181430

@@ -1423,14 +1435,18 @@ pub trait StrPrelude for Sized? {
14231435
/// # Example
14241436
///
14251437
/// ```rust
1438+
/// # #![feature(unboxed_closures)]
1439+
///
1440+
/// # fn main() {
14261441
/// let v: Vec<&str> = "Mary had a little lamb".rsplitn(2, ' ').collect();
14271442
/// assert_eq!(v, vec!["lamb", "little", "Mary had a"]);
14281443
///
1429-
/// let v: Vec<&str> = "abc1def2ghi".rsplitn(1, |c: char| c.is_numeric()).collect();
1444+
/// let v: Vec<&str> = "abc1def2ghi".rsplitn(1, |&: c: char| c.is_numeric()).collect();
14301445
/// assert_eq!(v, vec!["ghi", "abc1def"]);
14311446
///
14321447
/// let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(2, 'X').collect();
14331448
/// assert_eq!(v, vec!["leopard", "tiger", "lionX"]);
1449+
/// # }
14341450
/// ```
14351451
fn rsplitn<'a, Sep: CharEq>(&'a self, count: uint, sep: Sep) -> CharSplitsN<'a, Sep>;
14361452

@@ -1641,10 +1657,14 @@ pub trait StrPrelude for Sized? {
16411657
/// # Example
16421658
///
16431659
/// ```rust
1660+
/// # #![feature(unboxed_closures)]
1661+
///
1662+
/// # fn main() {
16441663
/// assert_eq!("11foo1bar11".trim_chars('1'), "foo1bar")
16451664
/// let x: &[_] = &['1', '2'];
16461665
/// assert_eq!("12foo1bar12".trim_chars(x), "foo1bar")
1647-
/// assert_eq!("123foo1bar123".trim_chars(|c: char| c.is_numeric()), "foo1bar")
1666+
/// assert_eq!("123foo1bar123".trim_chars(|&: c: char| c.is_numeric()), "foo1bar")
1667+
/// # }
16481668
/// ```
16491669
fn trim_chars<'a, C: CharEq>(&'a self, to_trim: C) -> &'a str;
16501670

@@ -1657,10 +1677,14 @@ pub trait StrPrelude for Sized? {
16571677
/// # Example
16581678
///
16591679
/// ```rust
1680+
/// # #![feature(unboxed_closures)]
1681+
///
1682+
/// # fn main() {
16601683
/// assert_eq!("11foo1bar11".trim_left_chars('1'), "foo1bar11")
16611684
/// let x: &[_] = &['1', '2'];
16621685
/// assert_eq!("12foo1bar12".trim_left_chars(x), "foo1bar12")
1663-
/// assert_eq!("123foo1bar123".trim_left_chars(|c: char| c.is_numeric()), "foo1bar123")
1686+
/// assert_eq!("123foo1bar123".trim_left_chars(|&: c: char| c.is_numeric()), "foo1bar123")
1687+
/// # }
16641688
/// ```
16651689
fn trim_left_chars<'a, C: CharEq>(&'a self, to_trim: C) -> &'a str;
16661690

@@ -1673,10 +1697,14 @@ pub trait StrPrelude for Sized? {
16731697
/// # Example
16741698
///
16751699
/// ```rust
1700+
/// # #![feature(unboxed_closures)]
1701+
///
1702+
/// # fn main() {
16761703
/// assert_eq!("11foo1bar11".trim_right_chars('1'), "11foo1bar")
16771704
/// let x: &[_] = &['1', '2'];
16781705
/// assert_eq!("12foo1bar12".trim_right_chars(x), "12foo1bar")
1679-
/// assert_eq!("123foo1bar123".trim_right_chars(|c: char| c.is_numeric()), "123foo1bar")
1706+
/// assert_eq!("123foo1bar123".trim_right_chars(|&: c: char| c.is_numeric()), "123foo1bar")
1707+
/// # }
16801708
/// ```
16811709
fn trim_right_chars<'a, C: CharEq>(&'a self, to_trim: C) -> &'a str;
16821710

@@ -1817,17 +1845,21 @@ pub trait StrPrelude for Sized? {
18171845
/// # Example
18181846
///
18191847
/// ```rust
1848+
/// # #![feature(unboxed_closures)]
1849+
///
1850+
/// # fn main() {
18201851
/// let s = "Löwe 老虎 Léopard";
18211852
///
18221853
/// assert_eq!(s.find('L'), Some(0));
18231854
/// assert_eq!(s.find('é'), Some(14));
18241855
///
18251856
/// // the first space
1826-
/// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5));
1857+
/// assert_eq!(s.find(|&: c: char| c.is_whitespace()), Some(5));
18271858
///
18281859
/// // neither are found
18291860
/// let x: &[_] = &['1', '2'];
18301861
/// assert_eq!(s.find(x), None);
1862+
/// # }
18311863
/// ```
18321864
fn find<C: CharEq>(&self, search: C) -> Option<uint>;
18331865

@@ -1842,17 +1874,21 @@ pub trait StrPrelude for Sized? {
18421874
/// # Example
18431875
///
18441876
/// ```rust
1877+
/// # #![feature(unboxed_closures)]
1878+
///
1879+
/// # fn main() {
18451880
/// let s = "Löwe 老虎 Léopard";
18461881
///
18471882
/// assert_eq!(s.rfind('L'), Some(13));
18481883
/// assert_eq!(s.rfind('é'), Some(14));
18491884
///
18501885
/// // the second space
1851-
/// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12));
1886+
/// assert_eq!(s.rfind(|&: c: char| c.is_whitespace()), Some(12));
18521887
///
18531888
/// // searches for an occurrence of either `1` or `2`, but neither are found
18541889
/// let x: &[_] = &['1', '2'];
18551890
/// assert_eq!(s.rfind(x), None);
1891+
/// # }
18561892
/// ```
18571893
fn rfind<C: CharEq>(&self, search: C) -> Option<uint>;
18581894

0 commit comments

Comments
 (0)