Skip to content

Commit 45ecab5

Browse files
committed
---
yaml --- r: 35983 b: refs/heads/try2 c: d9f1426 h: refs/heads/master i: 35981: 6f6f417 35979: 2041cd8 35975: 077de2d 35967: c602622 v: v3
1 parent e4d93f9 commit 45ecab5

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cf8bded7aae0673f9275de7948508da3c2b58650
8+
refs/heads/try2: d9f1426e69410f0eda9b4c1b2e87042a8bbda41d
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/libcore/str.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub pure fn connect(v: &[~str], sep: &str) -> ~str {
207207
pub fn repeat(ss: &str, nn: uint) -> ~str {
208208
let mut acc = ~"";
209209
for nn.times { acc += ss; }
210-
return acc;
210+
move acc
211211
}
212212

213213
/*
@@ -593,23 +593,23 @@ pub fn split_within(ss: &str, lim: uint) -> ~[~str] {
593593
let mut row : ~str = ~"";
594594

595595
for words.each |wptr| {
596-
let word = *wptr;
596+
let word = copy *wptr;
597597

598598
// if adding this word to the row would go over the limit,
599599
// then start a new row
600-
if str::len(row) + str::len(word) + 1 > lim {
601-
rows += [row]; // save previous row
602-
row = word; // start a new one
600+
if row.len() + word.len() + 1 > lim {
601+
rows.push(copy row); // save previous row
602+
row = move word; // start a new one
603603
} else {
604-
if str::len(row) > 0 { row += ~" " } // separate words
604+
if row.len() > 0 { row += ~" " } // separate words
605605
row += word; // append to this row
606606
}
607607
}
608608
609609
// save the last row
610-
if row != ~"" { rows += [row]; }
610+
if row != ~"" { rows.push(move row); }
611611

612-
return rows;
612+
move rows
613613
}
614614

615615

0 commit comments

Comments
 (0)