From 2e927e544aea46a9f84ed63160a708e51b201835 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Fri, 27 Jan 2023 15:45:09 -0500 Subject: [PATCH 1/5] clippy: avoid `uninlined_format_args` lints --- ghostflow/src/actions/dashboard.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ghostflow/src/actions/dashboard.rs b/ghostflow/src/actions/dashboard.rs index ffd41015..f3557517 100644 --- a/ghostflow/src/actions/dashboard.rs +++ b/ghostflow/src/actions/dashboard.rs @@ -118,7 +118,7 @@ impl Dashboard { data.insert("refname", Cow::Borrowed(refname)); } if let Some(pipeline_id) = commit.last_pipeline { - data.insert("pipeline_id", format!("{}", pipeline_id).into()); + data.insert("pipeline_id", pipeline_id.to_string().into()); } data }; @@ -156,7 +156,7 @@ impl Dashboard { .cloned() .collect(); if let Some(pipeline_id) = mr.commit.last_pipeline { - data.insert("pipeline_id", format!("{}", pipeline_id).into()); + data.insert("pipeline_id", pipeline_id.to_string().into()); } data }; @@ -202,7 +202,7 @@ impl Dashboard { .cloned() .collect(); if let Some(pipeline_id) = commit.last_pipeline { - data.insert("pipeline_id", format!("{}", pipeline_id).into()); + data.insert("pipeline_id", pipeline_id.to_string().into()); } data }; -- GitLab From f22007bac12a36b6dd8092b368478c79810e9179 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Fri, 27 Jan 2023 15:45:20 -0500 Subject: [PATCH 2/5] clippy: fix `needless_borrowed_reference` lints --- ghostflow/src/actions/merge/settings.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ghostflow/src/actions/merge/settings.rs b/ghostflow/src/actions/merge/settings.rs index 44c96577..8367d033 100644 --- a/ghostflow/src/actions/merge/settings.rs +++ b/ghostflow/src/actions/merge/settings.rs @@ -385,7 +385,7 @@ impl<'a> Merger<'a> { Ok(target_commit) as MergeResult<_>, |target_commit, source_branch: String| { let target_commit = target_commit?; - let &(ref source_commit, _) = + let (source_commit, _) = push_refs.get(&source_branch).ok_or_else(|| { InternalMergeError::into_branch_sorting( source_branch.clone(), @@ -556,9 +556,7 @@ impl<'a> Merger<'a> { self.trailers .iter() // Filter trailers through the policy. - .for_each(|&(ref trailer, ref user_opt)| { - mr_policy.process_trailer(trailer, user_opt.as_ref()) - }); + .for_each(|(trailer, user_opt)| mr_policy.process_trailer(trailer, user_opt.as_ref())); let trailers = match mr_policy.result() { Ok(trailers) => trailers.into_iter().unique(), -- GitLab From cdd12654dd156c90ae715b7110cd3f367c2089f6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Fri, 27 Jan 2023 15:45:27 -0500 Subject: [PATCH 3/5] clippy: fix `needless_lifetimes` lints --- ghostflow/src/actions/merge/settings.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghostflow/src/actions/merge/settings.rs b/ghostflow/src/actions/merge/settings.rs index 8367d033..b4e42ee5 100644 --- a/ghostflow/src/actions/merge/settings.rs +++ b/ghostflow/src/actions/merge/settings.rs @@ -478,10 +478,10 @@ impl<'a> Merger<'a> { } /// Create a merge commit for the merge request into the branch. - pub fn create_merge<'b, P>( + pub fn create_merge<P>( &self, settings: &MergeSettings<P>, - info: &MergeInformation<'b>, + info: &MergeInformation, commit_id: &CommitId, ) -> StepResult<CommitId> where -- GitLab From 9dbcb1492758c1d4e3ce57b2cce818f02e9b1571 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Fri, 27 Jan 2023 15:47:29 -0500 Subject: [PATCH 4/5] clippy: ignore `uninlined_format_args` lints --- ghostflow-cli/src/main.rs | 3 +++ ghostflow-github/src/lib.rs | 3 +++ ghostflow-gitlab/src/lib.rs | 3 +++ ghostflow/src/lib.rs | 2 ++ 4 files changed, 11 insertions(+) diff --git a/ghostflow-cli/src/main.rs b/ghostflow-cli/src/main.rs index a751898e..65e94c43 100644 --- a/ghostflow-cli/src/main.rs +++ b/ghostflow-cli/src/main.rs @@ -4,6 +4,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// XXX(rust-1.66)] +#![allow(clippy::uninlined_format_args)] + //! ghostflow-cli //! //! This is a command line tool which may be used to perform workflow actions on a repository. diff --git a/ghostflow-github/src/lib.rs b/ghostflow-github/src/lib.rs index 83d6741d..8a4bcdf4 100644 --- a/ghostflow-github/src/lib.rs +++ b/ghostflow-github/src/lib.rs @@ -4,6 +4,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// XXX(rust-1.66)] +#![allow(clippy::uninlined_format_args)] + mod authorization; // Required to be in the root for `graphql-client`. diff --git a/ghostflow-gitlab/src/lib.rs b/ghostflow-gitlab/src/lib.rs index 75fa79eb..5f950b16 100644 --- a/ghostflow-gitlab/src/lib.rs +++ b/ghostflow-gitlab/src/lib.rs @@ -4,6 +4,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// XXX(rust-1.66)] +#![allow(clippy::uninlined_format_args)] + use std::collections::hash_map::HashMap; use std::fmt; use std::sync::Arc; diff --git a/ghostflow/src/lib.rs b/ghostflow/src/lib.rs index 712abfee..b0eead04 100644 --- a/ghostflow/src/lib.rs +++ b/ghostflow/src/lib.rs @@ -6,6 +6,8 @@ #![warn(missing_docs)] #![recursion_limit = "128"] +// XXX(rust-1.66)] +#![allow(clippy::uninlined_format_args)] //! Ghostflow //! -- GitLab From db98b214e6983f64ef9dc70cf085b68c8171b175 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Fri, 27 Jan 2023 15:47:38 -0500 Subject: [PATCH 5/5] clippy: fix `result_large_err` lint --- ghostflow-cli/src/command/check/run/commits.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghostflow-cli/src/command/check/run/commits.rs b/ghostflow-cli/src/command/check/run/commits.rs index 59c960bd..8bbf86ae 100644 --- a/ghostflow-cli/src/command/check/run/commits.rs +++ b/ghostflow-cli/src/command/check/run/commits.rs @@ -46,7 +46,7 @@ pub enum CommitsError { Check { commit: CommitId, #[source] - source: RunError, + source: Box<RunError>, }, #[error("failed to run git: {}", source)] Git { @@ -91,7 +91,7 @@ impl CommitsError { fn check(commit: CommitId, source: RunError) -> Self { CommitsError::Check { commit, - source, + source: Box::new(source), } } -- GitLab