Simplify ReplaceRange.
Currently the second element is a `Vec<(FlatToken, Spacing)>`. But the vector always has zero or one elements, and the `FlatToken` is always `FlatToken::AttrTarget` (which contains an `AttributesData`), and the spacing is always `Alone`. So we can simplify it to `Option<AttributesData>`. An assertion in `to_attr_token_stream` can can also be removed, because `new_tokens.len()` was always 0 or 1, which means than `range.len()` is always greater than or equal to it, because `range.is_empty()` is always false (as per the earlier assertion).
This commit is contained in:
@@ -313,7 +313,7 @@ impl<'a> Parser<'a> {
|
||||
// corresponding macro).
|
||||
let range = start_pos..end_pos;
|
||||
if let Capturing::Yes = self.capture_state.capturing {
|
||||
self.capture_state.inner_attr_ranges.insert(attr.id, (range, vec![]));
|
||||
self.capture_state.inner_attr_ranges.insert(attr.id, (range, None));
|
||||
}
|
||||
attrs.push(attr);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user