Skip to content

Commit 154d8e2

Browse files
killerswanbrson
authored andcommitted
---
yaml --- r: 7994 b: refs/heads/snap-stage3 c: ae0d49a h: refs/heads/master v: v3
1 parent 676e8e5 commit 154d8e2

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: fc9169f09c8999040bc2bdb313dd44fbb70472f8
4+
refs/heads/snap-stage3: ae0d49aa06c1ed73320f32896710b6d015bea9c0
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/cargo/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn rest(s: str, start: uint) -> str {
162162
if (start >= str::char_len(s)) {
163163
""
164164
} else {
165-
str::char_slice(s, start, str::char_len(s))
165+
str::slice(s, start, str::char_len(s))
166166
}
167167
}
168168

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export
3737
bytes,
3838
chars,
3939
substr,
40-
char_slice,
40+
slice,
4141
split,
4242
splitn,
4343
split_str,
@@ -427,7 +427,7 @@ fn substr(s: str, begin: uint, len: uint) -> str unsafe {
427427
}
428428

429429
/*
430-
Function: char_slice
430+
Function: slice
431431
432432
Unicode-safe slice. Returns a slice of the given string containing
433433
the characters in the range [`begin`..`end`). `begin` and `end` are
@@ -438,9 +438,9 @@ Failure:
438438
- If begin is greater than end
439439
- If end is greater than the character length of the string
440440
441-
FIXME: rename to slice(), make faster by avoiding char conversion
441+
FIXME: make faster by avoiding char conversion
442442
*/
443-
fn char_slice(s: str, begin: uint, end: uint) -> str {
443+
fn slice(s: str, begin: uint, end: uint) -> str {
444444
from_chars(vec::slice(chars(s), begin, end))
445445
}
446446

@@ -620,7 +620,7 @@ fn windowed(nn: uint, ss: str) -> [str] {
620620

621621
let ii = 0u;
622622
while ii+nn <= len {
623-
let w = char_slice( ss, ii, ii+nn );
623+
let w = slice( ss, ii, ii+nn );
624624
vec::push(ww,w);
625625
ii += 1u;
626626
}
@@ -675,8 +675,8 @@ fn replace(s: str, from: str, to: str) : is_not_empty(from) -> str unsafe {
675675
if idx == -1 {
676676
ret s;
677677
}
678-
ret char_slice(s, 0u, idx as uint) + to +
679-
replace(char_slice(s, idx as uint + char_len(from), char_len(s)),
678+
ret slice(s, 0u, idx as uint) + to +
679+
replace(slice(s, idx as uint + char_len(from), char_len(s)),
680680
from, to);
681681
}
682682
}
@@ -1658,17 +1658,17 @@ mod tests {
16581658
}
16591659

16601660
#[test]
1661-
fn test_char_slice() {
1662-
assert (eq("ab", char_slice("abc", 0u, 2u)));
1663-
assert (eq("bc", char_slice("abc", 1u, 3u)));
1664-
assert (eq("", char_slice("abc", 1u, 1u)));
1665-
assert (eq("\u65e5", char_slice("\u65e5\u672c", 0u, 1u)));
1661+
fn test_slice() {
1662+
assert (eq("ab", slice("abc", 0u, 2u)));
1663+
assert (eq("bc", slice("abc", 1u, 3u)));
1664+
assert (eq("", slice("abc", 1u, 1u)));
1665+
assert (eq("\u65e5", slice("\u65e5\u672c", 0u, 1u)));
16661666

16671667
let data = "ประเทศไทย中华";
1668-
assert (eq("ป", char_slice(data, 0u, 1u)));
1669-
assert (eq("ร", char_slice(data, 1u, 2u)));
1670-
assert (eq("华", char_slice(data, 10u, 11u)));
1671-
assert (eq("", char_slice(data, 1u, 1u)));
1668+
assert (eq("ป", slice(data, 0u, 1u)));
1669+
assert (eq("ร", slice(data, 1u, 2u)));
1670+
assert (eq("华", slice(data, 10u, 11u)));
1671+
assert (eq("", slice(data, 1u, 1u)));
16721672

16731673
fn a_million_letter_X() -> str {
16741674
let i = 0;
@@ -1683,7 +1683,7 @@ mod tests {
16831683
ret rs;
16841684
}
16851685
assert (eq(half_a_million_letter_X(),
1686-
char_slice(a_million_letter_X(), 0u, 500000u)));
1686+
slice(a_million_letter_X(), 0u, 500000u)));
16871687
}
16881688

16891689
#[test]

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn to_str(j: json) -> str {
7171

7272
fn rest(s: str) -> str {
7373
assert(str::char_len(s) >= 1u);
74-
str::char_slice(s, 1u, str::char_len(s))
74+
str::slice(s, 1u, str::char_len(s))
7575
}
7676

7777
fn from_str_str(s: str) -> (option<json>, str) {
@@ -99,7 +99,7 @@ fn from_str_str(s: str) -> (option<json>, str) {
9999
cont;
100100
} else if (c == '"') {
101101
ret (some(string(res)),
102-
str::char_slice(s, pos, str::char_len(s)));
102+
str::slice(s, pos, str::char_len(s)));
103103
}
104104
res = res + str::from_char(c);
105105
}
@@ -200,12 +200,12 @@ fn from_str_float(s: str) -> (option<json>, str) {
200200
}
201201
'.' { break; }
202202
_ { ret (some(num(neg * res)),
203-
str::char_slice(s, opos, str::char_len(s))); }
203+
str::slice(s, opos, str::char_len(s))); }
204204
}
205205
}
206206

