mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Rename with_inline_comment to has_line_comment_before
This commit is contained in:
parent
7eba683355
commit
824de8bcc9
1 changed files with 5 additions and 7 deletions
|
@ -330,7 +330,7 @@ impl<'a> Formattable for Expr<'a> {
|
|||
match &ret.value {
|
||||
SpaceBefore(sub_expr, spaces) => {
|
||||
let empty_line_before_return = empty_line_before_expr(&ret.value);
|
||||
let has_inline_comment = with_inline_comment(&ret.value);
|
||||
let has_inline_comment = has_line_comment_before(&ret.value);
|
||||
|
||||
if has_inline_comment {
|
||||
buf.spaces(1);
|
||||
|
@ -587,15 +587,13 @@ fn format_spaces<'a, 'buf>(
|
|||
}
|
||||
}
|
||||
|
||||
fn with_inline_comment<'a>(expr: &'a Expr<'a>) -> bool {
|
||||
fn has_line_comment_before<'a>(expr: &'a Expr<'a>) -> bool {
|
||||
use roc_parse::ast::Expr::*;
|
||||
|
||||
match expr {
|
||||
SpaceBefore(_, spaces) => match spaces.iter().next() {
|
||||
Some(CommentOrNewline::LineComment(_)) => true,
|
||||
Some(_) => false,
|
||||
None => false,
|
||||
},
|
||||
SpaceBefore(_, spaces) => {
|
||||
matches!(spaces.iter().next(), Some(CommentOrNewline::LineComment(_)))
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue