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
This commit is contained in:
Graham Christensen 2023-11-22 14:50:25 -05:00 committed by GitHub
parent df9610edba
commit 41a96f49fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -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);

View file

@ -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(

View file

@ -261,7 +261,7 @@ pub fn diagnostic_endpoint_parser(input: &str) -> Result<Option<Url>, 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)?,

View file

@ -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());
}
}