Skip to content

Commit 184ede7

Browse files
committed
Fix clippy reported problems of write_with_newline lint
This change fixes occurrences flagged by the clippy lint `write_with_newline`. E.g., > warning: using `write!()` with a format string that ends in a single > newline, consider using `writeln!()` instead > --> src/parser.rs:410:29 > | > 410 | / write!(self.stderr, > 411 | | "WARNING: Environment variable {}: {}\n", > 412 | | evar.name, err).ok(); > | |_______________________________________________^ > | > = note: #[warn(clippy::write_with_newline)] on by default > = help: for further information visit > https://rust-lang-nursery.github.io/rust-clippy/master/index.html#write_with_newline
1 parent 15de102 commit 184ede7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ impl<'a, 'b> Context<'a, 'b> {
407407
continue;
408408
}
409409
Error(err) => {
410-
write!(self.stderr,
411-
"WARNING: Environment variable {}: {}\n",
410+
writeln!(self.stderr,
411+
"WARNING: Environment variable {}: {}",
412412
evar.name, err).ok();
413413
}
414414
_ => unreachable!(),
@@ -761,7 +761,7 @@ impl<'parser> ArgumentParser<'parser> {
761761
/// of scope of the argparse
762762
pub fn error(&self, command: &str, message: &str, writer: &mut Write) {
763763
self.print_usage(command, writer).unwrap();
764-
write!(writer, "{}: {}\n", command, message).ok();
764+
writeln!(writer, "{}: {}", command, message).ok();
765765
}
766766

767767
/// Configure parser to ignore options when first non-option argument is

0 commit comments

Comments
 (0)