diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-03-03 10:40:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-03 10:40:56 +0100 |
| commit | c94576ed64eb3ffd2b0ec4d49b270508b0e6132d (patch) | |
| tree | ee199a2d11e6f2a94723cf51ea610e3cc3240e02 | |
| parent | 870f3952ac57f97cbb5f6d8cbd2d01e6ae3db7c5 (diff) | |
| parent | cac9e0ab60c9c3498426a2a988d23ade483139bb (diff) | |
| download | rust-c94576ed64eb3ffd2b0ec4d49b270508b0e6132d.tar.gz rust-c94576ed64eb3ffd2b0ec4d49b270508b0e6132d.zip | |
Rollup merge of #132388 - frank-king:feature/where-cfg, r=petrochenkov
Implement `#[cfg]` in `where` clauses This PR implements #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`.
| -rw-r--r-- | clippy_utils/src/ast_utils/mod.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/clippy_utils/src/ast_utils/mod.rs b/clippy_utils/src/ast_utils/mod.rs index ab5f97199ce..4f024ecaf29 100644 --- a/clippy_utils/src/ast_utils/mod.rs +++ b/clippy_utils/src/ast_utils/mod.rs @@ -682,19 +682,20 @@ pub fn eq_generics(l: &Generics, r: &Generics) -> bool { pub fn eq_where_predicate(l: &WherePredicate, r: &WherePredicate) -> bool { use WherePredicateKind::*; - match (&l.kind, &r.kind) { - (BoundPredicate(l), BoundPredicate(r)) => { - over(&l.bound_generic_params, &r.bound_generic_params, |l, r| { - eq_generic_param(l, r) - }) && eq_ty(&l.bounded_ty, &r.bounded_ty) - && over(&l.bounds, &r.bounds, eq_generic_bound) - }, - (RegionPredicate(l), RegionPredicate(r)) => { - eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, eq_generic_bound) - }, - (EqPredicate(l), EqPredicate(r)) => eq_ty(&l.lhs_ty, &r.lhs_ty) && eq_ty(&l.rhs_ty, &r.rhs_ty), - _ => false, - } + over(&l.attrs, &r.attrs, eq_attr) + && match (&l.kind, &r.kind) { + (BoundPredicate(l), BoundPredicate(r)) => { + over(&l.bound_generic_params, &r.bound_generic_params, |l, r| { + eq_generic_param(l, r) + }) && eq_ty(&l.bounded_ty, &r.bounded_ty) + && over(&l.bounds, &r.bounds, eq_generic_bound) + }, + (RegionPredicate(l), RegionPredicate(r)) => { + eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, eq_generic_bound) + }, + (EqPredicate(l), EqPredicate(r)) => eq_ty(&l.lhs_ty, &r.lhs_ty) && eq_ty(&l.rhs_ty, &r.rhs_ty), + _ => false, + } } pub fn eq_use_tree(l: &UseTree, r: &UseTree) -> bool { |
