From 85a6d6cc9a1cf3863b969eb25b80107d51f337f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Fri, 13 Sep 2024 07:16:34 +0200 Subject: [PATCH] refactor: handle clippy lints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- crates/nix-weather/src/cli.rs | 1 - crates/nix-weather/src/nix.rs | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/crates/nix-weather/src/cli.rs b/crates/nix-weather/src/cli.rs index 78b8d0d..fdb6acf 100644 --- a/crates/nix-weather/src/cli.rs +++ b/crates/nix-weather/src/cli.rs @@ -6,7 +6,6 @@ use clap::{arg, command, crate_authors, value_parser, ArgAction, Command}; const DEFAULT_CACHE: &str = "cache.nixos.org"; -const DEFAULT_INSTALLABLE: &str = "./#nixosConfigurations.{}.config.system.build.toplevel"; pub fn build_cli() -> Command { command!() diff --git a/crates/nix-weather/src/nix.rs b/crates/nix-weather/src/nix.rs index dd1fe30..3f10b3f 100644 --- a/crates/nix-weather/src/nix.rs +++ b/crates/nix-weather/src/nix.rs @@ -29,11 +29,7 @@ fn get_config_drv_path(host: &str, config_dir: &str) -> std::io::Result std::io::Result { +fn get_installable_drv_path(installable: &str) -> std::io::Result { Command::new("nix") .args(["build", "--quiet", installable, "--dry-run", "--json"]) .output() @@ -69,9 +65,9 @@ fn requisites_to_hashes( pub fn get_requisites(host: &str, config_dir: &str, installable: Option) -> String { // If the users specified an installable, we interpret that, instead of trying // to guess their config location. - let mut drv_path; + let drv_path; if let Some(installable) = installable { - drv_path = get_installable_drv_path(host, config_dir, &installable).unwrap(); + drv_path = get_installable_drv_path(&installable).unwrap(); } else { drv_path = get_config_drv_path(host, config_dir).unwrap(); }