Apply more suggestions.

This commit is contained in:
Tom Alexander
2023-10-16 18:29:21 -04:00
parent 4b6c717812
commit 3069711447
22 changed files with 86 additions and 114 deletions

View File

@@ -206,11 +206,7 @@ fn headline<'b, 'g, 'r, 's>(
.map(|(_, (_, title))| title)
.unwrap_or(Vec::new()),
tags: maybe_tags
.map(|(_ws, tags)| {
tags.into_iter()
.map(|single_tag| Into::<&str>::into(single_tag))
.collect()
})
.map(|(_ws, tags)| tags.into_iter().map(Into::<&str>::into).collect())
.unwrap_or(Vec::new()),
is_footnote_section,
},
@@ -265,11 +261,8 @@ fn heading_keyword<'b, 'g, 'r, 's>(
.map(String::as_str)
{
let result = tag::<_, _, CustomError<_>>(todo_keyword)(input);
match result {
Ok((remaining, ent)) => {
return Ok((remaining, (TodoKeywordType::Todo, ent)));
}
Err(_) => {}
if let Ok((remaining, ent)) = result {
return Ok((remaining, (TodoKeywordType::Todo, ent)));
}
}
for todo_keyword in global_settings
@@ -278,20 +271,17 @@ fn heading_keyword<'b, 'g, 'r, 's>(
.map(String::as_str)
{
let result = tag::<_, _, CustomError<_>>(todo_keyword)(input);
match result {
Ok((remaining, ent)) => {
return Ok((remaining, (TodoKeywordType::Done, ent)));
}
Err(_) => {}
if let Ok((remaining, ent)) = result {
return Ok((remaining, (TodoKeywordType::Done, ent)));
}
}
Err(nom::Err::Error(CustomError::MyError(MyError(
"NoTodoKeyword".into(),
"NoTodoKeyword",
))))
}
}
fn priority_cookie<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PriorityCookie> {
fn priority_cookie(input: OrgSource<'_>) -> Res<OrgSource<'_>, PriorityCookie> {
let (remaining, (_, priority_character, _)) = tuple((
tag("[#"),
verify(anychar, |c| c.is_alphanumeric()),
@@ -299,7 +289,7 @@ fn priority_cookie<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PriorityCooki
))(input)?;
let cookie = PriorityCookie::try_from(priority_character).map_err(|_| {
nom::Err::Error(CustomError::MyError(MyError(
"Failed to cast priority cookie to number.".into(),
"Failed to cast priority cookie to number.",
)))
})?;
Ok((remaining, cookie))