Apply more suggestions.
This commit is contained in:
@@ -42,9 +42,9 @@ pub(crate) fn in_section<'b, 'g, 'r, 's, 'x>(
|
||||
}
|
||||
|
||||
/// Checks if we are currently an immediate child of the given section type
|
||||
pub(crate) fn immediate_in_section<'b, 'g, 'r, 's, 'x>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
section_name: &'x str,
|
||||
pub(crate) fn immediate_in_section(
|
||||
context: RefContext<'_, '_, '_, '_>,
|
||||
section_name: &str,
|
||||
) -> bool {
|
||||
for thing in context.iter() {
|
||||
match thing {
|
||||
@@ -133,7 +133,7 @@ pub(crate) fn start_of_line<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ()>
|
||||
Ok((input, ()))
|
||||
} else {
|
||||
Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Not at start of line".into(),
|
||||
"Not at start of line",
|
||||
))))
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ fn _preceded_by_whitespace<'s>(
|
||||
.unwrap_or(allow_start_of_file)
|
||||
{
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Must be preceded by a whitespace character.".into(),
|
||||
"Must be preceded by a whitespace character.",
|
||||
))));
|
||||
}
|
||||
Ok((input, ()))
|
||||
@@ -198,9 +198,9 @@ pub(crate) fn text_until_exit<'b, 'g, 'r, 's>(
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn not_yet_implemented() -> Res<OrgSource<'static>, ()> {
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Not implemented yet.".into(),
|
||||
))));
|
||||
Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Not implemented yet.",
|
||||
))))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -234,29 +234,27 @@ where
|
||||
/// Match single space or tab.
|
||||
///
|
||||
/// In org-mode syntax, spaces and tabs are often (but not always!) interchangeable.
|
||||
pub(crate) fn org_space<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, char> {
|
||||
pub(crate) fn org_space(input: OrgSource<'_>) -> Res<OrgSource<'_>, char> {
|
||||
one_of(" \t")(input)
|
||||
}
|
||||
|
||||
/// Matches a single space, tab, line ending, or end of file.
|
||||
///
|
||||
/// In org-mode syntax there are often delimiters that could be any whitespace at all or the end of file.
|
||||
pub(crate) fn org_space_or_line_ending<'s>(
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
pub(crate) fn org_space_or_line_ending(input: OrgSource<'_>) -> Res<OrgSource<'_>, OrgSource<'_>> {
|
||||
alt((recognize(org_space), org_line_ending))(input)
|
||||
}
|
||||
|
||||
/// Match a line break or the end of the file.
|
||||
///
|
||||
/// In org-mode syntax, the end of the file can serve the same purpose as a line break syntactically.
|
||||
pub(crate) fn org_line_ending<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
pub(crate) fn org_line_ending(input: OrgSource<'_>) -> Res<OrgSource<'_>, OrgSource<'_>> {
|
||||
alt((line_ending, eof))(input)
|
||||
}
|
||||
|
||||
/// Match the whitespace at the beginning of a line and give it an indentation level.
|
||||
pub(crate) fn indentation_level<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
pub(crate) fn indentation_level<'s>(
|
||||
context: RefContext<'_, '_, '_, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, (IndentationLevel, OrgSource<'s>)> {
|
||||
let (remaining, leading_whitespace) = space0(input)?;
|
||||
|
||||
Reference in New Issue
Block a user