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(())
} else {
// 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 meta_future = meta.run(|meta| async move {
match deployment.options.evaluator {
@ -414,7 +414,7 @@ impl Deployment {
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.copy_closure(
@ -423,7 +423,7 @@ impl Deployment {
CopyOptions::default().include_outputs(true),
).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()))?;
Ok((target, profile))
@ -538,8 +538,7 @@ impl Deployment {
if profile.exists() {
job.message("Remote profile known".to_string())?;
} else {
if arc_self.options.force_replace_unknown_profiles {
} else if arc_self.options.force_replace_unknown_profiles {
job.message("Warning: Remote profile is unknown, but unknown profiles are being ignored".to_string())?;
} else {
return Err(ColmenaError::ActiveProfileUnknown {
@ -547,7 +546,6 @@ impl Deployment {
});
}
}
}
host.activate(&profile_r, arc_self.goal).await?;

View file

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