1
Fork 0

rustc_hir: don't open-code Iterator::eq

This commit is contained in:
Yotam Ofek 2025-01-28 22:27:09 +00:00
parent 3802225884
commit 1d4a419a6b

View file

@ -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,
}
}