Clippy fixes.
clippy Build clippy has succeeded Details
rust-foreign-document-test Build rust-foreign-document-test has succeeded Details
rust-build Build rust-build has succeeded Details
rust-test Build rust-test has succeeded Details

This commit is contained in:
Tom Alexander 2023-10-18 18:39:04 -04:00
parent b2479e9de8
commit e11de60def
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 3 additions and 10 deletions

View File

@ -149,7 +149,7 @@ where
AffiliatedKeywords { keywords: ret }
}
fn translate_name<'g, 's>(name: &'s str) -> String {
fn translate_name(name: &str) -> String {
let name_until_optval = name
.split_once('[')
.map(|(before, _after)| before)
@ -169,7 +169,7 @@ enum AffiliatedKeywordType {
ObjectTree,
}
fn identify_keyword_type<'g, 's>(name: &'s str) -> AffiliatedKeywordType {
fn identify_keyword_type(name: &str) -> AffiliatedKeywordType {
let is_multiple = ["CAPTION", "HEADER"]
.into_iter()
.any(|candidate| name.eq_ignore_ascii_case(candidate))

View File

@ -221,19 +221,12 @@ mod tests {
use test::Bencher;
use super::*;
use crate::context::Context;
use crate::context::ContextElement;
use crate::context::GlobalSettings;
use crate::context::List;
use crate::parser::OrgSource;
#[bench]
fn bench_affiliated_keyword(b: &mut Bencher) {
let input = OrgSource::new("#+CAPTION[*foo*]: bar *baz*");
let global_settings = GlobalSettings::default();
let initial_context = ContextElement::document_context();
let initial_context = Context::new(&global_settings, List::new(&initial_context));
b.iter(|| assert!(affiliated_keyword(&initial_context, input).is_ok()));
b.iter(|| assert!(affiliated_keyword(input).is_ok()));
}
}