diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-04-08 20:30:32 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-04-08 20:55:09 +0200 |
commit | 1e6f780bea00c1ef8cfe15350a7613d6aad67832 (patch) | |
tree | 2e1cf79b0a99fa6fca494087a05eef70c1b99f5a /src | |
parent | cbdea0872d4e3f12ce08546667daa6015d0c087b (diff) |
Optimize: Remove helper
Because we can just use the actual interface function here.
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/source/mod.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/source/mod.rs b/src/source/mod.rs index 7ce00e5..7b84c30 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -47,14 +47,6 @@ pub struct SourceEntry { } impl SourceEntry { - fn source_file_path(&self) -> PathBuf { - self.source_file_directory().join(format!( - "{}-{}.source", - self.package_source_name, - self.package_source.hash().value() - )) - } - fn source_file_directory(&self) -> PathBuf { self.cache_root .join(format!("{}-{}", self.package_name, self.package_version)) @@ -76,7 +68,11 @@ impl SourceEntry { } pub fn path(&self) -> PathBuf { - self.source_file_path() + self.source_file_directory().join(format!( + "{}-{}.source", + self.package_source_name, + self.package_source.hash().value() + )) } pub fn url(&self) -> &Url { @@ -88,13 +84,13 @@ impl SourceEntry { } pub async fn remove_file(&self) -> Result<()> { - let p = self.source_file_path(); + let p = self.path(); tokio::fs::remove_file(&p).await?; Ok(()) } pub async fn verify_hash(&self) -> Result<()> { - let p = self.source_file_path(); + let p = self.path(); trace!("Verifying : {}", p.display()); let reader = tokio::fs::OpenOptions::new() @@ -114,7 +110,7 @@ impl SourceEntry { } pub async fn create(&self) -> Result<tokio::fs::File> { - let p = self.source_file_path(); + let p = self.path(); trace!("Creating source file: {}", p.display()); if !self.cache_root.is_dir() { |