Skip to content

Commit

Permalink
Add usage support for WherePredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
TedDriggs committed May 22, 2018
1 parent df87133 commit 900c1c1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/src/usage/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ uses_lifetimes!(syn::LifetimeDef, lifetime, bounds);
uses_lifetimes!(syn::ParenthesizedGenericArguments, inputs, output);
uses_lifetimes!(syn::Path, segments);
uses_lifetimes!(syn::PathSegment, arguments);
uses_lifetimes!(syn::PredicateEq, lhs_ty, rhs_ty);
uses_lifetimes!(syn::PredicateLifetime, lifetime, bounds);
uses_lifetimes!(syn::PredicateType, lifetimes, bounded_ty, bounds);
uses_lifetimes!(syn::QSelf, ty);
uses_lifetimes!(syn::TraitBound, path, lifetimes);
uses_lifetimes!(syn::TypeArray, elem);
Expand Down Expand Up @@ -214,6 +217,20 @@ impl UsesLifetimes for syn::PathArguments {
}
}

impl UsesLifetimes for syn::WherePredicate {
fn uses_lifetimes<'a>(
&self,
options: &Options,
lifetimes: &'a LifetimeSet,
) -> LifetimeRefSet<'a> {
match *self {
syn::WherePredicate::Type(ref v) => v.uses_lifetimes(options, lifetimes),
syn::WherePredicate::Lifetime(ref v) => v.uses_lifetimes(options, lifetimes),
syn::WherePredicate::Eq(ref v) => v.uses_lifetimes(options, lifetimes),
}
}
}

impl UsesLifetimes for syn::GenericArgument {
fn uses_lifetimes<'a>(
&self,
Expand Down
12 changes: 12 additions & 0 deletions core/src/usage/type_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ uses_type_params!(syn::DataUnion, fields);
uses_type_params!(syn::Field, ty);
uses_type_params!(syn::FieldsNamed, named);
uses_type_params!(syn::ParenthesizedGenericArguments, inputs, output);
uses_type_params!(syn::PredicateEq, lhs_ty, rhs_ty);
uses_type_params!(syn::PredicateType, bounded_ty, bounds);
uses_type_params!(syn::QSelf, ty);
uses_type_params!(syn::TraitBound, path);
uses_type_params!(syn::TypeArray, elem);
Expand Down Expand Up @@ -190,6 +192,16 @@ impl UsesTypeParams for syn::PathArguments {
}
}

impl UsesTypeParams for syn::WherePredicate {
fn uses_type_params<'a>(&self, options: &Options, type_set: &'a IdentSet) -> IdentRefSet<'a> {
match *self {
syn::WherePredicate::Lifetime(_) => Default::default(),
syn::WherePredicate::Type(ref v) => v.uses_type_params(options, type_set),
syn::WherePredicate::Eq(ref v) => v.uses_type_params(options, type_set),
}
}
}

impl UsesTypeParams for syn::GenericArgument {
fn uses_type_params<'a>(&self, options: &Options, type_set: &'a IdentSet) -> IdentRefSet<'a> {
match *self {
Expand Down

0 comments on commit 900c1c1

Please sign in to comment.