From f4057336d5d22325d722fa6d68d9c74f93eb719b Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Wed, 8 Nov 2023 18:50:02 +0100 Subject: [PATCH 1/3] Fix clippy::from_str_radix_10 --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c291ef2..790ccd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,7 +135,7 @@ impl Config { } let width = width - .map(|w| i32::from_str_radix(w, 10).map_err(|_| CliError::ArgWidthNaN(w.into()))) + .map(|w| w.parse().map_err(|_| CliError::ArgWidthNaN(w.into()))) .transpose()? .unwrap_or(72); From cb2c8f08eac41668750c658f73dd3701aac83460 Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Wed, 8 Nov 2023 18:50:05 +0100 Subject: [PATCH 2/3] Fix clippy::needless_lifetimes --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 790ccd3..ce90374 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,7 +126,7 @@ pub struct Config { } impl Config { - fn new<'a>(args: Vec>) -> CliResult<'a, Config> { + fn new(args: Vec>) -> CliResult<'_, Config> { let mut width: Option<&str> = None; for arg in args { match arg { From 54e69eec299b45ae392bdbc413ca66b8f4ed5712 Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Wed, 8 Nov 2023 18:49:29 +0100 Subject: [PATCH 3/3] Fix clippy::needless_borrow --- src/commitmsgfmt.rs | 7 +++---- src/main.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/commitmsgfmt.rs b/src/commitmsgfmt.rs index a917921..e862fc1 100644 --- a/src/commitmsgfmt.rs +++ b/src/commitmsgfmt.rs @@ -37,8 +37,7 @@ impl CommitMsgFmt { fn reflow_into(&self, buf: &mut String, msg: &[Token]) { for tok in msg { match *tok { - BlockQuote(ref s) | Comment(ref s) | Literal(ref s) | Scissored(ref s) - | Trailer(ref s) => { + BlockQuote(s) | Comment(s) | Literal(s) | Scissored(s) | Trailer(s) => { buf.push_str(s); } ListItem(ref indent, ref li, ref s) => { @@ -55,13 +54,13 @@ impl CommitMsgFmt { Paragraph(ref p) => { self.wrap_paragraph_into(buf, p, None); } - Footnote(ref key, ref rest) => { + Footnote(key, ref rest) => { buf.push_str(key); buf.push(' '); let continuation = " ".repeat(key.graphemes(true).count() + 1); self.wrap_paragraph_into(buf, rest.trim(), Some(&continuation)); } - Subject(ref s) => { + Subject(s) => { buf.push_str(s); } VerticalSpace => {} diff --git a/src/main.rs b/src/main.rs index ce90374..b936ccb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -194,7 +194,7 @@ fn main() { fn try_config_from_command_line(args: &'_ [String]) -> CliResult<'_, Config> { let (binary_path, args) = args.split_first().expect("binary has name"); - parse_args(&args) + parse_args(args) .into_iter() .try_fold(vec![], |mut acc, arg| match arg { CliArgument::HelpLong => Err(CliError::EarlyExit(