Skip to content

Commit de77d5a

Browse files
committed
fix: lint
1 parent f549ff8 commit de77d5a

1 file changed

Lines changed: 15 additions & 23 deletions

File tree

  • crates/oxc_parser/src/astro

crates/oxc_parser/src/astro/jsx.rs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ impl<'a> ParserImpl<'a> {
133133
let closing_span = self.start_span();
134134
self.bump_any(); // bump `<`
135135
self.bump_any(); // bump `/`
136-
let closing =
137-
self.parse_astro_jsx_closing_inline(closing_span, in_jsx_child);
136+
let closing = self.parse_astro_jsx_closing_inline(closing_span, in_jsx_child);
138137
(children, closing)
139138
} else {
140139
let result = self.parse_astro_jsx_children_and_closing(in_jsx_child);
@@ -184,8 +183,7 @@ impl<'a> ParserImpl<'a> {
184183
let explicit_self_closing = self.eat(Kind::Slash);
185184

186185
// HTML void elements are implicitly self-closing even without `/`
187-
let self_closing =
188-
explicit_self_closing || Self::is_astro_void_element(&name);
186+
let self_closing = explicit_self_closing || Self::is_astro_void_element(&name);
189187

190188
// Check if this is a raw text element
191189
let is_raw_text =
@@ -284,8 +282,7 @@ impl<'a> ParserImpl<'a> {
284282
children.push(self.parse_astro_script_in_jsx(span));
285283
continue;
286284
}
287-
children
288-
.push(JSXChild::Element(self.parse_astro_jsx_element(span, true)));
285+
children.push(JSXChild::Element(self.parse_astro_jsx_element(span, true)));
289286
continue;
290287
}
291288

@@ -301,8 +298,7 @@ impl<'a> ParserImpl<'a> {
301298
// </ closing tag
302299
if kind == Kind::Slash {
303300
self.bump_any(); // bump `/`
304-
let closing =
305-
self.parse_astro_jsx_closing_inline(span, in_jsx_child);
301+
let closing = self.parse_astro_jsx_closing_inline(span, in_jsx_child);
306302
return (children, closing);
307303
}
308304

@@ -977,32 +973,28 @@ impl<'a> ParserImpl<'a> {
977973

978974
if let Some(rest) = self.source_text.get(start_pos..)
979975
&& rest.starts_with("!--")
976+
&& let Some(end_offset) = rest.find("-->")
980977
{
981-
if let Some(end_offset) = rest.find("-->") {
982-
let comment_end = (start_pos + end_offset + 3) as u32;
983-
let comment_start = span;
978+
let comment_end = (start_pos + end_offset + 3) as u32;
979+
let comment_start = span;
984980

985-
let content = &rest[3..end_offset];
986-
let value = oxc_span::Atom::from(content);
981+
let content = &rest[3..end_offset];
982+
let value = oxc_span::Atom::from(content);
987983

988-
let comment_span = oxc_span::Span::new(comment_start, comment_end);
989-
let comment = self.ast.alloc_astro_comment(comment_span, value);
984+
let comment_span = oxc_span::Span::new(comment_start, comment_end);
985+
let comment = self.ast.alloc_astro_comment(comment_span, value);
990986

991-
self.lexer.set_position_for_astro(comment_end);
992-
self.token = self.lexer.next_jsx_child();
987+
self.lexer.set_position_for_astro(comment_end);
988+
self.token = self.lexer.next_jsx_child();
993989

994-
return Some(JSXChild::AstroComment(comment));
995-
}
990+
return Some(JSXChild::AstroComment(comment));
996991
}
997992

998993
None
999994
}
1000995

1001996
/// Parse JSX children in an expression container (Astro-specific).
1002-
fn parse_astro_jsx_children_in_expression(
1003-
&mut self,
1004-
span_start: u32,
1005-
) -> JSXExpression<'a> {
997+
fn parse_astro_jsx_children_in_expression(&mut self, span_start: u32) -> JSXExpression<'a> {
1006998
let fragment_span_start = span_start + 1;
1007999
let mut children = self.ast.vec();
10081000

0 commit comments

Comments
 (0)