diff --git a/src/context/context.rs b/src/context/context.rs index 98ea66df..3a066473 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -107,7 +107,7 @@ impl<'g, 'r, 's> Context<'g, 'r, 's> { pub(crate) fn check_exit_matcher( &'r self, i: OrgSource<'s>, - ) -> IResult, OrgSource<'s>, CustomError>> { + ) -> IResult, OrgSource<'s>, CustomError> { let mut current_class_filter = ExitClass::Gamma; for current_node in self.iter_context() { let context_element = current_node.get_data(); diff --git a/src/parser/document.rs b/src/parser/document.rs index 8e0ca884..70211b95 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -101,7 +101,7 @@ pub fn parse_file_with_settings<'g, 's, P: AsRef>( /// This will not prevent additional settings from being learned during parsing, for example when encountering a "#+TODO". #[allow(dead_code)] fn document<'s>(context: RefContext<'_, '_, '_, 's>, input: &'s str) -> Res<&'s str, Document<'s>> { - let (remaining, doc) = document_org_source(context, input.into()).map_err(convert_error)?; + let (remaining, doc) = document_org_source(context, input.into())?; Ok((Into::<&str>::into(remaining), doc)) } @@ -132,9 +132,9 @@ fn document_org_source<'b, 'g, 'r, 's>( let (_, setup_file_settings) = scan_for_in_buffer_settings(setup_file.into()).map_err(|err| { eprintln!("{}", err); - nom::Err::Error(CustomError::MyError(MyError( + nom::Err::Error(CustomError::Static( "TODO: make this take an owned string so I can dump err.to_string() into it.", - ))) + )) })?; final_settings.extend(setup_file_settings); } @@ -142,9 +142,9 @@ fn document_org_source<'b, 'g, 'r, 's>( let new_settings = apply_in_buffer_settings(final_settings, context.get_global_settings()) .map_err(|err| { eprintln!("{}", err); - nom::Err::Error(CustomError::MyError(MyError( + nom::Err::Error(CustomError::Static( "TODO: make this take an owned string so I can dump err.to_string() into it.", - ))) + )) })?; let new_context = context.with_global_settings(&new_settings); let context = &new_context; diff --git a/src/parser/headline.rs b/src/parser/headline.rs index ea98acc5..ea54e98c 100644 --- a/src/parser/headline.rs +++ b/src/parser/headline.rs @@ -285,9 +285,9 @@ fn priority_cookie(input: OrgSource<'_>) -> Res, PriorityCookie> { tag("]"), ))(input)?; let cookie = PriorityCookie::try_from(priority_character).map_err(|_| { - nom::Err::Error(CustomError::MyError(MyError( + nom::Err::Error(CustomError::Static( "Failed to cast priority cookie to number.", - ))) + )) })?; Ok((remaining, cookie)) } diff --git a/src/parser/regular_link.rs b/src/parser/regular_link.rs index 244e6d88..00974386 100644 --- a/src/parser/regular_link.rs +++ b/src/parser/regular_link.rs @@ -162,11 +162,7 @@ fn parse_path_reg<'b, 'g, 'r, 's>( parser_with_context!(protocol_path_reg)(context), fuzzy_path_reg, ))(replaced_input) - .map_err(|_| { - nom::Err::Error(CustomError::MyError(MyError( - "No pathreg match after replacement.", - ))) - })?; + .map_err(|_| nom::Err::Error(CustomError::Static("No pathreg match after replacement.")))?; let remaining = input.take(input.len()); let link_type = match link.link_type { LinkType::Protocol(protocol) => LinkType::Protocol(protocol.into_owned().into()), diff --git a/src/parser/util.rs b/src/parser/util.rs index 123adfe3..538f2b9f 100644 --- a/src/parser/util.rs +++ b/src/parser/util.rs @@ -200,9 +200,7 @@ fn not_yet_implemented() -> Res, ()> { /// Text from the current point until the next line break or end of file /// /// Useful for debugging. -fn text_until_eol<'r, 's>( - input: OrgSource<'s>, -) -> Result<&'s str, nom::Err>>> { +fn text_until_eol<'r, 's>(input: OrgSource<'s>) -> Result<&'s str, nom::Err> { let line = recognize(many_till(anychar, alt((line_ending, eof))))(input) .map(|(_remaining, line)| Into::<&str>::into(line))?; Ok(line.trim())