Skip to content

Commit

Permalink
chore: apply Clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Aug 13, 2024
1 parent bde602d commit d626d77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion markup_fmt/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ where
)
}

pub(crate) fn format_style_attr<'a>(&mut self, code: &'a str, start: usize) -> String {
pub(crate) fn format_style_attr(&mut self, code: &str, start: usize) -> String {
self.format_with_external_formatter(
self.source
.get(0..start)
Expand Down
3 changes: 2 additions & 1 deletion markup_fmt/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl<'s> Parser<'s> {
})
}

fn parse_angular_if_cond(&mut self) -> PResult<((&'s str, usize), Option<(&'s str, usize)>)> {
fn parse_angular_if_cond(&mut self) -> PResult<AngularIfCond<'s>> {
let Some((start, _)) = self.chars.next_if(|(_, c)| *c == '(') else {
return Err(self.emit_error(SyntaxErrorKind::ExpectChar('(')));
};
Expand Down Expand Up @@ -2343,3 +2343,4 @@ fn is_vento_interpolation(tag_name: &str) -> bool {
}

pub type PResult<T> = Result<T, SyntaxError>;
type AngularIfCond<'s> = ((&'s str, usize), Option<(&'s str, usize)>);
14 changes: 6 additions & 8 deletions markup_fmt/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,10 @@ impl<'s> DocGen<'s> for Element<'s> {
}
_ => None,
})
.unwrap_or_else(|| {
if matches!(ctx.language, Language::Astro) {
"ts"
} else {
"js"
}
.unwrap_or(if matches!(ctx.language, Language::Astro) {
"ts"
} else {
"js"
}),
text_node.start,
)
Expand Down Expand Up @@ -1720,7 +1718,7 @@ where
Some(Node {
kind: NodeKind::Comment(comment),
..
}) => has_ignore_directive(&comment, ctx),
}) => has_ignore_directive(comment, ctx),
Some(Node {
kind: NodeKind::Text(text_node),
..
Expand All @@ -1730,7 +1728,7 @@ where
..
}) = index.checked_sub(2).and_then(|i| nodes.get(i))
{
has_ignore_directive(&comment, ctx)
has_ignore_directive(comment, ctx)
} else {
false
}
Expand Down

0 comments on commit d626d77

Please sign in to comment.