From 9d8960e772a06bcaa00d688209c3d40f463991c6 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Wed, 5 Nov 2025 07:43:56 +1100 Subject: [PATCH] Fix always appending extra newline in writer convenience functions in std-only crate --- jaarg/src/std.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jaarg/src/std.rs b/jaarg/src/std.rs index 75cc5c3..e710a54 100644 --- a/jaarg/src/std.rs +++ b/jaarg/src/std.rs @@ -9,7 +9,7 @@ use crate::alloc::ParseMapResult; use crate::{HandlerResult, HelpWriter, HelpWriterContext, Opt, Opts, ParseControl, ParseError, ParseResult, StandardFullHelpWriter, StandardShortUsageWriter}; use std::path::Path; use std::rc::Rc; -use std::{env, eprintln, println}; +use std::{env, eprint, eprintln, print}; impl Opts { /// Wrapper around [Opts::parse] that gathers arguments from the command line and prints errors to stderr. @@ -34,7 +34,7 @@ impl Opts { /// Requires `features = ["std"]`. pub fn print_help<'a, W: HelpWriter<'a, ID>>(&'a self, program_name: &'a str) { let ctx = HelpWriterContext { options: self, program_name }; - println!("{}", W::new(ctx)); + print!("{}", W::new(ctx)); } /// Print help text to stderr using the provided help writer. @@ -42,7 +42,7 @@ impl Opts { /// Requires `features = ["std"]`. pub fn eprint_help<'a, W: HelpWriter<'a, ID>>(&'a self, program_name: &'a str) { let ctx = HelpWriterContext { options: self, program_name }; - eprintln!("{}", W::new(ctx)); + eprint!("{}", W::new(ctx)); } fn easy_args<'a>() -> (Rc, env::Args) {