@@ -248,10 +248,10 @@ pure fn build_sized_opt<A,B: Buildable<A>>(
248
248
// Functions that combine iteration and building
249
249
250
250
/// Apply a function to each element of an iterable and return the results
251
- fn map < T , IT : BaseIter < T > , U , BU : Buildable < U > > ( v : IT , f : fn ( T ) -> U ) -> BU {
251
+ fn map < T , IT : BaseIter < T > , U , BU : Buildable < U > > ( v : & IT , f : fn ( & T ) -> U ) -> BU {
252
252
do build_sized_opt ( v. size_hint ( ) ) |push| {
253
253
for v. each( ) |elem| {
254
- push ( f ( * elem) ) ;
254
+ push( f( elem) ) ;
255
255
}
256
256
}
257
257
}
@@ -275,17 +275,17 @@ pure fn from_fn<T,BT: Buildable<T>>(n_elts: uint, op: InitOp<T>) -> BT {
275
275
* Creates an immutable vector of size `n_elts` and initializes the elements
276
276
* to the value `t`.
277
277
*/
278
- pure fn from_elem < T : Copy , BT : Buildable < T > > ( n_elts : uint , t : T ) -> BT {
278
+ pure fn from_elem < T : Copy , BT : Buildable < T > > ( n_elts : uint , + t : T ) -> BT {
279
279
do build_sized ( n_elts) |push| {
280
- let mut i: uint = 0 u ;
281
- while i < n_elts { push ( t) ; i += 1 u ; }
280
+ let mut i: uint = 0 ;
281
+ while i < n_elts { push ( t) ; i += 1 ; }
282
282
}
283
283
}
284
284
285
285
/// Appending two generic sequences
286
286
#[ inline( always) ]
287
287
pure fn append < T : Copy , IT : BaseIter < T > , BT : Buildable < T > > (
288
- lhs : IT , rhs : IT ) -> BT {
288
+ lhs : & IT , rhs : & IT ) -> BT {
289
289
let size_opt = lhs. size_hint ( ) . chain_ref (
290
290
|sz1| rhs. size_hint ( ) . map ( |sz2| * sz1+* sz2) ) ;
291
291
do build_sized_opt ( size_opt) |push| {
@@ -298,7 +298,7 @@ pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
298
298
/// type of sequence.
299
299
#[ inline( always) ]
300
300
pure fn copy_seq < T : Copy , IT : BaseIter < T > , BT : Buildable < T > > (
301
- v : IT ) -> BT {
301
+ v : & IT ) -> BT {
302
302
do build_sized_opt ( v. size_hint ( ) ) |push| {
303
303
for v. each |x| { push ( * x) ; }
304
304
}
0 commit comments