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

Commit

Permalink
Clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Dec 15, 2022
1 parent b79e841 commit 72489f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
17 changes: 8 additions & 9 deletions crates/rome_js_formatter/src/separated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ where
}
}

type JsFormatSeparatedIter<Node> = FormatSeparatedIter<
AstSeparatedListElementsIterator<JsLanguage, Node>,
Node,
JsFormatSeparatedElementRule<Node>,
>;

/// AST Separated list formatting extension methods
pub(crate) trait FormatAstSeparatedListExtension:
AstSeparatedList<Language = JsLanguage>
Expand All @@ -41,15 +47,8 @@ pub(crate) trait FormatAstSeparatedListExtension:
/// created by calling the `separator_factory` function.
/// The last trailing separator in the list will only be printed
/// if the outer group breaks.
fn format_separated(
&self,
separator: &'static str,
) -> FormatSeparatedIter<
AstSeparatedListElementsIterator<JsLanguage, Self::Node>,
Self::Node,
JsFormatSeparatedElementRule<Self::Node>,
> {
FormatSeparatedIter::new(
fn format_separated(&self, separator: &'static str) -> JsFormatSeparatedIter<Self::Node> {
JsFormatSeparatedIter::new(
self.elements(),
separator,
JsFormatSeparatedElementRule { node: PhantomData },
Expand Down
23 changes: 11 additions & 12 deletions crates/rome_json_formatter/src/separated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use rome_rowan::{AstNode, AstSeparatedList, AstSeparatedListElementsIterator};
use std::marker::PhantomData;

#[derive(Clone)]
pub(crate) struct FormatJsonSeparatedElementRule<N> {
pub(crate) struct JsonFormatSeparatedElementRule<N> {
node: PhantomData<N>,
}

impl<N> FormatSeparatedElementRule<N> for FormatJsonSeparatedElementRule<N>
impl<N> FormatSeparatedElementRule<N> for JsonFormatSeparatedElementRule<N>
where
N: AstNode<Language = JsonLanguage> + AsFormat<JsonFormatContext> + 'static,
{
Expand All @@ -30,6 +30,12 @@ where
}
}

type JsonFormatSeparatedIter<Node> = FormatSeparatedIter<
AstSeparatedListElementsIterator<JsonLanguage, Node>,
Node,
JsonFormatSeparatedElementRule<Node>,
>;

/// AST Separated list formatting extension methods
pub(crate) trait FormatAstSeparatedListExtension:
AstSeparatedList<Language = JsonLanguage>
Expand All @@ -40,18 +46,11 @@ pub(crate) trait FormatAstSeparatedListExtension:
/// created by calling the `separator_factory` function.
/// The last trailing separator in the list will only be printed
/// if the outer group breaks.
fn format_separated(
&self,
separator: &'static str,
) -> FormatSeparatedIter<
AstSeparatedListElementsIterator<JsonLanguage, Self::Node>,
Self::Node,
FormatJsonSeparatedElementRule<Self::Node>,
> {
FormatSeparatedIter::new(
fn format_separated(&self, separator: &'static str) -> JsonFormatSeparatedIter<Self::Node> {
JsonFormatSeparatedIter::new(
self.elements(),
separator,
FormatJsonSeparatedElementRule { node: PhantomData },
JsonFormatSeparatedElementRule { node: PhantomData },
)
.with_trailing_separator(TrailingSeparator::Disallowed)
}
Expand Down

0 comments on commit 72489f9

Please sign in to comment.