@@ -133,7 +133,7 @@ pub fn push_char(s: &mut ~str, ch: char) {
133
133
pub pure fn from_char ( ch : char ) -> ~str {
134
134
let mut buf = ~"";
135
135
unsafe { push_char ( & mut buf, ch) ; }
136
- move buf
136
+ buf
137
137
}
138
138
139
139
/// Convert a vector of chars to a string
@@ -145,7 +145,7 @@ pub pure fn from_chars(chs: &[char]) -> ~str {
145
145
push_char( & mut buf, * ch) ;
146
146
}
147
147
}
148
- move buf
148
+ buf
149
149
}
150
150
151
151
/// Appends a string slice to the back of a string, without overallocating
@@ -186,11 +186,11 @@ pub fn push_str(lhs: &mut ~str, rhs: &str) {
186
186
/// Concatenate two strings together
187
187
#[ inline( always) ]
188
188
pub pure fn append ( lhs : ~str , rhs : & str ) -> ~str {
189
- let mut v = move lhs;
189
+ let mut v = lhs;
190
190
unsafe {
191
191
push_str_no_overallocate ( & mut v, rhs) ;
192
192
}
193
- move v
193
+ v
194
194
}
195
195
196
196
@@ -200,7 +200,7 @@ pub pure fn concat(v: &[~str]) -> ~str {
200
200
for vec:: each( v) |ss| {
201
201
unsafe { push_str ( & mut s, * ss) } ;
202
202
}
203
- move s
203
+ s
204
204
}
205
205
206
206
/// Concatenate a vector of strings, placing a given separator between each
@@ -210,14 +210,14 @@ pub pure fn connect(v: &[~str], sep: &str) -> ~str {
210
210
if first { first = false ; } else { unsafe { push_str ( & mut s, sep) ; } }
211
211
unsafe { push_str ( & mut s, * ss) } ;
212
212
}
213
- move s
213
+ s
214
214
}
215
215
216
216
/// Given a string, make a new string with repeated copies of it
217
217
pub fn repeat( ss : & str , nn : uint ) -> ~str {
218
218
let mut acc = ~"";
219
219
for nn. times { acc += ss; }
220
- move acc
220
+ acc
221
221
}
222
222
223
223
/*
@@ -359,7 +359,7 @@ Section: Transforming strings
359
359
pub pure fn to_bytes ( s : & str ) -> ~[ u8 ] unsafe {
360
360
let mut v: ~[ u8 ] = :: cast:: transmute ( from_slice ( s) ) ;
361
361
vec:: raw:: set_len ( & mut v, len ( s) ) ;
362
- move v
362
+ v
363
363
}
364
364
365
365
/// Work with the string as a byte slice, not including trailing null.
@@ -379,7 +379,7 @@ pub pure fn chars(s: &str) -> ~[char] {
379
379
unsafe { buf. push ( ch) ; }
380
380
i = next;
381
381
}
382
- move buf
382
+ buf
383
383
}
384
384
385
385
/**
@@ -455,7 +455,7 @@ pure fn split_char_inner(s: &str, sep: char, count: uint, allow_empty: bool)
455
455
if allow_empty || start < l {
456
456
unsafe { result. push ( raw:: slice_bytes ( s, start, l) ) } ;
457
457
}
458
- move result
458
+ result
459
459
} else {
460
460
splitn ( s, |cur| cur == sep, count)
461
461
}
@@ -498,7 +498,7 @@ pure fn split_inner(s: &str, sepfn: fn(cc: char) -> bool, count: uint,
498
498
if allow_empty || start < l unsafe {
499
499
result. push ( unsafe { raw:: slice_bytes ( s, start, l) } ) ;
500
500
}
501
- move result
501
+ result
502
502
}
503
503
504
504
// See Issue #1932 for why this is a naive search
@@ -552,7 +552,7 @@ pub pure fn split_str(s: &a/str, sep: &b/str) -> ~[~str] {
552
552
do iter_between_matches ( s, sep) |from, to| {
553
553
unsafe { result. push ( raw:: slice_bytes ( s, from, to) ) ; }
554
554
}
555
- move result
555
+ result
556
556
}
557
557
558
558
pub pure fn split_str_nonempty ( s : & a/str , sep : & b/str ) -> ~[ ~str ] {
@@ -562,7 +562,7 @@ pub pure fn split_str_nonempty(s: &a/str, sep: &b/str) -> ~[~str] {
562
562
unsafe { result. push ( raw:: slice_bytes ( s, from, to) ) ; }
563
563
}
564
564
}
565
- move result
565
+ result
566
566
}
567
567
568
568
/**
@@ -581,7 +581,7 @@ pub pure fn lines_any(s: &str) -> ~[~str] {
581
581
if l > 0 u && s[ l - 1 u] == '\r' as u8 {
582
582
unsafe { raw:: set_len ( & mut cp, l - 1 u) ; }
583
583
}
584
- move cp
584
+ cp
585
585
} )
586
586
}
587
587
@@ -609,17 +609,17 @@ pub fn split_within(ss: &str, lim: uint) -> ~[~str] {
609
609
// then start a new row
610
610
if row. len ( ) + word. len ( ) + 1 > lim {
611
611
rows. push ( copy row) ; // save previous row
612
- row = move word; // start a new one
612
+ row = word; // start a new one
613
613
} else {
614
614
if row. len ( ) > 0 { row += ~" " } // separate words
615
615
row += word; // append to this row
616
616
}
617
617
}
618
618
619
619
// save the last row
620
- if row != ~" " { rows. push ( move row) ; }
620
+ if row != ~" " { rows. push ( row) ; }
621
621
622
- move rows
622
+ rows
623
623
}
624
624
625
625
@@ -661,7 +661,7 @@ pub pure fn replace(s: &str, from: &str, to: &str) -> ~str {
661
661
}
662
662
unsafe { push_str ( & mut result, raw:: slice_bytes ( s, start, end) ) ; }
663
663
}
664
- move result
664
+ result
665
665
}
666
666
667
667
/*
@@ -840,7 +840,7 @@ pub pure fn map(ss: &str, ff: fn(char) -> char) -> ~str {
840
840
str:: push_char( & mut result, ff( cc) ) ;
841
841
}
842
842
}
843
- move result
843
+ result
844
844
}
845
845
846
846
/// Iterate over the bytes in a string
@@ -1493,7 +1493,7 @@ pub pure fn to_utf16(s: &str) -> ~[u16] {
1493
1493
u. push_all ( ~[ w1, w2] )
1494
1494
}
1495
1495
}
1496
- move u
1496
+ u
1497
1497
}
1498
1498
1499
1499
pub pure fn utf16_chars ( v: & [ u16] , f : fn ( char) ) {
@@ -1527,13 +1527,13 @@ pub pure fn from_utf16(v: &[u16]) -> ~str {
1527
1527
reserve ( & mut buf, vec:: len ( v) ) ;
1528
1528
utf16_chars ( v, |ch| push_char ( & mut buf, ch) ) ;
1529
1529
}
1530
- move buf
1530
+ buf
1531
1531
}
1532
1532
1533
1533
pub pure fn with_capacity ( capacity : uint ) -> ~str {
1534
1534
let mut buf = ~"";
1535
1535
unsafe { reserve ( & mut buf, capacity) ; }
1536
- move buf
1536
+ buf
1537
1537
}
1538
1538
1539
1539
/**
@@ -1921,7 +1921,7 @@ pub pure fn escape_default(s: &str) -> ~str {
1921
1921
push_str( & mut out, char:: escape_default( c) ) ;
1922
1922
}
1923
1923
}
1924
- move out
1924
+ out
1925
1925
}
1926
1926
1927
1927
/// Escape each char in `s` with char::escape_unicode.
@@ -1933,7 +1933,7 @@ pub pure fn escape_unicode(s: &str) -> ~str {
1933
1933
push_str( & mut out, char:: escape_unicode( c) ) ;
1934
1934
}
1935
1935
}
1936
- move out
1936
+ out
1937
1937
}
1938
1938
1939
1939
/// Unsafe operations
@@ -1959,7 +1959,7 @@ pub mod raw {
1959
1959
v. push ( 0u8 ) ;
1960
1960
1961
1961
assert is_utf8( v) ;
1962
- return :: cast:: transmute ( move v) ;
1962
+ return :: cast:: transmute ( v) ;
1963
1963
}
1964
1964
1965
1965
/// Create a Rust string from a null-terminated C string
@@ -1987,7 +1987,7 @@ pub mod raw {
1987
1987
f : fn ( v : & str ) -> T ) -> T {
1988
1988
let v = ( buf, len + 1 ) ;
1989
1989
assert is_utf8( :: cast:: reinterpret_cast ( & v) ) ;
1990
- f ( :: cast:: transmute ( move v) )
1990
+ f ( :: cast:: transmute ( v) )
1991
1991
}
1992
1992
1993
1993
/**
@@ -2014,7 +2014,7 @@ pub mod raw {
2014
2014
}
2015
2015
vec:: raw:: set_len ( & mut v, end - begin) ;
2016
2016
v. push ( 0u8 ) ;
2017
- :: cast:: transmute ( move v)
2017
+ :: cast:: transmute ( v)
2018
2018
}
2019
2019
}
2020
2020
}
@@ -2667,13 +2667,13 @@ mod tests {
2667
2667
let mut i = 0 ;
2668
2668
let mut rs = ~"";
2669
2669
while i < 100000 { push_str ( & mut rs, ~"aaaaaaaaaa") ; i += 1 ; }
2670
- move rs
2670
+ rs
2671
2671
}
2672
2672
fn half_a_million_letter_a ( ) -> ~str {
2673
2673
let mut i = 0 ;
2674
2674
let mut rs = ~"";
2675
2675
while i < 100000 { push_str ( & mut rs, ~"aaaaa") ; i += 1 ; }
2676
- move rs
2676
+ rs
2677
2677
}
2678
2678
assert half_a_million_letter_a ( ) ==
2679
2679
raw:: slice_bytes ( a_million_letter_a ( ) , 0 u, 500000 ) ;
@@ -2780,13 +2780,13 @@ mod tests {
2780
2780
push_str ( & mut rs, ~"华华华华华华华华华华") ;
2781
2781
i += 1 ;
2782
2782
}
2783
- move rs
2783
+ rs
2784
2784
}
2785
2785
fn half_a_million_letter_X ( ) -> ~str {
2786
2786
let mut i = 0 ;
2787
2787
let mut rs = ~"";
2788
2788
while i < 100000 { push_str ( & mut rs, ~"华华华华华") ; i += 1 ; }
2789
- move rs
2789
+ rs
2790
2790
}
2791
2791
assert half_a_million_letter_X ( ) ==
2792
2792
slice ( a_million_letter_X ( ) , 0 u, 3 u * 500000 u) ;
0 commit comments