General code cleanup

This commit is contained in:
Zhaofeng Li 2022-01-25 14:22:26 -08:00
parent 0019fa8239
commit c0107b21e0
2 changed files with 9 additions and 20 deletions

View file

@ -166,7 +166,7 @@ impl Deployment {
Ok(()) Ok(())
} else { } else {
// Do the whole eval-build-deploy flow // Do the whole eval-build-deploy flow
let targets = mem::replace(&mut self.targets, HashMap::new()); let targets = mem::take(&mut self.targets);
let deployment = DeploymentHandle::new(self); let deployment = DeploymentHandle::new(self);
let meta_future = meta.run(|meta| async move { let meta_future = meta.run(|meta| async move {
match deployment.options.evaluator { match deployment.options.evaluator {
@ -414,7 +414,7 @@ impl Deployment {
return Err(ColmenaError::Unsupported); return Err(ColmenaError::Unsupported);
} }
let mut host = target.host.as_mut().unwrap(); let host = target.host.as_mut().unwrap();
host.set_job(Some(job.clone())); host.set_job(Some(job.clone()));
host.copy_closure( host.copy_closure(
@ -423,7 +423,7 @@ impl Deployment {
CopyOptions::default().include_outputs(true), CopyOptions::default().include_outputs(true),
).await?; ).await?;
let profile = profile_drv.realize_remote(&mut host).await?; let profile = profile_drv.realize_remote(host).await?;
job.success_with_message(format!("Built {:?} on target node", profile.as_path()))?; job.success_with_message(format!("Built {:?} on target node", profile.as_path()))?;
Ok((target, profile)) Ok((target, profile))
@ -538,8 +538,7 @@ impl Deployment {
if profile.exists() { if profile.exists() {
job.message("Remote profile known".to_string())?; job.message("Remote profile known".to_string())?;
} else { } else if arc_self.options.force_replace_unknown_profiles {
if arc_self.options.force_replace_unknown_profiles {
job.message("Warning: Remote profile is unknown, but unknown profiles are being ignored".to_string())?; job.message("Warning: Remote profile is unknown, but unknown profiles are being ignored".to_string())?;
} else { } else {
return Err(ColmenaError::ActiveProfileUnknown { return Err(ColmenaError::ActiveProfileUnknown {
@ -547,7 +546,6 @@ impl Deployment {
}); });
} }
} }
}
host.activate(&profile_r, arc_self.goal).await?; host.activate(&profile_r, arc_self.goal).await?;

View file

@ -84,7 +84,7 @@ pub struct NodeConfig {
} }
/// Nix options. /// Nix options.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Default)]
pub struct NixOptions { pub struct NixOptions {
/// Whether to pass --show-trace. /// Whether to pass --show-trace.
show_trace: bool, show_trace: bool,
@ -179,15 +179,6 @@ impl NodeConfig {
} }
} }
impl Default for NixOptions {
fn default() -> Self {
Self {
show_trace: false,
builders: None,
}
}
}
impl NixOptions { impl NixOptions {
pub fn set_show_trace(&mut self, show_trace: bool) { pub fn set_show_trace(&mut self, show_trace: bool) {
self.show_trace = show_trace; self.show_trace = show_trace;