diff --git a/src/data.rs b/src/data.rs index a545d113..272eccd5 100644 --- a/src/data.rs +++ b/src/data.rs @@ -7,8 +7,8 @@ use clap::Parser; use linked_hash_set::LinkedHashSet; use merge::Merge; use rnix::{types::*, SyntaxKind::*}; -use thiserror::Error; use std::net::{SocketAddr, ToSocketAddrs}; +use thiserror::Error; use crate::settings; @@ -73,11 +73,7 @@ impl<'a> Target { } }; Ok({ - let hostname_: Option = if ip.is_some() { - ip - } else { - hostname - }; + let hostname_: Option = if ip.is_some() { ip } else { hostname }; let d = DeployData::new( repo, node.to_owned(), @@ -182,7 +178,6 @@ impl std::str::FromStr for Target { }; }; - let mut node: Option = None; let mut profile: Option = None; @@ -197,7 +192,7 @@ impl std::str::FromStr for Target { node: None, profile: None, ip, // NB: error if not none; catched on target resolve - }) + }); } }; @@ -291,9 +286,7 @@ fn test_deploy_target_from_str() { ); assert_eq!( - "../examples/system#example" - .parse::() - .unwrap(), + "../examples/system#example".parse::().unwrap(), Target { repo: "../examples/system".to_string(), node: Some("example".to_string()), @@ -340,7 +333,6 @@ pub struct DeployData<'a> { // over potentially a series of sockets to deploy // to // pub sockets: Vec, - pub ssh_user: String, pub ssh_uri: String, pub temp_path: String, @@ -450,18 +442,24 @@ impl<'a> DeployData<'a> { }; let hostname = match hostname { Some(x) => x, - None => if let Some(x) = &node.node_settings.hostname { - x.to_string() - } else { - return Err(DeployDataError::NoHost(node_name)); - }, + None => { + if let Some(x) = &node.node_settings.hostname { + x.to_string() + } else { + return Err(DeployDataError::NoHost(node_name)); + } + } }; let maybe_iter = &mut hostname[..].to_socket_addrs(); let sockets: Vec = match maybe_iter { Ok(x) => x.into_iter().collect(), - Err(err) => return Err( - DeployDataError::InvalidSockent(repo, hostname, err.to_string()), - ), + Err(err) => { + return Err(DeployDataError::InvalidSockent( + repo, + hostname, + err.to_string(), + )) + } }; let ssh_uri = format!("ssh://{}@{}", &ssh_user, sockets.first().unwrap()); diff --git a/src/deploy.rs b/src/deploy.rs index cef64458..1a25e0fc 100644 --- a/src/deploy.rs +++ b/src/deploy.rs @@ -18,7 +18,10 @@ pub struct SshCommand<'a> { impl<'a> SshCommand<'a> { pub fn from_data(d: &'a data::DeployData) -> Result { let opts = d.merged_settings.ssh_opts.as_ref(); - Ok(SshCommand { ssh_uri: d.ssh_uri.as_ref(), opts }) + Ok(SshCommand { + ssh_uri: d.ssh_uri.as_ref(), + opts, + }) } fn build(&self) -> Command { @@ -299,7 +302,6 @@ pub async fn confirm_profile( ssh: SshCommand<'_>, confirm: ConfirmCommand<'_>, ) -> Result<(), ConfirmProfileError> { - debug!("Entering confirm_profile function ..."); let mut ssh_confirm_cmd = ssh.build(); @@ -349,7 +351,6 @@ pub async fn deploy_profile( wait: WaitCommand<'_>, confirm: ConfirmCommand<'_>, ) -> Result<(), DeployProfileError> { - debug!("Entering deploy_profile function ..."); if !activate.dry_activate { @@ -383,7 +384,6 @@ pub async fn deploy_profile( info!("Success activating, done!"); } } else { - let ssh_activate = ssh_activate_cmd .arg(activate_cmd) .spawn() @@ -457,7 +457,6 @@ pub async fn revoke( ssh: SshCommand<'_>, revoke: RevokeCommand<'_>, ) -> Result<(), RevokeProfileError> { - debug!("Entering revoke function ..."); info!( diff --git a/src/push.rs b/src/push.rs index 1f4d011b..7dd9d096 100644 --- a/src/push.rs +++ b/src/push.rs @@ -113,12 +113,12 @@ impl<'a> CopyCommand<'a> { fast_connection: d.merged_settings.fast_connection, check_sigs: &d.flags.checksigs, hostname: uri, - nix_ssh_opts: format!("{} -p {}", - d - .merged_settings - .ssh_opts - .iter() - .fold("".to_string(), |s, o| format!("{} {}", s, o)), + nix_ssh_opts: format!( + "{} -p {}", + d.merged_settings + .ssh_opts + .iter() + .fold("".to_string(), |s, o| format!("{} {}", s, o)), port, ), } @@ -203,7 +203,6 @@ pub async fn push_profile( sign: SignCommand<'_>, copy: CopyCommand<'_>, ) -> Result<(), PushProfileError> { - debug!("Entering push_profil function ..."); let node_name = build.node_name; @@ -240,10 +239,7 @@ pub async fn push_profile( let mut build_cmd = build.build(*derivation_name, supports_flakes); - let build_cmd_handle = build_cmd - .output() - .await - .map_err(PushProfileError::Build)?; + let build_cmd_handle = build_cmd.output().await.map_err(PushProfileError::Build)?; match build_cmd_handle.status.code() { Some(0) => (),