Skip to content

Commit d9f1426

Browse files
committed
Fix copy warnings in str
1 parent cf8bded commit d9f1426

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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)