about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/mod.rs
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2024-07-18 05:14:07 -0500
committerGitHub <noreply@github.com>2024-07-18 05:14:07 -0500
commite2e0681e3a400558e5fd9381f76b70fbb1c4735f (patch)
treea2396ba3e64513546584725b93d3ce8a74cdb78d /compiler/rustc_parse/src/parser/mod.rs
parentd817c0f87a900c4c824aa638d26f6a6c301c7952 (diff)
parent487802d6c8a74ee375d2f71e3ff97cea11cc9c18 (diff)
downloadrust-e2e0681e3a400558e5fd9381f76b70fbb1c4735f.tar.gz
rust-e2e0681e3a400558e5fd9381f76b70fbb1c4735f.zip
Rollup merge of #127842 - nnethercote:rm-TrailingToken, r=petrochenkov
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.

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 0117f993bcb..c03527acb2c 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -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)),
         )
     }