Skip to content

Commit 8fc7a5c

Browse files
authored
Return results from parse_b / parse_signless_b directly in parse_nth (#422)
1 parent 6967a85 commit 8fc7a5c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/nth.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub fn parse_nth<'i>(input: &mut Parser<'i, '_>) -> Result<(i32, i32), BasicPars
2020
} => {
2121
match_ignore_ascii_case! {
2222
unit,
23-
"n" => Ok(parse_b(input, a)?),
24-
"n-" => Ok(parse_signless_b(input, a, -1)?),
23+
"n" => parse_b(input, a),
24+
"n-" => parse_signless_b(input, a, -1),
2525
_ => match parse_n_dash_digits(unit) {
2626
Ok(b) => Ok((a, b)),
2727
Err(()) => {
@@ -35,10 +35,10 @@ pub fn parse_nth<'i>(input: &mut Parser<'i, '_>) -> Result<(i32, i32), BasicPars
3535
match_ignore_ascii_case! { value,
3636
"even" => Ok((2, 0)),
3737
"odd" => Ok((2, 1)),
38-
"n" => Ok(parse_b(input, 1)?),
39-
"-n" => Ok(parse_b(input, -1)?),
40-
"n-" => Ok(parse_signless_b(input, 1, -1)?),
41-
"-n-" => Ok(parse_signless_b(input, -1, -1)?),
38+
"n" => parse_b(input, 1),
39+
"-n" => parse_b(input, -1),
40+
"n-" => parse_signless_b(input, 1, -1),
41+
"-n-" => parse_signless_b(input, -1, -1),
4242
_ => {
4343
let (slice, a) = if let Some(stripped) = value.strip_prefix('-') {
4444
(stripped, -1)

0 commit comments

Comments
 (0)