mirror of
https://github.com/sharkdp/bat.git
synced 2024-12-28 17:28:49 +01:00
Line range minus syntax clippy suggestions addressed
This commit is contained in:
parent
bc86c29185
commit
0eb4aaac1e
@ -56,14 +56,14 @@ impl LineRange {
|
||||
new_range.lower + more_lines
|
||||
} else if first_byte == Some(b'-') {
|
||||
// this will prevent values like "-+5" even though "+5" is valid integer
|
||||
if &line_numbers[1][1..].bytes().next() == &Some(b'+') {
|
||||
if line_numbers[1][1..].bytes().next() == Some(b'+') {
|
||||
return Err("Invalid character after -".into());
|
||||
}
|
||||
let less_lines = &line_numbers[1][1..]
|
||||
let prior_lines = &line_numbers[1][1..]
|
||||
.parse()
|
||||
.map_err(|_| "Invalid character after -")?;
|
||||
let prev_lower = new_range.lower;
|
||||
new_range.lower = new_range.lower - less_lines;
|
||||
new_range.lower -= prior_lines;
|
||||
prev_lower
|
||||
} else {
|
||||
line_numbers[1].parse()?
|
||||
|
Loading…
Reference in New Issue
Block a user