From 80d5d1da5c42aeab8abd2ae61a1e685c0e29ca34 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Fri, 4 Oct 2024 10:09:53 -0500 Subject: [PATCH] Versions -> v1.2.3 (vs v.1.2.3); Cargo fmt --- src/app.rs | 19 ++++++++++--------- src/installers/file.rs | 2 +- src/installers/shell.rs | 2 +- src/installers/single_binary_zip.rs | 2 +- src/installers/symlink.rs | 15 +++++++++++---- src/installers/tarball.rs | 2 +- src/installers/zip.rs | 2 +- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/app.rs b/src/app.rs index 8e2939f..c751fed 100644 --- a/src/app.rs +++ b/src/app.rs @@ -9,9 +9,9 @@ use crate::installers::installer::Installer; use crate::installers::pip::Pip; use crate::installers::shell::Shell; use crate::installers::single_binary_zip::SingleBinaryZip; +use crate::installers::symlink::Symlink; use crate::installers::tarball::Tarball; use crate::installers::zip::Zip; -use crate::installers::symlink::Symlink; pub enum AppType { SingleBinaryZip, @@ -21,7 +21,7 @@ pub enum AppType { Conda, Pip, Zip, - Symlink + Symlink, } pub struct App { @@ -166,7 +166,7 @@ impl App { }; Ok(()) }) - .with_context(|| format!("While installing {} v.{}", &self.name, &self.version))?; + .with_context(|| format!("While installing {} v{}", &self.name, &self.version))?; Ok(()) } @@ -275,7 +275,7 @@ mod tests { .expect("Failed to construct App"); assert_eq!( single_binary_zip_app.installer.describe(), - "single binary zip installer for single_binary_zip_app v.1.10.1" + "single binary zip installer for single_binary_zip_app v1.10.1" ); } @@ -286,7 +286,7 @@ mod tests { App::new(&"tarball_app".to_string(), &config).expect("Failed to construct App"); assert_eq!( tarball_app.installer.describe(), - "tarball installer for tarball_app v.0.7.0" + "tarball installer for tarball_app v0.7.0" ); } @@ -297,7 +297,7 @@ mod tests { App::new(&"shell_app".to_string(), &config).expect("Failed to construct App"); assert_eq!( shell_app.installer.describe(), - "shell installer for shell_app v.4.11.0" + "shell installer for shell_app v4.11.0" ); } @@ -328,16 +328,17 @@ mod tests { let file_app = App::new(&"file_app".to_string(), &config).expect("Failed to construct App"); assert_eq!( file_app.installer.describe(), - "file installer for file_app v.6.6.0" + "file installer for file_app v6.6.0" ); } #[test] fn symlink_test() { let config = get_test_config(); - let file_app = App::new(&"symlink_app".to_string(), &config).expect("Failed to construct App"); + let file_app = + App::new(&"symlink_app".to_string(), &config).expect("Failed to construct App"); assert_eq!( file_app.installer.describe(), - "symlink installer for symlink_app v.5.6.7" + "symlink installer for symlink_app v5.6.7" ); } } diff --git a/src/installers/file.rs b/src/installers/file.rs index 19674b8..d6023a2 100644 --- a/src/installers/file.rs +++ b/src/installers/file.rs @@ -45,6 +45,6 @@ impl Installer for File { } fn describe(&self) -> String { - format!("file installer for {} v.{}", self.name, self.version) + format!("file installer for {} v{}", self.name, self.version) } } diff --git a/src/installers/shell.rs b/src/installers/shell.rs index 0483fa0..6bb3070 100644 --- a/src/installers/shell.rs +++ b/src/installers/shell.rs @@ -85,6 +85,6 @@ impl Installer for Shell { } fn describe(&self) -> String { - format!("shell installer for {} v.{}", self.name, self.version) + format!("shell installer for {} v{}", self.name, self.version) } } diff --git a/src/installers/single_binary_zip.rs b/src/installers/single_binary_zip.rs index c2dcff5..5ce7d89 100644 --- a/src/installers/single_binary_zip.rs +++ b/src/installers/single_binary_zip.rs @@ -61,7 +61,7 @@ impl Installer for SingleBinaryZip { fn describe(&self) -> String { format!( - "single binary zip installer for {} v.{}", + "single binary zip installer for {} v{}", self.name, self.version ) } diff --git a/src/installers/symlink.rs b/src/installers/symlink.rs index 299f7df..da2a3cf 100644 --- a/src/installers/symlink.rs +++ b/src/installers/symlink.rs @@ -24,7 +24,7 @@ impl Symlink { Ok(Symlink { name: name.clone(), version: version.to_string(), - path: path.to_owned() + path: path.to_owned(), }) } } @@ -35,14 +35,21 @@ impl Installer for Symlink { std::fs::create_dir_all(to_dir)?; if !self.path.exists() { - return Err(anyhow!("Destination symlink {} doesn't exist", self.path.display())) + return Err(anyhow!( + "Destination symlink {} doesn't exist", + self.path.display() + )); } let file = to_dir.join(&self.name); - std::os::unix::fs::symlink(&self.path, &file).context(anyhow!("Unable to symlink {} to {}", self.path.display(), file.display())) + std::os::unix::fs::symlink(&self.path, &file).context(anyhow!( + "Unable to symlink {} to {}", + self.path.display(), + file.display() + )) } fn describe(&self) -> String { - format!("symlink installer for {} v.{}", self.name, self.version) + format!("symlink installer for {} v{}", self.name, self.version) } } diff --git a/src/installers/tarball.rs b/src/installers/tarball.rs index 7dbb794..34c4833 100644 --- a/src/installers/tarball.rs +++ b/src/installers/tarball.rs @@ -64,6 +64,6 @@ impl Installer for Tarball { } fn describe(&self) -> String { - format!("tarball installer for {} v.{}", self.name, self.version) + format!("tarball installer for {} v{}", self.name, self.version) } } diff --git a/src/installers/zip.rs b/src/installers/zip.rs index 2b96815..48236a4 100644 --- a/src/installers/zip.rs +++ b/src/installers/zip.rs @@ -43,6 +43,6 @@ impl Installer for Zip { } fn describe(&self) -> String { - format!("zip installer for {} v.{}", self.name, self.version) + format!("zip installer for {} v{}", self.name, self.version) } }