From 003386f9c9026ad53723d37babe8a42821655404 Mon Sep 17 00:00:00 2001 From: Hamir Mahal Date: Mon, 11 Nov 2024 12:04:53 -0800 Subject: [PATCH] refactor: remove redundant references (`&`) --- cargo-pgrx/src/command/cross/pgrx_target.rs | 2 +- cargo-pgrx/src/command/init.rs | 2 +- cargo-pgrx/src/command/install.rs | 2 +- cargo-pgrx/src/command/schema.rs | 6 +++--- cargo-pgrx/src/command/test.rs | 2 +- pgrx-bindgen/src/build.rs | 4 ++-- pgrx-pg-config/src/lib.rs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cargo-pgrx/src/command/cross/pgrx_target.rs b/cargo-pgrx/src/command/cross/pgrx_target.rs index ccd4e62aab..0e97c0e99e 100644 --- a/cargo-pgrx/src/command/cross/pgrx_target.rs +++ b/cargo-pgrx/src/command/cross/pgrx_target.rs @@ -112,7 +112,7 @@ fn make_target_info(cmd: &PgrxTarget, tmp: &Path) -> Result<()> { .arg("--features") .arg(format!("pgrx-pg-sys/pg{major_version}")) .env("PGRX_PG_CONFIG_PATH", &pg_config_path) - .env("PGRX_PG_SYS_EXTRA_OUTPUT_PATH", &tmp.join(&filename)))?; + .env("PGRX_PG_SYS_EXTRA_OUTPUT_PATH", tmp.join(&filename)))?; run(Command::new("rustfmt").current_dir(tmp).arg(&filename))?; run(Command::new("tar").current_dir(tmp).arg("czf").arg("out.tgz").arg(&filename))?; diff --git a/cargo-pgrx/src/command/init.rs b/cargo-pgrx/src/command/init.rs index 2acc46bfdf..6bc533e677 100644 --- a/cargo-pgrx/src/command/init.rs +++ b/cargo-pgrx/src/command/init.rs @@ -273,7 +273,7 @@ fn untar(bytes: &[u8], pgrxdir: &Path, pg_config: &PgConfig, init: &Init) -> eyr let _token = init.jobserver.get().unwrap().acquire().unwrap(); let mut unpackdir = pgrxdir.to_path_buf(); - unpackdir.push(&format!("{}_unpack", pg_config.version()?)); + unpackdir.push(format!("{}_unpack", pg_config.version()?)); if unpackdir.exists() { // delete everything at this path if it already exists println!("{} {}", " Removing".bold().green(), unpackdir.display()); diff --git a/cargo-pgrx/src/command/install.rs b/cargo-pgrx/src/command/install.rs index 2f5840bbcc..31c9b436ad 100644 --- a/cargo-pgrx/src/command/install.rs +++ b/cargo-pgrx/src/command/install.rs @@ -131,7 +131,7 @@ pub(crate) fn install_extension( let mut output_tracking = Vec::new(); let base_directory = base_directory.unwrap_or_else(|| PathBuf::from("/")); tracing::Span::current() - .record("base_directory", &tracing::field::display(&base_directory.display())); + .record("base_directory", tracing::field::display(&base_directory.display())); let manifest = Manifest::from_path(&package_manifest_path)?; let (control_file, extname) = find_control_file(&package_manifest_path)?; diff --git a/cargo-pgrx/src/command/schema.rs b/cargo-pgrx/src/command/schema.rs index 01d717dd3a..a6adb12266 100644 --- a/cargo-pgrx/src/command/schema.rs +++ b/cargo-pgrx/src/command/schema.rs @@ -343,7 +343,7 @@ fn first_build( if !features_arg.trim().is_empty() { command.arg("--features"); - command.arg(&features_arg); + command.arg(features_arg); } if features.no_default_features { @@ -387,7 +387,7 @@ fn compute_codegen( dot: Option, ) -> eyre::Result { use proc_macro2::{Ident, Span, TokenStream}; - let lib_name_ident = Ident::new(&lib_name, Span::call_site()); + let lib_name_ident = Ident::new(lib_name, Span::call_site()); let inputs = { let control_file_path = control_file_path @@ -501,7 +501,7 @@ fn second_build( if !features_arg.trim().is_empty() { command.arg("--features"); - command.arg(&features_arg); + command.arg(features_arg); } if features.no_default_features { diff --git a/cargo-pgrx/src/command/test.rs b/cargo-pgrx/src/command/test.rs index df935e7c9a..0be4f96396 100644 --- a/cargo-pgrx/src/command/test.rs +++ b/cargo-pgrx/src/command/test.rs @@ -127,7 +127,7 @@ pub fn test_extension( pgdata: Option, ) -> eyre::Result<()> { if let Some(ref testname) = testname { - tracing::Span::current().record("testname", &tracing::field::display(&testname.as_ref())); + tracing::Span::current().record("testname", tracing::field::display(&testname.as_ref())); } let target_dir = get_target_dir()?; diff --git a/pgrx-bindgen/src/build.rs b/pgrx-bindgen/src/build.rs index 9af0b9cbef..2916c1c813 100644 --- a/pgrx-bindgen/src/build.rs +++ b/pgrx-bindgen/src/build.rs @@ -315,7 +315,7 @@ fn generate_bindings( }; for dest_dir in dest_dirs { let mut bindings_file = dest_dir.clone(); - bindings_file.push(&format!("pg{major_version}.rs")); + bindings_file.push(format!("pg{major_version}.rs")); write_rs_file( rewritten_items.clone(), &bindings_file, @@ -334,7 +334,7 @@ fn generate_bindings( })?; let mut oids_file = dest_dir.clone(); - oids_file.push(&format!("pg{major_version}_oids.rs")); + oids_file.push(format!("pg{major_version}_oids.rs")); write_rs_file(oids.clone(), &oids_file, quote! {}, is_for_release).wrap_err_with(|| { format!( "Unable to write oids file for pg{} to `{}`", diff --git a/pgrx-pg-config/src/lib.rs b/pgrx-pg-config/src/lib.rs index 8c1c01246f..39d4c3a539 100644 --- a/pgrx-pg-config/src/lib.rs +++ b/pgrx-pg-config/src/lib.rs @@ -747,7 +747,7 @@ fn does_db_exist(pg_config: &PgConfig, dbname: &str) -> eyre::Result { .arg(pg_config.port()?.to_string()) .arg("template1") .arg("-c") - .arg(&format!( + .arg(format!( "select count(*) from pg_database where datname = '{}';", dbname.replace('\'', "''") ))