Skip to content

Commit d53b7b8

Browse files
committed
---
yaml --- r: 63167 b: refs/heads/snap-stage3 c: ead4468 h: refs/heads/master i: 63165: 8bb0e94 63163: e500640 63159: ff1b4e2 63151: 994b31c 63135: 857188d 63103: cd6fe44 v: v3
1 parent 783d887 commit d53b7b8

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ec5a028adac360537c8f37a669eda522bd8c9b6b
4+
refs/heads/snap-stage3: ead4468249f57ca530cddf347f15c1f348c1c325
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/str.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,8 @@ pub fn with_capacity(capacity: uint) -> ~str {
11941194
* The number of Unicode characters in `s` between the given indices.
11951195
*/
11961196
pub fn count_chars(s: &str, start: uint, end: uint) -> uint {
1197-
assert!(is_char_boundary(s, start));
1198-
assert!(is_char_boundary(s, end));
1197+
assert!(s.is_char_boundary(start));
1198+
assert!(s.is_char_boundary(end));
11991199
let mut (i, len) = (start, 0u);
12001200
while i < end {
12011201
let next = s.char_range_at(i).next;
@@ -1208,7 +1208,7 @@ pub fn count_chars(s: &str, start: uint, end: uint) -> uint {
12081208
/// Counts the number of bytes taken by the first `n` chars in `s`
12091209
/// starting from `start`.
12101210
pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
1211-
assert!(is_char_boundary(s, start));
1211+
assert!(s.is_char_boundary(start));
12121212
let mut (end, cnt) = (start, n);
12131213
let l = s.len();
12141214
while cnt > 0u {
@@ -1658,7 +1658,7 @@ pub trait StrSlice<'self> {
16581658
fn trim_right_chars(&self, chars_to_trim: &[char]) -> &'self str;
16591659
fn to_owned(&self) -> ~str;
16601660
fn to_managed(&self) -> @str;
1661-
fn is_char_boundary(s: &str, index: uint) -> bool;
1661+
fn is_char_boundary(&self, index: uint) -> bool;
16621662
fn char_range_at(&self, start: uint) -> CharRange;
16631663
fn char_at(&self, i: uint) -> char;
16641664
fn char_range_at_reverse(&self, start: uint) -> CharRange;
@@ -1800,8 +1800,8 @@ impl<'self> StrSlice<'self> for &'self str {
18001800
*/
18011801
#[inline]
18021802
fn slice(&self, begin: uint, end: uint) -> &'self str {
1803-
assert!(is_char_boundary(*self, begin));
1804-
assert!(is_char_boundary(*self, end));
1803+
assert!(self.is_char_boundary(begin));
1804+
assert!(self.is_char_boundary(end));
18051805
unsafe { raw::slice_bytes(*self, begin, end) }
18061806
}
18071807
#[inline]
@@ -2284,7 +2284,7 @@ impl<'self> Iterator<char> for StrCharIterator<'self> {
22842284
#[inline]
22852285
fn next(&mut self) -> Option<char> {
22862286
if self.index < self.string.len() {
2287-
let CharRange {ch, next} = char_range_at(self.string, self.index);
2287+
let CharRange {ch, next} = self.string.char_range_at(self.index);
22882288
self.index = next;
22892289
Some(ch)
22902290
} else {
@@ -2303,7 +2303,7 @@ impl<'self> Iterator<char> for StrCharRevIterator<'self> {
23032303
#[inline]
23042304
fn next(&mut self) -> Option<char> {
23052305
if self.index > 0 {
2306-
let CharRange {ch, next} = char_range_at_reverse(self.string, self.index);
2306+
let CharRange {ch, next} = self.string.char_range_at_reverse(self.index);
23072307
self.index = next;
23082308
Some(ch)
23092309
} else {
@@ -2461,7 +2461,7 @@ mod tests {
24612461
24622462
let data = "abcabc";
24632463
assert_eq!(data.slice(0u, 6u).find_str("ab"), Some(0u));
2464-
assert_eq!(data.slice(2u, 6u).find_str("ab"), Some(3u));
2464+
assert_eq!(data.slice(2u, 6u).find_str("ab"), Some(3u - 2u));
24652465
assert!(data.slice(2u, 4u).find_str("ab").is_none());
24662466
24672467
let mut data = ~"ประเทศไทย中华Việt Nam";
@@ -3042,10 +3042,10 @@ mod tests {
30423042
30433043
#[test]
30443044
fn test_contains_char() {
3045-
assert!(contains_char("abc", 'b'));
3046-
assert!(contains_char("a", 'a'));
3047-
assert!(!contains_char("abc", 'd'));
3048-
assert!(!contains_char("", 'a'));
3045+
assert!("abc".contains_char('b'));
3046+
assert!("a".contains_char('a'));
3047+
assert!(!"abc".contains_char('d'));
3048+
assert!(!"".contains_char('a'));
30493049
}
30503050
30513051
#[test]

0 commit comments

Comments
 (0)