Skip to content

Commit c94576e

Browse files
authored
Rollup merge of rust-lang#132388 - frank-king:feature/where-cfg, r=petrochenkov
Implement `#[cfg]` in `where` clauses This PR implements rust-lang#115590, which supports `#[cfg]` attributes in `where` clauses. The biggest change is, that it adds `AttrsVec` and `NodeId` to the `ast::WherePredicate` and `HirId` to the `hir::WherePredicate`.
2 parents 870f395 + cac9e0a commit c94576e

File tree

1 file changed

+14
-13
lines changed
  • clippy_utils/src/ast_utils

1 file changed

+14
-13
lines changed

clippy_utils/src/ast_utils/mod.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -682,19 +682,20 @@ pub fn eq_generics(l: &Generics, r: &Generics) -> bool {
682682

683683
pub fn eq_where_predicate(l: &WherePredicate, r: &WherePredicate) -> bool {
684684
use WherePredicateKind::*;
685-
match (&l.kind, &r.kind) {
686-
(BoundPredicate(l), BoundPredicate(r)) => {
687-
over(&l.bound_generic_params, &r.bound_generic_params, |l, r| {
688-
eq_generic_param(l, r)
689-
}) && eq_ty(&l.bounded_ty, &r.bounded_ty)
690-
&& over(&l.bounds, &r.bounds, eq_generic_bound)
691-
},
692-
(RegionPredicate(l), RegionPredicate(r)) => {
693-
eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, eq_generic_bound)
694-
},
695-
(EqPredicate(l), EqPredicate(r)) => eq_ty(&l.lhs_ty, &r.lhs_ty) && eq_ty(&l.rhs_ty, &r.rhs_ty),
696-
_ => false,
697-
}
685+
over(&l.attrs, &r.attrs, eq_attr)
686+
&& match (&l.kind, &r.kind) {
687+
(BoundPredicate(l), BoundPredicate(r)) => {
688+
over(&l.bound_generic_params, &r.bound_generic_params, |l, r| {
689+
eq_generic_param(l, r)
690+
}) && eq_ty(&l.bounded_ty, &r.bounded_ty)
691+
&& over(&l.bounds, &r.bounds, eq_generic_bound)
692+
},
693+
(RegionPredicate(l), RegionPredicate(r)) => {
694+
eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, eq_generic_bound)
695+
},
696+
(EqPredicate(l), EqPredicate(r)) => eq_ty(&l.lhs_ty, &r.lhs_ty) && eq_ty(&l.rhs_ty, &r.rhs_ty),
697+
_ => false,
698+
}
698699
}
699700

700701
pub fn eq_use_tree(l: &UseTree, r: &UseTree) -> bool {

0 commit comments

Comments
 (0)