Avoid having an Rc to a PathBuf

This commit is contained in:
Roey Darwish Dror
2020-12-01 08:59:59 +02:00
parent 60ba90aa66
commit 19d052a3d3
2 changed files with 6 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
#![allow(clippy::cognitive_complexity, clippy::clippy::rc_buffer)] #![allow(clippy::cognitive_complexity)]
mod config; mod config;
mod ctrlc; mod ctrlc;
mod error; mod error;

View File

@@ -26,7 +26,7 @@ impl BoxStatus {
#[derive(Debug)] #[derive(Debug)]
pub struct VagrantBox { pub struct VagrantBox {
path: Rc<PathBuf>, path: Rc<Path>,
name: String, name: String,
initial_status: BoxStatus, initial_status: BoxStatus,
} }
@@ -53,7 +53,7 @@ struct Vagrant {
impl Vagrant { impl Vagrant {
fn get_boxes<'a>(&self, directory: &'a str) -> Result<Vec<VagrantBox>> { fn get_boxes<'a>(&self, directory: &'a str) -> Result<Vec<VagrantBox>> {
let path = Rc::new(PathBuf::from(directory)); let path: Rc<Path> = Path::new(directory).into();
let output = Command::new(&self.path) let output = Command::new(&self.path)
.arg("status") .arg("status")
@@ -111,7 +111,7 @@ impl<'a> TemporaryPowerOn<'a> {
ctx.run_type() ctx.run_type()
.execute(vagrant) .execute(vagrant)
.args(&[subcommand, &vagrant_box.name]) .args(&[subcommand, &vagrant_box.name])
.current_dir(vagrant_box.path.as_path()) .current_dir(vagrant_box.path.clone())
.check_run()?; .check_run()?;
Ok(TemporaryPowerOn { Ok(TemporaryPowerOn {
vagrant, vagrant,
@@ -138,7 +138,7 @@ impl<'a> Drop for TemporaryPowerOn<'a> {
.run_type() .run_type()
.execute(self.vagrant) .execute(self.vagrant)
.args(&[subcommand, &self.vagrant_box.name]) .args(&[subcommand, &self.vagrant_box.name])
.current_dir(self.vagrant_box.path.as_path()) .current_dir(self.vagrant_box.path.clone())
.check_run() .check_run()
.ok(); .ok();
} }
@@ -194,7 +194,7 @@ pub fn topgrade_vagrant_box(ctx: &ExecutionContext, vagrant_box: &VagrantBox) ->
ctx.run_type() ctx.run_type()
.execute(&vagrant.path) .execute(&vagrant.path)
.current_dir(&vagrant_box.path.as_path()) .current_dir(&vagrant_box.path)
.args(&["ssh", "-c", &command]) .args(&["ssh", "-c", &command])
.check_run() .check_run()
} }