From e93aa4ceae630a15bf50988e44b5ba2e9986d648 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 2 Dec 2015 13:06:08 +0100 Subject: [PATCH] Refactor uses of file-id-parsing functions to ensure we honnor the Result type --- src/storage/backend.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storage/backend.rs b/src/storage/backend.rs index e89dc049..22c37f31 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -60,7 +60,11 @@ impl StorageBackend { for entry in globlist { if let Ok(path) = entry { debug!(" - File: {:?}", path); - v.push(from_pathbuf(&path)); + if let Ok(id) = from_pathbuf(&path) { + v.push(id); + } else { + error!("Cannot parse ID from path: {:?}", path); + } } else { // Entry is not a path } @@ -77,6 +81,7 @@ impl StorageBackend { glob(&self.prefix_of_files_for_module(m)[..]).and_then(|globlist| { let v = globlist.filter_map(Result::ok) .map(|pbuf| from_pathbuf(&pbuf)) + .filter_map(Result::ok) .collect::>() .into_iter(); Ok(v)