1
Fork 0

Prefer doc comments over //-comments in compiler

This commit is contained in:
Maybe Waffle 2022-11-27 11:15:06 +00:00
parent 0e9eee6811
commit 1d42936b18
83 changed files with 400 additions and 387 deletions

View file

@ -36,8 +36,8 @@ impl Printer {
self.nbsp()
}
// Synthesizes a comment that was not textually present in the original
// source file.
/// Synthesizes a comment that was not textually present in the original
/// source file.
pub fn synth_comment(&mut self, text: impl Into<Cow<'static, str>>) {
self.word("/*");
self.space();

View file

@ -58,10 +58,10 @@ impl<'a> State<'a> {
self.print_expr_cond_paren(expr, Self::cond_needs_par(expr))
}
// Does `expr` need parentheses when printed in a condition position?
//
// These cases need parens due to the parse error observed in #26461: `if return {}`
// parses as the erroneous construct `if (return {})`, not `if (return) {}`.
/// Does `expr` need parentheses when printed in a condition position?
///
/// These cases need parens due to the parse error observed in #26461: `if return {}`
/// parses as the erroneous construct `if (return {})`, not `if (return) {}`.
pub(super) fn cond_needs_par(expr: &ast::Expr) -> bool {
match expr.kind {
ast::ExprKind::Break(..)