From afe75b0508cedba1df5c9701a22e5732c7d0d00e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 15:30:33 +0200 Subject: Add more tests for whitespace in jsx tags --- src/construct/partial_mdx_jsx.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/construct') diff --git a/src/construct/partial_mdx_jsx.rs b/src/construct/partial_mdx_jsx.rs index 1bf6fc2..e654416 100644 --- a/src/construct/partial_mdx_jsx.rs +++ b/src/construct/partial_mdx_jsx.rs @@ -1104,20 +1104,12 @@ pub fn es_whitespace_eol_after(tokenizer: &mut Tokenizer) -> State { /// Check if a character can start a JSX identifier. fn id_start_opt(code: Option) -> bool { - if let Some(char) = code { - id_start(char) - } else { - false - } + code.map_or(false, id_start) } /// Check if a character can continue a JSX identifier. fn id_cont_opt(code: Option) -> bool { - if let Some(char) = code { - id_cont(char, true) - } else { - false - } + code.map_or(false, |c| id_cont(c, true)) } /// Crash because something happened `at`, with info on what was `expect`ed -- cgit