Remove TrailingToken
.
It's used in `Parser::collect_tokens_trailing_token` to decide whether to capture a trailing token. But the callers actually know whether to capture a trailing token, so it's simpler for them to just pass in a bool. Also, the `TrailingToken::Gt` case was weird, because it didn't result in a trailing token being captured. It could have been subsumed by the `TrailingToken::MaybeComma` case, and it effectively is in the new code.
This commit is contained in:
parent
4bb2f27861
commit
487802d6c8
7 changed files with 45 additions and 89 deletions
|
@ -91,16 +91,6 @@ pub enum ForceCollect {
|
|||
No,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum TrailingToken {
|
||||
None,
|
||||
Semi,
|
||||
Gt,
|
||||
/// If the trailing token is a comma, then capture it
|
||||
/// Otherwise, ignore the trailing token
|
||||
MaybeComma,
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! maybe_whole {
|
||||
($p:expr, $constructor:ident, |$x:ident| $e:expr) => {
|
||||
|
@ -1508,7 +1498,7 @@ impl<'a> Parser<'a> {
|
|||
self.collect_tokens_trailing_token(
|
||||
AttrWrapper::empty(),
|
||||
ForceCollect::Yes,
|
||||
|this, _attrs| Ok((f(this)?, TrailingToken::None)),
|
||||
|this, _attrs| Ok((f(this)?, false)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue