From 085543a9127eb691ba4980515e78ee3af70ec77f Mon Sep 17 00:00:00 2001 From: elcoosp Date: Tue, 3 Dec 2024 14:48:24 +0100 Subject: [PATCH] chore: run clippy --- cli/src/args.rs | 11 +++-------- cli/src/rule.rs | 6 +++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/cli/src/args.rs b/cli/src/args.rs index d2e34cb..dcf631f 100644 --- a/cli/src/args.rs +++ b/cli/src/args.rs @@ -56,7 +56,7 @@ impl Args { if let Some(edit) = self.edit.as_deref() { if edit != "false" { let msg = std::fs::read_to_string(edit) - .expect(format!("Failed to read commit message from {}", edit).as_str()); + .unwrap_or_else(|_| panic!("Failed to read commit message from {}", edit)); return Ok(vec![Message::new(msg)]); } } @@ -87,13 +87,8 @@ impl Args { } let default_path = std::path::PathBuf::from(".git").join("COMMIT_EDITMSG"); - let msg = std::fs::read_to_string(&default_path).expect( - format!( - "Failed to read commit message from {}", - default_path.display() - ) - .as_str(), - ); + let msg = std::fs::read_to_string(&default_path).unwrap_or_else(|_| panic!("Failed to read commit message from {}", + default_path.display())); Ok(vec![Message::new(msg)]) } } diff --git a/cli/src/rule.rs b/cli/src/rule.rs index 3ed4b4b..ca315ba 100644 --- a/cli/src/rule.rs +++ b/cli/src/rule.rs @@ -245,7 +245,7 @@ macro_rules! make_length_rule { $ident:ident, $length_of_what:literal ) => { - crate::make_rule! { + $crate::make_rule! { $ident, #[doc = concat!("Length represents the maximum length of the ",stringify!($length_of_what),".")] length: usize @@ -259,7 +259,7 @@ macro_rules! make_format_rule { $ident:ident, $format_of_what:literal ) => { - crate::make_rule! { + $crate::make_rule! { $ident, #[doc = concat!("Format represents the format of the ",stringify!($format_of_what),".")] format: Option @@ -278,7 +278,7 @@ macro_rules! make_options_rule { )* $field_name:ident: $field_type:ty ),*) => { - crate::make_rule! { + $crate::make_rule! { $ident, $( $(