Skip to content

Commit 77003fa

Browse files
sylvestrecakebaker
andauthored
Update src/uucore/src/lib/mods/clap_localization.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
1 parent 0b58d54 commit 77003fa

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/uucore/src/lib/mods/clap_localization.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,19 +298,16 @@ impl<'a> ErrorFormatter<'a> {
298298
eprintln!();
299299

300300
// Print usage
301-
let mut in_usage = false;
302-
for line in &lines {
303-
if line.starts_with("Usage:") {
304-
in_usage = true;
305-
}
306-
if in_usage {
301+
lines
302+
.iter()
303+
.skip_while(|line| !line.starts_with("Usage:"))
304+
.for_each(|line| {
307305
if line.starts_with("For more information, try '--help'.") {
308306
eprintln!("{}", translate!("common-help-suggestion"));
309307
} else {
310308
eprintln!("{line}");
311309
}
312-
}
313-
}
310+
});
314311
} else {
315312
eprint!("{}", err.render());
316313
}

0 commit comments

Comments
 (0)