From 07acd6dddef81e5d67c20ea2b5ce343eaabaa1df Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Wed, 13 Jul 2022 14:12:11 +0100 Subject: [PATCH] Fix clippy warnings in postgres_ffi/build.rs (#2081) --- libs/postgres_ffi/build.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libs/postgres_ffi/build.rs b/libs/postgres_ffi/build.rs index 703d972480..c6df4fc0b0 100644 --- a/libs/postgres_ffi/build.rs +++ b/libs/postgres_ffi/build.rs @@ -50,8 +50,6 @@ fn main() { // - if POSTGRES_INSTALL_DIR is set look into it, otherwise look into `/tmp_install` // - if there's a `bin/pg_config` file use it for getting include server, otherwise use `/tmp_install/include/postgresql/server` let mut pg_install_dir: PathBuf; - let inc_server_path: String; - if let Some(postgres_install_dir) = env::var_os("POSTGRES_INSTALL_DIR") { pg_install_dir = postgres_install_dir.into(); } else { @@ -64,7 +62,7 @@ fn main() { } let pg_config_bin = pg_install_dir.join("bin").join("pg_config"); - if pg_config_bin.exists() { + let inc_server_path: String = if pg_config_bin.exists() { let output = Command::new(pg_config_bin) .arg("--includedir-server") .output() @@ -74,16 +72,16 @@ fn main() { panic!("`pg_config --includedir-server` failed") } - inc_server_path = String::from_utf8(output.stdout).unwrap().trim_end().into(); + String::from_utf8(output.stdout).unwrap().trim_end().into() } else { - inc_server_path = pg_install_dir + pg_install_dir .join("include") .join("postgresql") .join("server") .into_os_string() .into_string() - .unwrap(); - } + .unwrap() + }; // The bindgen::Builder is the main entry point // to bindgen, and lets you build up options for