From 317bbe8fa296f8039644723d2b51876b202e6780 Mon Sep 17 00:00:00 2001 From: Predrag Gruevski Date: Sun, 22 Mar 2026 11:35:38 -0400 Subject: [PATCH] Avoid adding trailing whitespace. Fixes #19. --- src/collector.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/collector.rs b/src/collector.rs index 59bc1c9..68a5d6d 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -122,10 +122,15 @@ impl Collector for CommandLine { fn collect(&mut self, _: &CrateInfo) -> Result { let mut result = String::new(); + let mut past_first = false; for arg in std::env::args_os() { + if past_first { + result += " "; + } else { + past_first = true; + } result += &shell_escape::escape(arg.to_string_lossy()); - result += " "; } Ok(ReportEntry::Code(Code { @@ -238,10 +243,9 @@ impl<'a> Collector for CommandOutput<'a> { result += "> "; result += &self.cmd.to_string_lossy(); - result += " "; for arg in &self.cmd_args { - result += &shell_escape::escape(arg.to_string_lossy()); result += " "; + result += &shell_escape::escape(arg.to_string_lossy()); } result += "\n";