Skip to content

Commit 232528a

Browse files
committed
Refactor where predicates, and reserve for attributes support
1 parent b116480 commit 232528a

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/spanned.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ impl Spanned for ast::FieldDef {
150150

151151
impl Spanned for ast::WherePredicate {
152152
fn span(&self) -> Span {
153-
match *self {
154-
ast::WherePredicate::BoundPredicate(ref p) => p.span,
155-
ast::WherePredicate::RegionPredicate(ref p) => p.span,
156-
ast::WherePredicate::EqPredicate(ref p) => p.span,
157-
}
153+
self.span
158154
}
159155
}
160156

src/types.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ impl Rewrite for ast::WherePredicate {
463463

464464
fn rewrite_result(&self, context: &RewriteContext<'_>, shape: Shape) -> RewriteResult {
465465
// FIXME: dead spans?
466-
let result = match *self {
467-
ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {
466+
let result = match self.kind {
467+
ast::WherePredicateKind::BoundPredicate(ast::WhereBoundPredicate {
468468
ref bound_generic_params,
469469
ref bounded_ty,
470470
ref bounds,
@@ -482,12 +482,11 @@ impl Rewrite for ast::WherePredicate {
482482

483483
rewrite_assign_rhs(context, lhs, bounds, &RhsAssignKind::Bounds, shape)?
484484
}
485-
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate {
485+
ast::WherePredicateKind::RegionPredicate(ast::WhereRegionPredicate {
486486
ref lifetime,
487487
ref bounds,
488-
span,
489-
}) => rewrite_bounded_lifetime(lifetime, bounds, span, context, shape)?,
490-
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate {
488+
}) => rewrite_bounded_lifetime(lifetime, bounds, self.span, context, shape)?,
489+
ast::WherePredicateKind::EqPredicate(ast::WhereEqPredicate {
491490
ref lhs_ty,
492491
ref rhs_ty,
493492
..

0 commit comments

Comments
 (0)