diff --git a/src/parser/org_source.rs b/src/parser/org_source.rs index 9f4c35ee..79c870c0 100644 --- a/src/parser/org_source.rs +++ b/src/parser/org_source.rs @@ -11,7 +11,7 @@ use nom::Slice; use crate::error::CustomError; use crate::error::MyError; -#[derive(Debug, Copy, Clone)] +#[derive(Copy, Clone)] pub struct OrgSource<'s> { full_source: &'s str, start: usize, @@ -24,6 +24,14 @@ pub struct OrgSource<'s> { parenthesis_depth: isize, // () } +impl<'s> std::fmt::Debug for OrgSource<'s> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_tuple("OrgSource") + .field(&Into::<&str>::into(self)) + .finish() + } +} + impl<'s> OrgSource<'s> { /// Returns a wrapped string that keeps track of values we need for parsing org-mode. /// @@ -302,7 +310,9 @@ impl<'s> InputTakeAtPosition for OrgSource<'s> { } } -pub fn convert_error(err: nom::Err>>) -> nom::Err> { +pub fn convert_error<'a, I: Into>>( + err: nom::Err, +) -> nom::Err> { match err { nom::Err::Incomplete(needed) => nom::Err::Incomplete(needed), nom::Err::Error(err) => nom::Err::Error(err.into()),