about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-10-17 13:47:24 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-10-17 13:47:45 -0700
commitd9f1426e69410f0eda9b4c1b2e87042a8bbda41d (patch)
tree612fec38f0d49377f7386141befc83ad5994b2fb /src/libcore
parentcf8bded7aae0673f9275de7948508da3c2b58650 (diff)
Fix copy warnings in str
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/str.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index da1defc38b1..abd9621cf0f 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -207,7 +207,7 @@ pub pure fn connect(v: &[~str], sep: &str) -> ~str {
 pub fn repeat(ss: &str, nn: uint) -> ~str {
     let mut acc = ~"";
     for nn.times { acc += ss; }
-    return acc;
+    move acc
 }
 
 /*
@@ -593,23 +593,23 @@ pub fn split_within(ss: &str, lim: uint) -> ~[~str] {
     let mut row  : ~str    = ~"";
 
     for words.each |wptr| {
-        let word = *wptr;
+        let word = copy *wptr;
 
         // if adding this word to the row would go over the limit,
         // then start a new row
-        if str::len(row) + str::len(word) + 1 > lim {
-            rows += [row]; // save previous row
-            row = word;    // start a new one
+        if row.len() + word.len() + 1 > lim {
+            rows.push(copy row); // save previous row
+            row = move word;    // start a new one
         } else {
-            if str::len(row) > 0 { row += ~" " } // separate words
+            if row.len() > 0 { row += ~" " } // separate words
             row += word;  // append to this row
         }
     }
 
     // save the last row
-    if row != ~"" { rows += [row]; }
+    if row != ~"" { rows.push(move row); }
 
-    return rows;
+    move rows
 }