@@ -241,10 +241,10 @@ impl DeriveWhere {
241
241
/// Returns `true` if the given generic type parameter if present.
242
242
pub fn has_type_param ( & self , type_param : & Ident ) -> bool {
243
243
self . generics . iter ( ) . any ( |generic| match generic {
244
- Generic :: NoBound ( GenericNoBound (
245
- _lifetimes ,
246
- Type :: Path ( TypePath { qself : None , path } ) ,
247
- ) ) => {
244
+ Generic :: NoBound ( GenericNoBound {
245
+ lifetimes : _ ,
246
+ ty : Type :: Path ( TypePath { qself : None , path } ) ,
247
+ } ) => {
248
248
if let Some ( ident) = path. get_ident ( ) {
249
249
ident == type_param
250
250
} else {
@@ -284,9 +284,12 @@ impl DeriveWhere {
284
284
. predicates
285
285
. push ( WherePredicate :: Type ( match generic {
286
286
Generic :: CustomBound ( type_bound) => type_bound. clone ( ) ,
287
- Generic :: NoBound ( GenericNoBound ( lifetimes, path) ) => PredicateType {
288
- lifetimes : lifetimes. clone ( ) ,
289
- bounded_ty : path. clone ( ) ,
287
+ Generic :: NoBound ( GenericNoBound {
288
+ lifetimes : bound_lifetimes,
289
+ ty,
290
+ } ) => PredicateType {
291
+ lifetimes : bound_lifetimes. clone ( ) ,
292
+ bounded_ty : ty. clone ( ) ,
290
293
colon_token : <Token ! [ : ] >:: default ( ) ,
291
294
bounds : trait_. where_bounds ( item) ,
292
295
} ,
@@ -299,11 +302,19 @@ impl DeriveWhere {
299
302
/// Holds the first part of a [`PredicateType`] prior to the `:`. Optionally contains lifetime `for`
300
303
/// bindings.
301
304
#[ derive( Eq , PartialEq ) ]
302
- pub struct GenericNoBound ( Option < BoundLifetimes > , Type ) ;
305
+ pub struct GenericNoBound {
306
+ /// Any `for<'a, 'b, 'etc>` bindings for the type.
307
+ lifetimes : Option < BoundLifetimes > ,
308
+ /// The type bound to the [`DeriveTrait`].
309
+ ty : Type ,
310
+ }
303
311
304
312
impl Parse for GenericNoBound {
305
313
fn parse ( input : ParseStream ) -> Result < Self > {
306
- Ok ( Self ( input. parse ( ) ?, input. parse ( ) ?) )
314
+ Ok ( Self {
315
+ lifetimes : input. parse ( ) ?,
316
+ ty : input. parse ( ) ?,
317
+ } )
307
318
}
308
319
}
309
320
0 commit comments