@@ -187,13 +187,13 @@ tuple_upcast!(Vec: A, B, C, D);
187
187
#[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
188
188
pub struct Cons < T , C > ( pub T , pub C ) ;
189
189
190
- impl < T , U , V > UpcastFrom < Cons < U , Set < V > > > for Set < T >
190
+ impl < T , U , V > UpcastFrom < Cons < U , V > > for Set < T >
191
191
where
192
192
T : Ord + Clone ,
193
193
U : Upcast < T > ,
194
- V : Ord + Upcast < T > ,
194
+ V : Upcast < Set < T > > ,
195
195
{
196
- fn upcast_from ( term : Cons < U , Set < V > > ) -> Self {
196
+ fn upcast_from ( term : Cons < U , V > ) -> Self {
197
197
let Cons ( elem, set) = term;
198
198
let mut set: Set < T > = set. upcast ( ) ;
199
199
set. insert ( elem. upcast ( ) ) ;
@@ -216,16 +216,16 @@ where
216
216
}
217
217
}
218
218
219
- impl < T , U , V > UpcastFrom < Cons < U , Vec < V > > > for Vec < T >
219
+ impl < T , U , V > UpcastFrom < Cons < U , V > > for Vec < T >
220
220
where
221
221
U : Upcast < T > ,
222
- V : Upcast < T > ,
222
+ V : Upcast < Vec < T > > ,
223
223
{
224
- fn upcast_from ( term : Cons < U , Vec < V > > ) -> Self {
224
+ fn upcast_from ( term : Cons < U , V > ) -> Self {
225
225
let Cons ( elem, vec) = term;
226
- std :: iter :: once ( elem . upcast ( ) )
227
- . chain ( vec. into_iter ( ) . upcasted ( ) )
228
- . collect ( )
226
+ let mut vec : Vec < T > = vec . upcast ( ) ;
227
+ vec. insert ( 0 , elem . upcast ( ) ) ;
228
+ vec
229
229
}
230
230
}
231
231
0 commit comments