summaryrefslogtreecommitdiffstats
path: root/src/repository/repository.rs
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-08-30 09:56:38 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-08-30 09:57:25 +0200
commit44b8f52b895c356abef4ca0d5ee8fe2db2984e9f (patch)
tree4ccea07a4817092210b2b647936c9677edafc421 /src/repository/repository.rs
parentc1aaad85e086adf2cbea564b4f3e22d4d64294c8 (diff)
Fix: implement unimplemented!()
This fixes a missed unimplemented!() in the codebase. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/repository/repository.rs')
-rw-r--r--src/repository/repository.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/repository/repository.rs b/src/repository/repository.rs
index 3cab7c0..d5f90f3 100644
--- a/src/repository/repository.rs
+++ b/src/repository/repository.rs
@@ -17,6 +17,7 @@ use anyhow::Context;
use anyhow::Error;
use anyhow::Result;
use log::trace;
+use resiter::AndThen;
use resiter::FilterMap;
use resiter::Map;
@@ -92,19 +93,17 @@ impl Repository {
// get the patches that are in the `config` object after the merge
let patches = get_patches(&config)?
.into_iter()
- .map(|p| {
- if let Some(current_dir) = path.parent() {
- current_dir.join(p)
- } else {
- unimplemented!()
- }
+ .map(|p| if let Some(current_dir) = path.parent() {
+ Ok(current_dir.join(p))
+ } else {
+ Err(anyhow!("Path should point to path with parent, but doesn't: {}", path.display()))
})
.inspect(|patch| trace!("Patch: {:?}", patch))
// if the patch file exists, use it (as config::Value).
//
// Otherwise we have an error here, because we're refering to a non-existing file.
- .map(|patch| if patch.exists() {
+ .and_then_ok(|patch| if patch.exists() {
trace!("Path to patch exists: {}", patch.display());
Ok(Some(patch))
} else if patches_before_merge.iter().any(|pb| pb.file_name() == patch.file_name()) {