From 1bb2c687c049bb742745dfb259b263533ee801e1 Mon Sep 17 00:00:00 2001 From: Max Graey Date: Wed, 17 Nov 2021 06:49:43 +0200 Subject: [PATCH] refactor(es/parser): Simplify `skip_line_comment` (#2768) --- crates/swc_ecma_parser/src/lexer/util.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/crates/swc_ecma_parser/src/lexer/util.rs b/crates/swc_ecma_parser/src/lexer/util.rs index 5193c7c9a14f..d476f92f5b94 100644 --- a/crates/swc_ecma_parser/src/lexer/util.rs +++ b/crates/swc_ecma_parser/src/lexer/util.rs @@ -220,14 +220,9 @@ impl<'a, I: Input> Lexer<'a, I> { self.bump(); if c.is_line_terminator() { self.state.had_line_break = true; - } - match c { - '\n' | '\r' | '\u{2028}' | '\u{2029}' => { - break; - } - _ => { - end = self.cur_pos(); - } + break; + } else { + end = self.cur_pos(); } }