Tweak a loop.
A fully imperative style is easier to read than a half-iterator, half-imperative style. Also, rename `inner_attr` as `attr` because it might be an outer attribute.
This commit is contained in:
parent
6e87858f26
commit
6ea2da5a28
1 changed files with 7 additions and 5 deletions
|
@ -297,11 +297,13 @@ impl<'a> Parser<'a> {
|
||||||
// with `None`, which means the relevant tokens will be removed. (More
|
// with `None`, which means the relevant tokens will be removed. (More
|
||||||
// details below.)
|
// details below.)
|
||||||
let mut inner_attr_replace_ranges = Vec::new();
|
let mut inner_attr_replace_ranges = Vec::new();
|
||||||
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
|
for attr in ret.attrs() {
|
||||||
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
|
if attr.style == ast::AttrStyle::Inner {
|
||||||
inner_attr_replace_ranges.push((attr_range, None));
|
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&attr.id) {
|
||||||
} else {
|
inner_attr_replace_ranges.push((attr_range, None));
|
||||||
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
|
} else {
|
||||||
|
self.dcx().span_delayed_bug(attr.span, "Missing token range for attribute");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue