From 31e9db442da5b114d5ad5da15c40d0179327862f Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:37:00 +0000 Subject: [PATCH] refactor(parser): shorten `UniquePromise` code (#5805) Pure refactor. Shorten code a little. --- crates/oxc_parser/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index be68a6fac2f00..d433dae17bac4 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -178,14 +178,12 @@ mod parser_parse { /// /// `UniquePromise::new_for_benchmarks` is a backdoor for benchmarks, so they can create a /// `ParserImpl` or `Lexer`, and manipulate it directly, for testing/benchmarking purposes. - pub(crate) struct UniquePromise { - _dummy: (), - } + pub(crate) struct UniquePromise(()); impl UniquePromise { #[inline] fn new() -> Self { - Self { _dummy: () } + Self(()) } /// Backdoor for tests/benchmarks to create a `UniquePromise` (see above). @@ -193,7 +191,7 @@ mod parser_parse { /// as it allows circumventing safety invariants of the parser. #[cfg(feature = "benchmarking")] pub fn new_for_benchmarks() -> Self { - Self { _dummy: () } + Self(()) } }