Apply more suggestions.

This commit is contained in:
Tom Alexander
2023-10-16 17:03:16 -04:00
parent 4ba0e3611b
commit 2dd5246506
9 changed files with 28 additions and 38 deletions

View File

@@ -183,13 +183,13 @@ fn code<'b, 'g, 'r, 's>(
))
}
fn text_markup_object<'c>(
marker_symbol: &'c str,
fn text_markup_object(
marker_symbol: &str,
) -> impl for<'b, 'g, 'r, 's> Fn(
RefContext<'b, 'g, 'r, 's>,
OrgSource<'s>,
) -> Res<OrgSource<'s>, Vec<Object<'s>>>
+ 'c {
+ '_ {
move |context, input: OrgSource<'_>| _text_markup_object(context, input, marker_symbol)
}
@@ -235,7 +235,7 @@ fn _text_markup_object<'b, 'g, 'r, 's, 'c>(
let _enter = span.enter();
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.".into(),
"Parent exit matcher is triggering.",
))));
}
}
@@ -246,13 +246,13 @@ fn _text_markup_object<'b, 'g, 'r, 's, 'c>(
Ok((remaining, children))
}
fn text_markup_string<'c>(
marker_symbol: &'c str,
fn text_markup_string(
marker_symbol: &str,
) -> impl for<'b, 'g, 'r, 's> Fn(
RefContext<'b, 'g, 'r, 's>,
OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>>
+ 'c {
+ '_ {
move |context, input: OrgSource<'_>| _text_markup_string(context, input, marker_symbol)
}
@@ -291,7 +291,7 @@ fn _text_markup_string<'b, 'g, 'r, 's, 'c>(
let _enter = span.enter();
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.".into(),
"Parent exit matcher is triggering.",
))));
}
}
@@ -322,7 +322,7 @@ fn pre<'b, 'g, 'r, 's>(
Some('-') | Some('(') | Some('{') | Some('\'') | Some('"') => {}
Some(_) => {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Not a valid pre character for text markup.".into(),
"Not a valid pre character for text markup.",
))));
}
None => unreachable!(), // None is for start of file, which should already be handled by the start_of_line matcher above.
@@ -343,10 +343,7 @@ fn post<'b, 'g, 'r, 's>(
Ok((remaining, ()))
}
fn text_markup_end<'c>(
marker_symbol: &'c str,
contents_start_offset: usize,
) -> impl ContextMatcher + 'c {
fn text_markup_end(marker_symbol: &str, contents_start_offset: usize) -> impl ContextMatcher + '_ {
move |context, input: OrgSource<'_>| {
_text_markup_end(context, input, marker_symbol, contents_start_offset)
}
@@ -364,7 +361,7 @@ fn _text_markup_end<'b, 'g, 'r, 's, 'c>(
) -> Res<OrgSource<'s>, OrgSource<'s>> {
if input.get_byte_offset() == contents_start_offset {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Text markup cannot be empty".into(),
"Text markup cannot be empty",
))));
}
not(preceded_by_whitespace(false))(input)?;
@@ -499,7 +496,7 @@ fn _rematch_text_markup_object<'b, 'g, 'r, 's, 'x>(
let _enter = span.enter();
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.".into(),
"Parent exit matcher is triggering.",
))));
}
}