@@ -7,8 +7,8 @@ use syn::{
77 parse:: { discouraged:: Speculative , Parse , ParseStream } ,
88 punctuated:: Punctuated ,
99 spanned:: Spanned ,
10- Attribute , Data , Ident , Meta , NestedMeta , Path , PredicateType , Result , Token , TraitBound , Type ,
11- TypeParamBound , TypePath , WhereClause , WherePredicate ,
10+ Attribute , Data , Ident , Meta , NestedMeta , Path , PredicateType , Result , Token , TraitBound ,
11+ TraitBoundModifier , Type , TypeParamBound , TypePath , WhereClause , WherePredicate ,
1212} ;
1313
1414use crate :: { util, Error , Item , Skip , Trait , TraitImpl , DERIVE_WHERE } ;
@@ -175,10 +175,10 @@ impl DeriveWhere {
175175 }
176176
177177 /// Returns selected [`DeriveTrait`] if present.
178- pub fn trait_ ( & self , trait_ : Trait ) -> Option < & DeriveTrait > {
178+ pub fn trait_ ( & self , trait_ : & Trait ) -> Option < & DeriveTrait > {
179179 self . traits
180180 . iter ( )
181- . find ( |derive_trait| * * * derive_trait == trait_)
181+ . find ( |derive_trait| & * * * derive_trait == trait_)
182182 }
183183
184184 /// Returns `true` if any [`CustomBound`](Generic::CustomBound) is present.
@@ -203,6 +203,11 @@ impl DeriveWhere {
203203 } )
204204 }
205205
206+ /// Returns `true` if any [`Trait`] supports skipping.
207+ pub fn any_skip ( & self ) -> bool {
208+ self . traits . iter ( ) . any ( |trait_| trait_. supports_skip ( ) )
209+ }
210+
206211 /// Create [`WhereClause`] for the given parameters.
207212 pub fn where_clause (
208213 & self ,
@@ -386,11 +391,12 @@ impl DeriveTrait {
386391
387392 list. push ( TypeParamBound :: Trait ( TraitBound {
388393 paren_token : None ,
389- modifier : syn :: TraitBoundModifier :: None ,
394+ modifier : TraitBoundModifier :: None ,
390395 lifetimes : None ,
391396 path : self . path ( ) ,
392397 } ) ) ;
393398
399+ // Add bounds specific to the trait.
394400 if let Some ( bound) = self . additional_where_bounds ( data) {
395401 list. push ( bound)
396402 }
0 commit comments