mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
remove duplicated is_comment function
This commit is contained in:
parent
ccabc41489
commit
93b7ac5b0c
3 changed files with 4 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::annotation::{Formattable, Newlines, Parens};
|
||||
use crate::pattern::fmt_pattern;
|
||||
use crate::spaces::{fmt_spaces, is_comment, newline, INDENT};
|
||||
use crate::spaces::{fmt_spaces, newline, INDENT};
|
||||
use bumpalo::collections::String;
|
||||
use roc_parse::ast::{Def, Expr, Pattern};
|
||||
|
||||
|
@ -17,7 +17,7 @@ impl<'a> Formattable<'a> for Def<'a> {
|
|||
Body(loc_pattern, loc_expr) => loc_pattern.is_multiline() || loc_expr.is_multiline(),
|
||||
AnnotatedBody { .. } => true,
|
||||
SpaceBefore(sub_def, spaces) | SpaceAfter(sub_def, spaces) => {
|
||||
spaces.iter().any(|s| is_comment(s)) || sub_def.is_multiline()
|
||||
spaces.iter().any(|s| s.is_comment()) || sub_def.is_multiline()
|
||||
}
|
||||
Nested(def) => def.is_multiline(),
|
||||
NotYetImplemented(s) => todo!("{}", s),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::annotation::{Formattable, Newlines, Parens};
|
||||
use crate::spaces::{fmt_comments_only, fmt_spaces, is_comment};
|
||||
use crate::spaces::{fmt_comments_only, fmt_spaces};
|
||||
use bumpalo::collections::String;
|
||||
use roc_parse::ast::{Base, Pattern};
|
||||
|
||||
|
@ -19,7 +19,7 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
Pattern::SpaceBefore(_, spaces) | Pattern::SpaceAfter(_, spaces) => {
|
||||
debug_assert!(!spaces.is_empty());
|
||||
|
||||
spaces.iter().any(|s| is_comment(s))
|
||||
spaces.iter().any(|s| s.is_comment())
|
||||
}
|
||||
|
||||
Pattern::Nested(nested_pat) => nested_pat.is_multiline(),
|
||||
|
|
|
@ -150,11 +150,3 @@ fn fmt_docs<'a>(buf: &mut String<'a>, docs: &'a str, indent: u16) {
|
|||
|
||||
newline(buf, indent);
|
||||
}
|
||||
|
||||
pub fn is_comment<'a>(space: &'a CommentOrNewline<'a>) -> bool {
|
||||
match space {
|
||||
CommentOrNewline::Newline => false,
|
||||
CommentOrNewline::LineComment(_) => true,
|
||||
CommentOrNewline::DocComment(_) => true,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue