diff options
| author | bors <bors@rust-lang.org> | 2015-03-18 17:32:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-03-18 17:32:13 +0000 |
| commit | 94a95067e017252d4928a4292a6aeef66902e694 (patch) | |
| tree | 1ead2554c428c121991282ebeae87f6609c729b2 /src/libcore | |
| parent | 46f649c479ce40f3b4590590dda6c2895e8d60f6 (diff) | |
| parent | 2a106d68f4987733b150e4a8b2f8be209ab6ae14 (diff) | |
Auto merge of #23473 - Manishearth:rollup, r=Manishearth
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/str/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index bd46b093b76..6b83338e1d2 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -18,6 +18,7 @@ use self::OldSearcher::{TwoWay, TwoWayLong}; +use char::CharExt; use clone::Clone; use cmp::{self, Eq}; use default::Default; @@ -1112,8 +1113,10 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [ /// the next `char` in a string. This can be used as a data structure /// for iterating over the UTF-8 bytes of a string. #[derive(Copy)] -#[unstable(feature = "core", - reason = "naming is uncertain with container conventions")] +#[unstable(feature = "str_char", + reason = "existence of this struct is uncertain as it is frequently \ + able to be replaced with char.len_utf8() and/or \ + char/char_indices iterators")] pub struct CharRange { /// Current `char` pub ch: char, @@ -1646,8 +1649,8 @@ impl StrExt for str { if self.is_empty() { None } else { - let CharRange {ch, next} = self.char_range_at(0); - let next_s = unsafe { self.slice_unchecked(next, self.len()) }; + let ch = self.char_at(0); + let next_s = unsafe { self.slice_unchecked(ch.len_utf8(), self.len()) }; Some((ch, next_s)) } } |
