about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYotam Ofek <yotam.ofek@gmail.com>2025-01-28 22:27:09 +0000
committerYotam Ofek <yotam.ofek@gmail.com>2025-01-28 22:27:09 +0000
commit1d4a419a6ba5f293d054eae64eca6a1a19b76756 (patch)
tree0f0e19fe9b44d01f089a05262bed74d3c864ca09
parent380222588442bd97bb2887d90337d235627bd073 (diff)
downloadrust-1d4a419a6ba5f293d054eae64eca6a1a19b76756.tar.gz
rust-1d4a419a6ba5f293d054eae64eca6a1a19b76756.zip
rustc_hir: don't open-code `Iterator::eq`
-rw-r--r--compiler/rustc_hir/src/hir.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index 5c8e81a1414..5745f81db79 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,
         }
     }