Skip to content

Commit 050d929

Browse files
committed
cli_args.rs: don't rewrap unnecessarily line numbers string
The weird call `maybe_line_number_style.map()` is implemented by mookid's review who would not like just changing the parse_line_number_style() argument type.
1 parent eebfa03 commit 050d929

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cli_args.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,12 @@ fn color(config: &mut AppConfig, args: &mut Peekable<impl Iterator<Item = String
306306
}
307307

308308
fn line_numbers(config: &mut AppConfig, args: &mut Peekable<impl Iterator<Item = String>>) -> bool {
309-
let spec = if let Some(spec) = args.peek() {
309+
let maybe_line_number_style = args.peek();
310+
let spec = if let Some(spec) = maybe_line_number_style {
310311
if spec.starts_with("-") { // next option
311312
parse_line_number_style(config, None)
312313
} else {
313-
let parse_result = parse_line_number_style(config, Some(&*spec));
314+
let parse_result = parse_line_number_style(config, maybe_line_number_style.map(|s| &s[..]));
314315
args.next();
315316
parse_result
316317
}

0 commit comments

Comments
 (0)