Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Switched to using format_or_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Yang committed Apr 6, 2022
1 parent e2bd79e commit d807e61
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions crates/rome_js_formatter/src/jsx/tag/self_closing_element.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::formatter_traits::FormatTokenAndNode;
use crate::formatter_traits::{FormatOptionalTokenAndNode, FormatTokenAndNode};
use crate::group_elements;
use crate::{
format_elements, soft_block_indent, soft_line_break_or_space, space_token, FormatElement,
FormatResult, Formatter, ToFormatElement,
};
use rome_formatter::empty_element;
use rome_js_syntax::JsxSelfClosingElement;

impl ToFormatElement for JsxSelfClosingElement {
Expand All @@ -15,11 +14,7 @@ impl ToFormatElement for JsxSelfClosingElement {
attributes.push(soft_line_break_or_space());
}

let type_arguments = self
.type_arguments()
.map(|arg| arg.format(formatter))
.transpose()?
.unwrap_or_else(empty_element);
let type_arguments = self.type_arguments().format_or_empty(formatter)?;

Ok(format_elements![
self.l_angle_token().format(formatter)?,
Expand Down

0 comments on commit d807e61

Please sign in to comment.