diff --git a/src/command/repl.rs b/src/command/repl.rs index 4816747..5e1e93e 100644 --- a/src/command/repl.rs +++ b/src/command/repl.rs @@ -42,7 +42,7 @@ pub async fn run(_global_args: &ArgMatches, local_args: &ArgMatches) -> Result<( if nix_version.at_least(2, 4) { // `nix repl` is expected to be marked as experimental: // - repl_cmd.args(&["--experimental-features", "nix-command flakes"]); + repl_cmd.args(["--experimental-features", "nix-command flakes"]); } if nix_version.at_least(2, 10) { diff --git a/src/nix/evaluator/nix_eval_jobs.rs b/src/nix/evaluator/nix_eval_jobs.rs index f24e049..4fdfb2d 100644 --- a/src/nix/evaluator/nix_eval_jobs.rs +++ b/src/nix/evaluator/nix_eval_jobs.rs @@ -80,12 +80,12 @@ impl DrvSetEvaluator for NixEvalJobs { command .arg("--workers") .arg(self.workers.to_string()) - .args(&["--expr", &expression.expression()]); + .args(["--expr", &expression.expression()]); command.args(flags.to_args()); if expression.requires_flakes() { - command.args(&["--extra-experimental-features", "flakes"]); + command.args(["--extra-experimental-features", "flakes"]); } let mut child = command diff --git a/src/nix/flake.rs b/src/nix/flake.rs index 10c5fff..4e7f72d 100644 --- a/src/nix/flake.rs +++ b/src/nix/flake.rs @@ -87,8 +87,8 @@ impl FlakeMetadata { /// Resolves a flake. async fn resolve(flake: &str) -> ColmenaResult { let child = Command::new("nix") - .args(&["flake", "metadata", "--json"]) - .args(&["--extra-experimental-features", "nix-command flakes"]) + .args(["flake", "metadata", "--json"]) + .args(["--extra-experimental-features", "nix-command flakes"]) .arg(flake) .stdout(Stdio::piped()) .spawn()?; @@ -109,8 +109,8 @@ impl FlakeMetadata { /// Quietly locks the dependencies of a flake. pub async fn lock_flake_quiet(uri: &str) -> ColmenaResult<()> { let status = Command::new("nix") - .args(&["flake", "lock"]) - .args(&["--extra-experimental-features", "nix-command flakes"]) + .args(["flake", "lock"]) + .args(["--extra-experimental-features", "nix-command flakes"]) .arg(uri) .stderr(Stdio::null()) .status() diff --git a/src/nix/hive/mod.rs b/src/nix/hive/mod.rs index f6c695b..8831cc8 100644 --- a/src/nix/hive/mod.rs +++ b/src/nix/hive/mod.rs @@ -416,7 +416,7 @@ impl<'hive> NixInstantiate<'hive> { let mut command = Command::new("nix-instantiate"); if self.hive.is_flake() { - command.args(&["--extra-experimental-features", "flakes"]); + command.args(["--extra-experimental-features", "flakes"]); } let mut full_expression = self.hive.get_base_expression(); diff --git a/src/nix/host/local.rs b/src/nix/host/local.rs index 4034289..a5bf0df 100644 --- a/src/nix/host/local.rs +++ b/src/nix/host/local.rs @@ -104,13 +104,12 @@ impl Host for Local { async fn get_current_system_profile(&mut self) -> ColmenaResult { let paths = Command::new("readlink") - .args(&["-e", CURRENT_PROFILE]) + .args(["-e", CURRENT_PROFILE]) .capture_output() .await?; let path = paths .lines() - .into_iter() .next() .ok_or(ColmenaError::FailedToGetCurrentProfile)? .to_string() @@ -121,7 +120,7 @@ impl Host for Local { async fn get_main_system_profile(&mut self) -> ColmenaResult { let paths = Command::new("sh") - .args(&[ + .args([ "-c", &format!( "readlink -e {} || readlink -e {}", @@ -133,7 +132,6 @@ impl Host for Local { let path = paths .lines() - .into_iter() .next() .ok_or(ColmenaError::FailedToGetCurrentProfile)? .to_string() diff --git a/src/nix/host/ssh.rs b/src/nix/host/ssh.rs index 1622007..6ce6226 100644 --- a/src/nix/host/ssh.rs +++ b/src/nix/host/ssh.rs @@ -112,7 +112,6 @@ impl Host for Ssh { let path = paths .lines() - .into_iter() .next() .ok_or(ColmenaError::FailedToGetCurrentProfile)? .to_string() @@ -131,7 +130,6 @@ impl Host for Ssh { let path = paths .lines() - .into_iter() .next() .ok_or(ColmenaError::FailedToGetCurrentProfile)? .to_string() @@ -265,7 +263,7 @@ impl Ssh { // experimental `nix copy` command with ssh-ng:// let mut command = Command::new("nix"); - command.args(&[ + command.args([ "--extra-experimental-features", "nix-command", "copy", @@ -273,7 +271,7 @@ impl Ssh { ]); if options.use_substitutes { - command.args(&[ + command.args([ "--substitute-on-destination", // needed due to UX bug in ssh-ng:// "--builders-use-substitutes", diff --git a/src/nix/info.rs b/src/nix/info.rs index 16f4ccd..0a20096 100644 --- a/src/nix/info.rs +++ b/src/nix/info.rs @@ -81,7 +81,7 @@ impl NixCheck { let flakes_supported = version.has_flakes(); let flake_cmd = Command::new("nix-instantiate") - .args(&["--eval", "-E", "builtins.getFlake"]) + .args(["--eval", "-E", "builtins.getFlake"]) .stdout(Stdio::null()) .stderr(Stdio::null()) .status() diff --git a/src/nix/profile.rs b/src/nix/profile.rs index 75e1361..b71c637 100644 --- a/src/nix/profile.rs +++ b/src/nix/profile.rs @@ -53,13 +53,13 @@ impl Profile { /// Create a GC root for this profile. pub async fn create_gc_root(&self, path: &Path) -> ColmenaResult<()> { let mut command = Command::new("nix-store"); - command.args(&[ + command.args([ "--no-build-output", "--indirect", "--add-root", path.to_str().unwrap(), ]); - command.args(&["--realise", self.as_path().to_str().unwrap()]); + command.args(["--realise", self.as_path().to_str().unwrap()]); command.stdout(Stdio::null()); let status = command.status().await?; diff --git a/src/nix/store.rs b/src/nix/store.rs index 75c69b1..76dcbae 100644 --- a/src/nix/store.rs +++ b/src/nix/store.rs @@ -46,7 +46,7 @@ impl StorePath { /// Returns the immediate dependencies of the store path. pub async fn references(&self) -> ColmenaResult> { let references = Command::new("nix-store") - .args(&["--query", "--references"]) + .args(["--query", "--references"]) .arg(&self.0) .capture_output() .await? diff --git a/src/util.rs b/src/util.rs index ac17ad2..e131788 100644 --- a/src/util.rs +++ b/src/util.rs @@ -279,7 +279,7 @@ pub async fn hive_from_path(hive_path: HivePath, args: &ArgMatches) -> ColmenaRe } if let Some(opts) = args.get_many::("nix-option") { - let iter = opts.into_iter(); + let iter = opts; let names = iter.clone().step_by(2); let values = iter.clone().skip(1).step_by(2);