File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ pub pure fn connect(v: &[~str], sep: &str) -> ~str {
207
207
pub fn repeat( ss : & str , nn : uint ) -> ~str {
208
208
let mut acc = ~"";
209
209
for nn. times { acc += ss; }
210
- return acc;
210
+ move acc
211
211
}
212
212
213
213
/*
@@ -593,23 +593,23 @@ pub fn split_within(ss: &str, lim: uint) -> ~[~str] {
593
593
let mut row : ~str = ~"";
594
594
595
595
for words. each |wptr| {
596
- let word = * wptr;
596
+ let word = copy * wptr;
597
597
598
598
// if adding this word to the row would go over the limit,
599
599
// 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
603
603
} else {
604
- if str :: len ( row ) > 0 { row += ~" " } // separate words
604
+ if row . len ( ) > 0 { row += ~" " } // separate words
605
605
row += word; // append to this row
606
606
}
607
607
}
608
608
609
609
// save the last row
610
- if row != ~" " { rows += [ row] ; }
610
+ if row != ~" " { rows. push ( move row) ; }
611
611
612
- return rows;
612
+ move rows
613
613
}
614
614
615
615
You can’t perform that action at this time.
0 commit comments