From b6ae443103c546fce5dbfbbe5f25a0d030a33beb Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Mon, 11 Oct 2021 16:39:23 +0200 Subject: Remove custom ParserError type --- askama_shared/src/parser.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'askama_shared/src/parser.rs') diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs index 995fc19..3c91855 100644 --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -187,7 +187,7 @@ struct State<'a> { loop_depth: Cell, } -fn take_content<'a>(i: &'a [u8], s: &State<'_>) -> ParserError<'a, Node<'a>> { +fn take_content<'a>(i: &'a [u8], s: &State<'_>) -> IResult<&'a [u8], Node<'a>> { use crate::parser::ContentState::*; let bs = s.syntax.block_start.as_bytes()[0]; let be = s.syntax.block_start.as_bytes()[1]; @@ -230,7 +230,7 @@ fn take_content<'a>(i: &'a [u8], s: &State<'_>) -> ParserError<'a, Node<'a>> { } } -fn identifier(input: &[u8]) -> ParserError<'_, &str> { +fn identifier(input: &[u8]) -> IResult<&[u8], &str> { if !nom::character::is_alphabetic(input[0]) && input[0] != b'_' && !non_ascii(input[0]) { return Err(nom::Err::Error(nom::error::Error::new( input, @@ -475,7 +475,7 @@ fn macro_arguments(i: &[u8]) -> IResult<&[u8], &str> { delimited(char('('), nested_parenthesis, char(')'))(i) } -fn nested_parenthesis(i: &[u8]) -> ParserError<'_, &str> { +fn nested_parenthesis(i: &[u8]) -> IResult<&[u8], &str> { let mut nested = 0; let mut last = 0; let mut in_str = false; @@ -1636,5 +1636,3 @@ mod tests { ); } } - -type ParserError<'a, T> = Result<(&'a [u8], T), nom::Err>>; -- cgit