simplify parse_inner_attributes
This commit is contained in:
parent
c303c4463c
commit
883e90dd81
1 changed files with 2 additions and 6 deletions
|
@ -201,12 +201,8 @@ impl<'a> Parser<'a> {
|
||||||
let mut attrs: Vec<ast::Attribute> = vec![];
|
let mut attrs: Vec<ast::Attribute> = vec![];
|
||||||
loop {
|
loop {
|
||||||
match self.token.kind {
|
match self.token.kind {
|
||||||
token::Pound => {
|
// Only try to parse if it is an inner attribute (has `!`).
|
||||||
// Don't even try to parse if it's not an inner attribute.
|
token::Pound if self.look_ahead(1, |t| t == &token::Not) => {
|
||||||
if !self.look_ahead(1, |t| t == &token::Not) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let attr = self.parse_attribute(true)?;
|
let attr = self.parse_attribute(true)?;
|
||||||
assert_eq!(attr.style, ast::AttrStyle::Inner);
|
assert_eq!(attr.style, ast::AttrStyle::Inner);
|
||||||
attrs.push(attr);
|
attrs.push(attr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue