Skip to content

Commit 6ea2da5

Browse files
committed
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.
1 parent 6e87858 commit 6ea2da5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,13 @@ impl<'a> Parser<'a> {
297297
// with `None`, which means the relevant tokens will be removed. (More
298298
// details below.)
299299
let mut inner_attr_replace_ranges = Vec::new();
300-
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
301-
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
302-
inner_attr_replace_ranges.push((attr_range, None));
303-
} else {
304-
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
300+
for attr in ret.attrs() {
301+
if attr.style == ast::AttrStyle::Inner {
302+
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&attr.id) {
303+
inner_attr_replace_ranges.push((attr_range, None));
304+
} else {
305+
self.dcx().span_delayed_bug(attr.span, "Missing token range for attribute");
306+
}
305307
}
306308
}
307309

0 commit comments

Comments
 (0)