Match against attribute name when validating attributes

Extract attribute name once and match it against symbols that are being
validated, instead of using `Session::check_name` for each symbol
individually.

Assume that all validated attributes are used, instead of marking them
as such, since the attribute check should be exhaustive.
This commit is contained in:
Tomasz Miąsko 2021-04-11 00:00:00 +00:00
parent ba6275b6a9
commit 985ae0b55b
3 changed files with 46 additions and 52 deletions

View file

@ -100,6 +100,7 @@ pub struct Path {
}
impl PartialEq<Symbol> for Path {
#[inline]
fn eq(&self, symbol: &Symbol) -> bool {
self.segments.len() == 1 && { self.segments[0].ident.name == *symbol }
}