fmt+clippy

This commit is contained in:
Anton-4 2022-03-07 16:24:30 +01:00
parent 21a30b1e83
commit d8b4feb659
No known key found for this signature in database
GPG key ID: C954D6E0F9C0ABFD

View file

@ -143,12 +143,11 @@ impl<'a> Formattable for Expr<'a> {
} else {
buf.indent(indent);
buf.push('(');
let next_indent =
if starts_with_newline(sub_expr) {
indent + INDENT
} else {
indent
};
let next_indent = if starts_with_newline(sub_expr) {
indent + INDENT
} else {
indent
};
sub_expr.format_with_options(
buf,
@ -315,21 +314,23 @@ fn starts_with_newline(expr: &Expr) -> bool {
use roc_parse::ast::Expr::*;
match expr {
SpaceBefore(_, comment_or_newline) =>
if (**comment_or_newline).len() > 0 {
SpaceBefore(_, comment_or_newline) => {
if !(**comment_or_newline).is_empty() {
// safe because we check the length before
(**comment_or_newline).get(0).unwrap().is_newline()
} else {
false
}
SpaceAfter(_, comment_or_newline) =>
if (**comment_or_newline).len() > 0 {
// safe because we check the length before
(**comment_or_newline).get(0).unwrap().is_newline()
} else {
false
},
_ => false
}
SpaceAfter(_, comment_or_newline) => {
if !(**comment_or_newline).is_empty() {
// safe because we check the length before
(**comment_or_newline).get(0).unwrap().is_newline()
} else {
false
}
}
_ => false,
}
}