}
}
+#[inline]
+pub fn format_async(is_async: ast::IsAsync) -> &'static str {
+ match is_async {
+ ast::IsAsync::Async { .. } => "async ",
+ ast::IsAsync::NotAsync => "",
+ }
+}
+
#[inline]
pub fn format_constness(constness: ast::Constness) -> &'static str {
match constness {
}
}
+#[inline]
pub fn left_most_sub_expr(e: &ast::Expr) -> &ast::Expr {
match e.node {
ast::ExprKind::Call(ref e, _)
}
}
+#[inline]
pub fn starts_with_newline(s: &str) -> bool {
s.starts_with('\n') || s.starts_with("\r\n")
}
+
+#[inline]
+pub fn first_line_ends_with(s: &str, c: char) -> bool {
+ s.lines().next().map_or(false, |l| l.ends_with(c))
+}