From 99856bf7c2b400265cac84a900ac39e0bbc81da7 Mon Sep 17 00:00:00 2001 From: Mendy Man Date: Thu, 27 Nov 2025 16:59:19 -0500 Subject: [PATCH] Don't prefix empty comments lines with a space --- src/template.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/template.rs b/src/template.rs index 6bc9d2d..af8ba2f 100644 --- a/src/template.rs +++ b/src/template.rs @@ -105,7 +105,11 @@ pub fn populate_env( }; Ok(s.lines() - .format_with("\n", |line, f| f(&format_args!("{prefix} {line}"))) + .format_with("\n", |line, f| { + // if the line is empty, we don't want to spit out a `/// `, we want to spit out a `///` + let space = if line.is_empty() { "" } else { " " }; + f(&format_args!("{prefix}{space}{line}")) + }) .to_string()) }, );