@@ -241,10 +241,10 @@ impl DeriveWhere {
241241 /// Returns `true` if the given generic type parameter if present.
242242 pub fn has_type_param ( & self , type_param : & Ident ) -> bool {
243243 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+ } ) => {
248248 if let Some ( ident) = path. get_ident ( ) {
249249 ident == type_param
250250 } else {
@@ -284,9 +284,12 @@ impl DeriveWhere {
284284 . predicates
285285 . push ( WherePredicate :: Type ( match generic {
286286 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 ( ) ,
290293 colon_token : <Token ! [ : ] >:: default ( ) ,
291294 bounds : trait_. where_bounds ( item) ,
292295 } ,
@@ -299,11 +302,19 @@ impl DeriveWhere {
299302/// Holds the first part of a [`PredicateType`] prior to the `:`. Optionally contains lifetime `for`
300303/// bindings.
301304#[ 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+ }
303311
304312impl Parse for GenericNoBound {
305313 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+ } )
307318 }
308319}
309320
0 commit comments