Apply more suggestions.

This commit is contained in:
Tom Alexander
2023-10-16 16:51:26 -04:00
parent 728f79b86c
commit 4ba0e3611b
3 changed files with 18 additions and 31 deletions

View File

@@ -19,7 +19,7 @@ pub struct AffiliatedKeyword<'s> {
pub value: AffiliatedKeywordValue<'s>,
}
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct AffiliatedKeywords<'s> {
pub(crate) keywords: BTreeMap<String, AffiliatedKeywordValue<'s>>,
}
@@ -27,11 +27,3 @@ pub struct AffiliatedKeywords<'s> {
pub trait GetAffiliatedKeywords<'s> {
fn get_affiliated_keywords<'a>(&'a self) -> &'a AffiliatedKeywords<'s>;
}
impl<'s> Default for AffiliatedKeywords<'s> {
fn default() -> Self {
AffiliatedKeywords {
keywords: BTreeMap::new(),
}
}
}

View File

@@ -101,9 +101,8 @@ impl<'s> Heading<'s> {
_ => None,
})
.flat_map(|section| section.children.iter())
.take_while(|element| match element {
Element::Planning(_) | Element::PropertyDrawer(_) => true,
_ => false,
.take_while(|element| {
matches!(element, Element::Planning(_) | Element::PropertyDrawer(_))
})
.find_map(|element| match element {
Element::PropertyDrawer(property_drawer) => Some(property_drawer),
@@ -121,10 +120,8 @@ impl<'s> Document<'s> {
.iter()
.flat_map(|zeroth_section| zeroth_section.children.iter());
let property_drawer = zeroth_section_children
.take_while(|element| match element {
Element::Comment(_) => true,
Element::PropertyDrawer(_) => true,
_ => false,
.take_while(|element| {
matches!(element, Element::Comment(_) | Element::PropertyDrawer(_))
})
.find_map(|element| match element {
Element::PropertyDrawer(property_drawer) => Some(property_drawer),