summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/core/libimagstore/src/file_abstraction/fs.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/core/libimagstore/src/file_abstraction/fs.rs b/lib/core/libimagstore/src/file_abstraction/fs.rs
index 131edcba..189032ba 100644
--- a/lib/core/libimagstore/src/file_abstraction/fs.rs
+++ b/lib/core/libimagstore/src/file_abstraction/fs.rs
@@ -105,15 +105,14 @@ impl FileAbstraction for FSFileAbstraction {
}
fn rename(&self, from: &PathBuf, to: &PathBuf) -> Result<()> {
- match to.parent() {
- Some(p) => if !p.exists() {
+ if let Some(p) = to.parent() {
+ if !p.exists() {
debug!("Creating: {:?}", p);
- let _ = create_dir_all(&PathBuf::from(p)).context(EM::DirNotCreated)?;
- },
- None => {
- debug!("Failed to find parent. This looks like it will fail now");
- //nothing
- },
+ let _ = create_dir_all(&p).context(EM::DirNotCreated)?;
+ }
+ } else {
+ debug!("Failed to find parent. This looks like it will fail now");
+ //nothing
}
debug!("Renaming {:?} to {:?}", from, to);