force comments to start with a space

This commit is contained in:
Sébastien Besnier 2020-11-15 10:45:51 +01:00
parent c4bc98a81f
commit 1d44f7fef8
2 changed files with 25 additions and 1 deletions

View file

@ -111,10 +111,16 @@ pub fn fmt_comments_only<'a, I>(
fn fmt_comment<'a>(buf: &mut String<'a>, comment: &'a str) {
buf.push('#');
if !comment.starts_with(" ") {
buf.push(' ');
}
buf.push_str(comment);
}
fn fmt_docs<'a>(buf: &mut String<'a>, docs: &'a str) {
buf.push_str("##");
if !docs.starts_with(" ") {
buf.push(' ');
}
buf.push_str(docs);
}