minor parse optimizations

This commit is contained in:
Robin Appelman 2023-03-04 22:46:31 +01:00
commit 97ad9d634b
3 changed files with 13 additions and 3 deletions

View file

@ -285,7 +285,14 @@ fn param_parse_with<'a, T, P: Fn(&'a str) -> IResult<&'a str, T>>(
let input = &input[has_open as usize..];
Ok((input.trim_start_matches(' '), value))
debug_assert!(
input.is_empty() || input.as_bytes()[0] == b' ',
"\"{}\" starts with space",
input
);
let input = &input[(!input.is_empty() as usize)..];
Ok((input, value))
}
}