From 41a96f49fcaf6193a63b122a48d3c57278558163 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 22 Nov 2023 14:50:25 -0500 Subject: [PATCH] Clippy nits while hacking around (#737) * clippy: unnecessary guard * create merge nix config clippy nit, old * Clean up a clippy nit on an extra clone * clippy nit legacy wsl detection error --- src/action/base/create_or_merge_nix_config.rs | 2 +- src/action/common/configure_init_service.rs | 2 +- src/diagnostics.rs | 2 +- src/planner/linux.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/action/base/create_or_merge_nix_config.rs b/src/action/base/create_or_merge_nix_config.rs index 4a0239c..7b1b587 100644 --- a/src/action/base/create_or_merge_nix_config.rs +++ b/src/action/base/create_or_merge_nix_config.rs @@ -412,7 +412,7 @@ impl Action for CreateOrMergeNixConfig { new_config .push_str("# Generated by https://github.com/DeterminateSystems/nix-installer.\n"); new_config.push_str("# See `/nix/nix-installer --version` for the version details.\n"); - new_config.push_str("\n"); + new_config.push('\n'); for (name, value) in merged_nix_config.settings() { new_config.push_str(name); diff --git a/src/action/common/configure_init_service.rs b/src/action/common/configure_init_service.rs index 1997abc..a6b109f 100644 --- a/src/action/common/configure_init_service.rs +++ b/src/action/common/configure_init_service.rs @@ -169,7 +169,7 @@ impl Action for ConfigureInitService { #[cfg(target_os = "macos")] InitSystem::Launchd => { let src = std::path::Path::new(DARWIN_NIX_DAEMON_SOURCE); - tokio::fs::copy(src.clone(), DARWIN_NIX_DAEMON_DEST) + tokio::fs::copy(src, DARWIN_NIX_DAEMON_DEST) .await .map_err(|e| { Self::error(ActionErrorKind::Copy( diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 294f579..dbd86c8 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -261,7 +261,7 @@ pub fn diagnostic_endpoint_parser(input: &str) -> Result, Diagnostic "https" | "http" | "file" => Ok(Some(v)), _ => Err(DiagnosticError::UnknownUrlScheme), }, - Err(url_error) if url_error == url::ParseError::RelativeUrlWithoutBase => { + Err(url::ParseError::RelativeUrlWithoutBase) => { match Url::parse(&format!("file://{input}")) { Ok(v) => Ok(Some(v)), Err(file_error) => Err(file_error)?, diff --git a/src/planner/linux.rs b/src/planner/linux.rs index 21a2ba1..9fc3487 100644 --- a/src/planner/linux.rs +++ b/src/planner/linux.rs @@ -220,9 +220,9 @@ pub(crate) async fn check_nix_not_already_installed() -> Result<(), PlannerError pub(crate) fn check_systemd_active() -> Result<(), PlannerError> { if !Path::new("/run/systemd/system").exists() { if std::env::var("WSL_DISTRO_NAME").is_ok() { - return Err(LinuxErrorKind::Wsl2SystemdNotActive)?; + return Err(LinuxErrorKind::Wsl2SystemdNotActive.into()); } else { - return Err(LinuxErrorKind::SystemdNotActive)?; + return Err(LinuxErrorKind::SystemdNotActive.into()); } }