207207
if pos == len {
208-
ret (some(num(neg * res)), str::char_slice(s, pos, str::char_len(s)));
208+
ret (some(num(neg * res)), str::slice(s, pos, str::char_len(s)));
209209
}
210210

211211
let dec = 1f;
@@ -220,25 +220,25 @@ fn from_str_float(s: str) -> (option<json>, str) {
220220
res += (((c as int) - ('0' as int)) as float) * dec;
221221
}
222222
_ { ret (some(num(neg * res)),
223-
str::char_slice(s, opos, str::char_len(s))); }
223+
str::slice(s, opos, str::char_len(s))); }
224224
}
225225
}
226-
ret (some(num(neg * res)), str::char_slice(s, pos, str::char_len(s)));
226+
ret (some(num(neg * res)), str::slice(s, pos, str::char_len(s)));
227227
}
228228

229229
fn from_str_bool(s: str) -> (option<json>, str) {
230230
if (str::starts_with(s, "true")) {
231-
(some(boolean(true)), str::char_slice(s, 4u, str::char_len(s)))
231+
(some(boolean(true)), str::slice(s, 4u, str::char_len(s)))
232232
} else if (str::starts_with(s, "false")) {
233-
(some(boolean(false)), str::char_slice(s, 5u, str::char_len(s)))
233+
(some(boolean(false)), str::slice(s, 5u, str::char_len(s)))
234234
} else {
235235
(none, s)
236236
}
237237
}
238238

239239
fn from_str_null(s: str) -> (option<json>, str) {
240240
if (str::starts_with(s, "null")) {
241-
(some(null), str::char_slice(s, 4u, str::char_len(s)))
241+
(some(null), str::slice(s, 4u, str::char_len(s)))
242242
} else {
243243
(none, s)
244244
}

branches/snap-stage3/src/rustdoc/unindent_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn unindent(s: str) -> str {
6868
line
6969
} else {
7070
assert str::byte_len(line) >= min_indent;
71-
str::char_slice(line, min_indent, str::char_len(line))
71+
str::slice(line, min_indent, str::char_len(line))
7272
}
7373
};
7474
str::connect(unindented, "\n")

0 commit comments

Comments
 (0)