about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/mod.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-08-06 10:17:46 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-08-16 09:07:29 +1000
commitc8098be41fa767a96cfb3665147fabf06f456be9 (patch)
treee2182b48301ad031e61d0527f91792750a0fcc04 /compiler/rustc_parse/src/parser/mod.rs
parent55906aa2407b10b4f910c221be6f40e549780bb8 (diff)
downloadrust-c8098be41fa767a96cfb3665147fabf06f456be9.tar.gz
rust-c8098be41fa767a96cfb3665147fabf06f456be9.zip
Convert a bool to `Trailing`.
This pre-existing type is suitable for use with the return value of the
`f` parameter in `collect_tokens_trailing_token`. The more descriptive
name will be useful because the next commit will add another boolean
value to the return value of `f`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index db74ea62790..05758fe0624 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -388,6 +388,12 @@ enum Trailing {
     Yes,
 }
 
+impl From<bool> for Trailing {
+    fn from(b: bool) -> Trailing {
+        if b { Trailing::Yes } else { Trailing::No }
+    }
+}
+
 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
 pub(super) enum TokenDescription {
     ReservedIdentifier,
@@ -1549,7 +1555,7 @@ impl<'a> Parser<'a> {
         self.collect_tokens_trailing_token(
             AttrWrapper::empty(),
             ForceCollect::Yes,
-            |this, _attrs| Ok((f(this)?, false)),
+            |this, _attrs| Ok((f(this)?, Trailing::No)),
         )
     }