summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-04-08 20:28:09 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-04-08 20:55:09 +0200
commitbaa820c60675f84ed0652f0b11feefe9230a97a1 (patch)
tree12bf24c202dd8952e032ed2ee7dd8897ae9281fc
parent5c36c119f9448baf6bfe5245c6ebac1aa09d5b43 (diff)
Remove helper Source::exists()
It is easier for the caller (because more visible what happens) to call `Source::path().exists()`. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/commands/source.rs8
-rw-r--r--src/source/mod.rs4
2 files changed, 4 insertions, 8 deletions
diff --git a/src/commands/source.rs b/src/commands/source.rs
index 7f4a1bb..50f6a30 100644
--- a/src/commands/source.rs
+++ b/src/commands/source.rs
@@ -154,7 +154,7 @@ pub async fn list_missing(_: &ArgMatches, config: &Configuration, repo: Reposito
repo.packages().try_for_each(|p| {
for source in sc.sources_for(p) {
- if !source.exists() {
+ if !source.path().exists() {
writeln!(
outlock,
"{} {} -> {}",
@@ -244,7 +244,7 @@ pub async fn download(
let bar = multi.add(progressbars.spinner());
bar.set_message(&format!("Downloading {}", source.url()));
async move {
- if !source.exists() && source.download_manually() {
+ if !source.path().exists() && source.download_manually() {
return Err(anyhow!(
"Cannot download source that is marked for manual download"
))
@@ -253,10 +253,10 @@ pub async fn download(
.map_err(Error::from);
}
- if source.exists() && !force {
+ if source.path().exists() && !force {
Err(anyhow!("Source exists: {}", source.path().display()))
} else {
- if source.exists() {
+ if source.path().exists() {
let _ = source.remove_file().await?;
}
diff --git a/src/source/mod.rs b/src/source/mod.rs
index ec0e2e2..7ce00e5 100644
--- a/src/source/mod.rs
+++ b/src/source/mod.rs
@@ -75,10 +75,6 @@ impl SourceEntry {
.collect()
}
- pub fn exists(&self) -> bool {
- self.source_file_path().exists()
- }
-
pub fn path(&self) -> PathBuf {
self.source_file_path()
}