Simplify CaptureState::inner_attr_ranges.

The `Option`s within the `ReplaceRange`s within the hashmap are always
`None`. This PR omits them and inserts them when they are extracted from
the hashmap.
This commit is contained in:
Nicholas Nethercote
2024-07-12 15:47:16 +10:00
parent 3d68afc9e8
commit 757f73f506
3 changed files with 5 additions and 5 deletions

View File

@@ -260,7 +260,7 @@ impl<'a> Parser<'a> {
// Take the captured ranges for any inner attributes that we parsed.
for inner_attr in ret.attrs().iter().filter(|a| a.style == ast::AttrStyle::Inner) {
if let Some(attr_range) = self.capture_state.inner_attr_ranges.remove(&inner_attr.id) {
inner_attr_replace_ranges.push(attr_range);
inner_attr_replace_ranges.push((attr_range, None));
} else {
self.dcx().span_delayed_bug(inner_attr.span, "Missing token range for attribute");
}