mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
fmt+clippy
This commit is contained in:
parent
21a30b1e83
commit
d8b4feb659
1 changed files with 17 additions and 16 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue