File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
branches/tmp/src/libcollections Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
25
25
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26
26
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
27
27
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28
- refs/heads/tmp: e9946f99b97fa1efda39b657448aae0238b66220
28
+ refs/heads/tmp: 97f2a325644eb88b50fb5b52e09933535fa29c40
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
Original file line number Diff line number Diff line change 62
62
#![ feature( unsafe_no_drop_flag, filling_drop) ]
63
63
#![ feature( decode_utf16) ]
64
64
#![ feature( utf8_error) ]
65
- #![ cfg_attr( test, feature( rand, test) ) ]
65
+ #![ cfg_attr( test, feature( clone_from_slice , rand, test) ) ]
66
66
67
67
#![ feature( no_std) ]
68
68
#![ no_std]
Original file line number Diff line number Diff line change @@ -1007,19 +1007,15 @@ impl<T:Clone> Clone for Vec<T> {
1007
1007
1008
1008
fn clone_from ( & mut self , other : & Vec < T > ) {
1009
1009
// drop anything in self that will not be overwritten
1010
- if self . len ( ) > other. len ( ) {
1011
- self . truncate ( other. len ( ) )
1012
- }
1010
+ self . truncate ( other. len ( ) ) ;
1011
+ let len = self . len ( ) ;
1013
1012
1014
1013
// reuse the contained values' allocations/resources.
1015
- for ( place, thing) in self . iter_mut ( ) . zip ( other) {
1016
- place. clone_from ( thing)
1017
- }
1014
+ self . clone_from_slice ( & other[ ..len] ) ;
1018
1015
1019
1016
// self.len <= other.len due to the truncate above, so the
1020
1017
// slice here is always in-bounds.
1021
- let slice = & other[ self . len ( ) ..] ;
1022
- self . push_all ( slice) ;
1018
+ self . push_all ( & other[ len..] ) ;
1023
1019
}
1024
1020
}
1025
1021
You can’t perform that action at this time.
0 commit comments