From 41aa206efab06b47fe607b60b187488039991b8c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 12 Aug 2021 16:45:43 +0200 Subject: Fix clippy: Remove needless borrows This patch was slightly adapted, for the moved src/ui.rs file. (cherry picked from commit 80825bb43c7a4f188aa060b04513168978c1db0b) Signed-off-by: Matthias Beyer --- src/commands/build.rs | 2 +- src/commands/find_artifact.rs | 2 +- src/filestore/path.rs | 2 +- src/job/runnable.rs | 4 ++-- src/main.rs | 10 +++++----- src/orchestrator/orchestrator.rs | 2 +- src/package/script.rs | 2 +- src/ui.rs | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/commands/build.rs b/src/commands/build.rs index 8825750..fd35f38 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -289,7 +289,7 @@ pub async fn build( .collect::>>()?; trace!("Setting up database jobs for Package, GitHash, Image"); - let db_package = async { Package::create_or_fetch(&database_connection, &package) }; + let db_package = async { Package::create_or_fetch(&database_connection, package) }; let db_githash = async { GitHash::create_or_fetch(&database_connection, &hash_str) }; let db_image = async { Image::create_or_fetch(&database_connection, &image_name) }; let db_envs = async { diff --git a/src/commands/find_artifact.rs b/src/commands/find_artifact.rs index 19e8e2f..0fc9b8c 100644 --- a/src/commands/find_artifact.rs +++ b/src/commands/find_artifact.rs @@ -102,7 +102,7 @@ pub async fn find_artifact(matches: &ArgMatches, config: &Configuration, progres .inspect(|pkg| trace!("Found package: {:?}", pkg)) .map(|pkg| { let script_filter = !matches.is_present("no_script_filter"); - let pathes = crate::db::find_artifacts(database.clone(), config, &pkg, &release_stores, staging_store.as_ref(), &env_filter, script_filter)?; + let pathes = crate::db::find_artifacts(database.clone(), config, pkg, &release_stores, staging_store.as_ref(), &env_filter, script_filter)?; pathes.iter() .map(|tpl| (tpl.0.joined(), tpl.1)) diff --git a/src/filestore/path.rs b/src/filestore/path.rs index 4de941b..6c7558b 100644 --- a/src/filestore/path.rs +++ b/src/filestore/path.rs @@ -48,7 +48,7 @@ impl StoreRoot { let join = self.0.join(&ap.0); if join.is_file() { - Ok(Some(FullArtifactPath(&self, ap))) + Ok(Some(FullArtifactPath(self, ap))) } else if join.is_dir() { Err(anyhow!("Cannot load non-file path: {}", join.display())) } else { diff --git a/src/job/runnable.rs b/src/job/runnable.rs index 22a7d0a..5600273 100644 --- a/src/job/runnable.rs +++ b/src/job/runnable.rs @@ -77,7 +77,7 @@ impl RunnableJob { .inspect(|(name, _)| debug!("Checking: {}", name)) .try_for_each(|(name, _)| { trace!("{:?} contains? {:?}", config.containers().allowed_env(), name); - if !config.containers().allowed_env().contains(&name) { + if !config.containers().allowed_env().contains(name) { Err(anyhow!("Environment variable name not allowed: {}", name)) } else { Ok(()) @@ -127,7 +127,7 @@ impl RunnableJob { } pub fn package_sources(&self) -> Vec { - self.source_cache.sources_for(&self.package()) + self.source_cache.sources_for(self.package()) } pub fn environment(&self) -> impl Iterator { diff --git a/src/main.rs b/src/main.rs index f32b3a5..c6217c7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -143,7 +143,7 @@ async fn main() -> Result<()> { let load_repo = || -> Result { let bar = progressbars.bar(); - let repo = Repository::load(&repo_path, &bar) + let repo = Repository::load(repo_path, &bar) .context("Loading the repository")?; bar.finish_with_message("Repository loading finished"); Ok(repo) @@ -159,13 +159,13 @@ async fn main() -> Result<()> { let repo = load_repo()?; crate::commands::build( - &repo_path, + repo_path, matches, progressbars, conn, &config, repo, - &repo_path, + repo_path, ) .await .context("build command failed")? @@ -228,7 +228,7 @@ async fn main() -> Result<()> { Some(("lint", matches)) => { let repo = load_repo()?; - crate::commands::lint(&repo_path, matches, progressbars, &config, repo) + crate::commands::lint(repo_path, matches, progressbars, &config, repo) .await .context("lint command failed")? } @@ -243,7 +243,7 @@ async fn main() -> Result<()> { Some(("metrics", _)) => { let repo = load_repo()?; let conn = db_connection_config.establish_connection()?; - crate::commands::metrics(&repo_path, &config, repo, conn) + crate::commands::metrics(repo_path, &config, repo, conn) .await .context("metrics command failed")? } diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs index dd1322d..f9703c9 100644 --- a/src/orchestrator/orchestrator.rs +++ b/src/orchestrator/orchestrator.rs @@ -674,7 +674,7 @@ impl<'a> JobTask<'a> { // Create a RunnableJob object let runnable = RunnableJob::build_from_job( - &self.jobdef.job, + self.jobdef.job, self.source_cache, self.config, self.git_author_env, diff --git a/src/package/script.rs b/src/package/script.rs index a0f1527..2b5001a 100644 --- a/src/package/script.rs +++ b/src/package/script.rs @@ -128,7 +128,7 @@ impl<'a> HighlightedScript<'a> { .get(self.script_theme) .ok_or_else(|| anyhow!("Theme not available: {}", self.script_theme))?; - let mut h = HighlightLines::new(syntax, &theme); + let mut h = HighlightLines::new(syntax, theme); Ok({ LinesWithEndings::from(&self.script.0).map(move |line| { diff --git a/src/ui.rs b/src/ui.rs index 526db8c..11747a7 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -30,7 +30,7 @@ use crate::package::ScriptBuilder; use crate::package::Shebang; pub fn package_repo_cleanness_check(repo: &git2::Repository) -> Result<()> { - if !crate::util::git::repo_is_clean(&repo)? { + if !crate::util::git::repo_is_clean(repo)? { error!( "Repository not clean, refusing to go on: {}", repo.path().display() -- cgit v1.2.3