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

@@ -20,8 +20,7 @@ impl FileAccessInterface for LocalFileAccessInterface {
fn read_file(&self, path: &str) -> Result<String, std::io::Error> {
let final_path = self
.working_directory
.as_ref()
.map(PathBuf::as_path)
.as_deref()
.map(|pb| pb.join(path))
.unwrap_or_else(|| PathBuf::from(path));
Ok(std::fs::read_to_string(final_path)?)

View File

@@ -126,14 +126,10 @@ impl<'g, 's> Default for GlobalSettings<'g, 's> {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Default)]
pub enum HeadlineLevelFilter {
Odd,
#[default]
OddEven,
}
impl Default for HeadlineLevelFilter {
fn default() -> Self {
HeadlineLevelFilter::OddEven
}
}

View File

@@ -64,7 +64,7 @@ impl<'a, T> Iterator for IterList<'a, T> {
fn next(&mut self) -> Option<Self::Item> {
let ret = self.next;
self.next = self.next.map(|this| this.get_parent()).flatten();
self.next = self.next.and_then(|link| link.get_parent());
ret
}
}

View File

@@ -7,7 +7,7 @@ pub(crate) use parser_with_context;
macro_rules! bind_context {
($target:expr, $context:expr) => {
move |i| $target($context, i)
|i| $target($context, i)
};
}
pub(crate) use bind_context;