From 1d4a419a6ba5f293d054eae64eca6a1a19b76756 Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Tue, 28 Jan 2025 22:27:09 +0000 Subject: [PATCH] rustc_hir: don't open-code `Iterator::eq` --- compiler/rustc_hir/src/hir.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 5c8e81a14141..5745f81db796 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1101,10 +1101,7 @@ impl AttributeExt for Attribute { fn path_matches(&self, name: &[Symbol]) -> bool { match &self.kind { - AttrKind::Normal(n) => { - n.path.segments.len() == name.len() - && n.path.segments.iter().zip(name).all(|(s, n)| s.name == *n) - } + AttrKind::Normal(n) => n.path.segments.iter().map(|segment| &segment.name).eq(name), AttrKind::DocComment(..) => false, } }