Skip to content

Commit 60509b6

Browse files
committed
---
yaml --- r: 30355 b: refs/heads/incoming c: 2d116cb h: refs/heads/master i: 30353: ceee7bd 30351: 0e8f2f1 v: v3
1 parent 3018a79 commit 60509b6

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 2ba632a683f21f306e1f71c1bd867752b93ebd3b
9+
refs/heads/incoming: 2d116cbbed3180d06446407b9cb63811853011ad
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/char.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn escape_unicode(c: char) -> ~str {
148148
str::push_str(out, str::from_char(c));
149149
for uint::range(str::len(s), pad) |_i| { str::push_str(out, ~"0"); }
150150
str::push_str(out, s);
151-
return out;
151+
move out
152152
}
153153

154154
/**

branches/incoming/src/libcore/float.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ fn to_str_common(num: float, digits: uint, exact: bool) -> ~str {
181181
} else {
182182
acc = sign + ones + ~"." + racc;
183183
}
184-
185-
return acc;
184+
move acc
186185
}
187186

188187
/**

branches/incoming/src/libcore/str.rs

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn push_char(&s: ~str, ch: char) {
228228
pure fn from_char(ch: char) -> ~str {
229229
let mut buf = ~"";
230230
unchecked { push_char(buf, ch); }
231-
return buf;
231+
move buf
232232
}
233233

234234
/// Convert a vector of chars to a string
@@ -238,7 +238,7 @@ pure fn from_chars(chs: &[char]) -> ~str {
238238
reserve(buf, chs.len());
239239
for vec::each(chs) |ch| { push_char(buf, ch); }
240240
}
241-
return buf;
241+
move buf
242242
}
243243

244244
/// Appends a string slice to the back of a string, without overallocating
@@ -281,15 +281,15 @@ pure fn append(+lhs: ~str, rhs: &str) -> ~str {
281281
unchecked {
282282
push_str_no_overallocate(v, rhs);
283283
}
284-
return v;
284+
move v
285285
}
286286

287287

288288
/// Concatenate a vector of strings
289289
pure fn concat(v: &[~str]) -> ~str {
290290
let mut s: ~str = ~"";
291291
for vec::each(v) |ss| { unchecked { push_str(s, ss) }; }
292-
return s;
292+
move s
293293
}
294294

295295
/// Concatenate a vector of strings, placing a given separator between each
@@ -299,7 +299,7 @@ pure fn connect(v: &[~str], sep: &str) -> ~str {
299299
if first { first = false; } else { unchecked { push_str(s, sep); } }
300300
unchecked { push_str(s, ss) };
301301
}
302-
return s;
302+
move s
303303
}
304304

305305
/*
@@ -436,13 +436,11 @@ Section: Transforming strings
436436
*
437437
* The result vector is not null-terminated.
438438
*/
439-
pure fn to_bytes(s: &str) -> ~[u8] {
440-
unsafe {
441-
let mut s_copy = from_slice(s);
442-
let mut v: ~[u8] = ::unsafe::transmute(s_copy);
443-
vec::unsafe::set_len(v, len(s));
444-
return v;
445-
}
439+
pure fn to_bytes(s: &str) -> ~[u8] unsafe {
440+
let mut s_copy = from_slice(s);
441+
let mut v: ~[u8] = ::unsafe::transmute(s_copy);
442+
vec::unsafe::set_len(v, len(s));
443+
move v
446444
}
447445

448446
/// Work with the string as a byte slice, not including trailing null.
@@ -462,7 +460,7 @@ pure fn chars(s: &str) -> ~[char] {
462460
unchecked { vec::push(buf, ch); }
463461
i = next;
464462
}
465-
return buf;
463+
move buf
466464
}
467465

468466
/**
@@ -539,7 +537,7 @@ pure fn split_char_inner(s: &str, sep: char, count: uint, allow_empty: bool)
539537
if allow_empty || start < l {
540538
unsafe { vec::push(result, unsafe::slice_bytes(s, start, l) ) };
541539
}
542-
result
540+
move result
543541
} else {
544542
splitn(s, |cur| cur == sep, count)
545543
}
@@ -582,7 +580,7 @@ pure fn split_inner(s: &str, sepfn: fn(cc: char) -> bool, count: uint,
582580
if allow_empty || start < l unchecked {
583581
vec::push(result, unsafe { unsafe::slice_bytes(s, start, l) });
584582
}
585-
result
583+
move result
586584
}
587585

588586
// See Issue #1932 for why this is a naive search
@@ -636,7 +634,7 @@ pure fn split_str(s: &a/str, sep: &b/str) -> ~[~str] {
636634
do iter_between_matches(s, sep) |from, to| {
637635
unsafe { vec::push(result, unsafe::slice_bytes(s, from, to)); }
638636
}
639-
result
637+
move result
640638
}
641639

642640
pure fn split_str_nonempty(s: &a/str, sep: &b/str) -> ~[~str] {
@@ -646,7 +644,7 @@ pure fn split_str_nonempty(s: &a/str, sep: &b/str) -> ~[~str] {
646644
unsafe { vec::push(result, unsafe::slice_bytes(s, from, to)); }
647645
}
648646
}
649-
result
647+
move result
650648
}
651649

652650
/**
@@ -665,7 +663,7 @@ pure fn lines_any(s: &str) -> ~[~str] {
665663
if l > 0u && s[l - 1u] == '\r' as u8 {
666664
unsafe { unsafe::set_len(cp, l - 1u); }
667665
}
668-
cp
666+
move cp
669667
})
670668
}
671669

@@ -707,7 +705,7 @@ pure fn replace(s: &str, from: &str, to: &str) -> ~str {
707705
if first { first = false; } else { unchecked {push_str(result, to); }}
708706
unsafe { push_str(result, unsafe::slice_bytes(s, start, end)); }
709707
}
710-
result
708+
move result
711709
}
712710

713711
/*
@@ -865,7 +863,7 @@ pure fn map(ss: &str, ff: fn(char) -> char) -> ~str {
865863
str::push_char(result, ff(cc));
866864
}
867865
}
868-
result
866+
move result
869867
}
870868

871869
/// Iterate over the bytes in a string
@@ -1517,7 +1515,7 @@ pure fn to_utf16(s: &str) -> ~[u16] {
15171515
vec::push_all(u, ~[w1, w2])
15181516
}
15191517
}
1520-
return u;
1518+
move u
15211519
}
15221520

15231521
pure fn utf16_chars(v: &[u16], f: fn(char)) {
@@ -1551,7 +1549,7 @@ pure fn from_utf16(v: &[u16]) -> ~str {
15511549
reserve(buf, vec::len(v));
15521550
utf16_chars(v, |ch| push_char(buf, ch));
15531551
}
1554-
return buf;
1552+
move buf
15551553
}
15561554

15571555

@@ -1931,7 +1929,7 @@ pure fn escape_default(s: &str) -> ~str {
19311929
reserve_at_least(out, str::len(s));
19321930
chars_iter(s, |c| push_str(out, char::escape_default(c)));
19331931
}
1934-
return out;
1932+
move out
19351933
}
19361934

19371935
/// Escape each char in `s` with char::escape_unicode.
@@ -1941,7 +1939,7 @@ pure fn escape_unicode(s: &str) -> ~str {
19411939
reserve_at_least(out, str::len(s));
19421940
chars_iter(s, |c| push_str(out, char::escape_unicode(c)));
19431941
}
1944-
return out;
1942+
move out
19451943
}
19461944

19471945
/// Unsafe operations

0 commit comments

Comments
 (0)