From 868f1132bcf4c8ce3f2a2968531d83f6c88eec00 Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Sat, 5 Nov 2022 14:18:27 +0100 Subject: [PATCH] Fix new clippy lints --- src/lib.rs | 10 +++------- src/references.rs | 4 ++-- tests/export_test.rs | 38 ++++++++++++++++++++------------------ 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cdb44f2..f6fdcbd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -204,7 +204,7 @@ pub enum ExportError { }, } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Emitted by [Postprocessor]s to signal the next action to take. pub enum PostprocessorResult { /// Continue with the next post-processor (if any). @@ -743,9 +743,7 @@ fn create_file(dest: &Path) -> Result { .or_else(|err| { if err.kind() == ErrorKind::NotFound { let parent = dest.parent().expect("file should have a parent directory"); - if let Err(err) = std::fs::create_dir_all(&parent) { - return Err(err); - } + std::fs::create_dir_all(&parent)? } File::create(&dest) }) @@ -758,9 +756,7 @@ fn copy_file(src: &Path, dest: &Path) -> Result<()> { .or_else(|err| { if err.kind() == ErrorKind::NotFound { let parent = dest.parent().expect("file should have a parent directory"); - if let Err(err) = std::fs::create_dir_all(&parent) { - return Err(err); - } + std::fs::create_dir_all(&parent)? } std::fs::copy(&src, &dest) }) diff --git a/src/references.rs b/src/references.rs index e4e244f..b354038 100644 --- a/src/references.rs +++ b/src/references.rs @@ -6,7 +6,7 @@ lazy_static! { Regex::new(r"^(?P[^#|]+)??(#(?P
.+?))??(\|(?P