Very minor leftover codereview var-renaming

This commit is contained in:
Henrik Hørlück Berg 2023-07-27 08:21:03 +02:00 committed by Peter Ammon
parent cdc08dbb71
commit 2ec36338f2
3 changed files with 7 additions and 7 deletions

View file

@ -234,7 +234,7 @@ impl StringError {
InvalidArgs(msg) => { InvalidArgs(msg) => {
streams.err.append(L!("string ")); streams.err.append(L!("string "));
// TODO: Once we can extract/edit translations in Rust files, replace this with // TODO: Once we can extract/edit translations in Rust files, replace this with
// something like wgettext_fmt("%ls: %ls", cmd, msg) that can be translated // something like wgettext_fmt!("%ls: %ls\n", cmd, msg) that can be translated
// and remove the forwarding of the cmd name to `parse_opt` // and remove the forwarding of the cmd name to `parse_opt`
streams.err.append(msg); streams.err.append(msg);
} }

View file

@ -72,13 +72,13 @@ impl StringSubCommand<'_> for Pad {
) -> Option<libc::c_int> { ) -> Option<libc::c_int> {
let mut max_width = 0usize; let mut max_width = 0usize;
let mut inputs: Vec<(Cow<'args, wstr>, usize)> = Vec::new(); let mut inputs: Vec<(Cow<'args, wstr>, usize)> = Vec::new();
let mut print_newline = true; let mut print_trailing_newline = true;
for (arg, want_newline) in Arguments::new(args, optind, streams) { for (arg, want_newline) in Arguments::new(args, optind, streams) {
let width = width_without_escapes(&arg, 0); let width = width_without_escapes(&arg, 0);
max_width = max_width.max(width); max_width = max_width.max(width);
inputs.push((arg, width)); inputs.push((arg, width));
print_newline = want_newline; print_trailing_newline = want_newline;
} }
let pad_width = max_width.max(self.width); let pad_width = max_width.max(self.width);
@ -101,7 +101,7 @@ impl StringSubCommand<'_> for Pad {
.collect(), .collect(),
}; };
if print_newline { if print_trailing_newline {
padded.push('\n'); padded.push('\n');
} }

View file

@ -53,10 +53,10 @@ impl StringSubCommand<'_> for Repeat {
let mut all_empty = true; let mut all_empty = true;
let mut first = true; let mut first = true;
let mut print_newline = true; let mut print_trailing_newline = true;
for (w, want_newline) in Arguments::new(args, optind, streams) { for (w, want_newline) in Arguments::new(args, optind, streams) {
print_newline = want_newline; print_trailing_newline = want_newline;
if w.is_empty() { if w.is_empty() {
continue; continue;
} }
@ -132,7 +132,7 @@ impl StringSubCommand<'_> for Repeat {
} }
// Historical behavior is to never append a newline if all strings were empty. // Historical behavior is to never append a newline if all strings were empty.
if !self.quiet && !self.no_newline && !all_empty && print_newline { if !self.quiet && !self.no_newline && !all_empty && print_trailing_newline {
streams.out.append1('\n'); streams.out.append1('\n');
} }