From 445188ea7cc92585e0ef672cb84c47f7d2aa7e58 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Fri, 8 Nov 2024 11:21:00 -0800 Subject: [PATCH] fixup: cargo clippy --- src/action/common/configure_init_service.rs | 4 +- .../macos/bootstrap_launchctl_service.rs | 2 +- src/action/macos/encrypt_apfs_volume.rs | 2 +- src/settings.rs | 50 +++++++++---------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/action/common/configure_init_service.rs b/src/action/common/configure_init_service.rs index cd9871d74..128fd6550 100644 --- a/src/action/common/configure_init_service.rs +++ b/src/action/common/configure_init_service.rs @@ -270,7 +270,7 @@ impl Action for ConfigureInitService { Command::new("launchctl") .process_group(0) .arg("enable") - .arg(&format!("{domain}/{service}")) + .arg(format!("{domain}/{service}")) .stdin(std::process::Stdio::null()), ) .await @@ -283,7 +283,7 @@ impl Action for ConfigureInitService { .process_group(0) .arg("kickstart") .arg("-k") - .arg(&format!("{domain}/{service}")) + .arg(format!("{domain}/{service}")) .stdin(std::process::Stdio::null()), ) .await diff --git a/src/action/macos/bootstrap_launchctl_service.rs b/src/action/macos/bootstrap_launchctl_service.rs index 6db3a5a7b..ca3a9c9b2 100644 --- a/src/action/macos/bootstrap_launchctl_service.rs +++ b/src/action/macos/bootstrap_launchctl_service.rs @@ -100,7 +100,7 @@ impl Action for BootstrapLaunchctlService { Command::new("launchctl") .process_group(0) .arg("enable") - .arg(&format!("{DARWIN_LAUNCHD_DOMAIN}/{service}")) + .arg(format!("{DARWIN_LAUNCHD_DOMAIN}/{service}")) .stdin(std::process::Stdio::null()), ) .await diff --git a/src/action/macos/encrypt_apfs_volume.rs b/src/action/macos/encrypt_apfs_volume.rs index 773819259..8314bafcd 100644 --- a/src/action/macos/encrypt_apfs_volume.rs +++ b/src/action/macos/encrypt_apfs_volume.rs @@ -44,7 +44,7 @@ impl EncryptApfsVolume { command.arg("-s"); command.arg("Nix Store"); command.arg("-l"); - command.arg(&format!("{} encryption password", disk.display())); + command.arg(format!("{} encryption password", disk.display())); command.arg("-D"); command.arg("Encrypted volume password"); command.process_group(0); diff --git a/src/settings.rs b/src/settings.rs index 6540c64ad..49482af07 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -645,6 +645,31 @@ impl crate::diagnostics::ErrorDiagnostic for InstallSettingsError { } } +pub fn determinate_nix_settings() -> nix_config_parser::NixConfig { + let mut cfg = nix_config_parser::NixConfig::new(); + let settings = cfg.settings_mut(); + + settings.insert("netrc-file".into(), "/nix/var/determinate/netrc".into()); + + let extra_substituters = ["https://cache.flakehub.com"]; + match settings.entry("extra-substituters".to_string()) { + Entry::Occupied(mut slot) => { + let slot_mut = slot.get_mut(); + for extra_substituter in extra_substituters { + if !slot_mut.contains(extra_substituter) { + *slot_mut += " "; + *slot_mut += extra_substituter; + } + } + }, + Entry::Vacant(slot) => { + let _ = slot.insert(extra_substituters.join(" ")); + }, + }; + + cfg +} + #[cfg(test)] mod tests { use super::{FromStr, PathBuf, Url, UrlOrPath, UrlOrPathOrString}; @@ -689,28 +714,3 @@ mod tests { Ok(()) } } - -pub fn determinate_nix_settings() -> nix_config_parser::NixConfig { - let mut cfg = nix_config_parser::NixConfig::new(); - let settings = cfg.settings_mut(); - - settings.insert("netrc-file".into(), "/nix/var/determinate/netrc".into()); - - let extra_substituters = ["https://cache.flakehub.com"]; - match settings.entry("extra-substituters".to_string()) { - Entry::Occupied(mut slot) => { - let slot_mut = slot.get_mut(); - for extra_substituter in extra_substituters { - if !slot_mut.contains(extra_substituter) { - *slot_mut += " "; - *slot_mut += extra_substituter; - } - } - }, - Entry::Vacant(slot) => { - let _ = slot.insert(extra_substituters.join(" ")); - }, - }; - - cfg -}