diff options
Diffstat (limited to 'dhall/src/semantics/resolve/cache.rs')
-rw-r--r-- | dhall/src/semantics/resolve/cache.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/dhall/src/semantics/resolve/cache.rs b/dhall/src/semantics/resolve/cache.rs index 7763f18..b00a2d5 100644 --- a/dhall/src/semantics/resolve/cache.rs +++ b/dhall/src/semantics/resolve/cache.rs @@ -55,11 +55,9 @@ impl Cache { pub fn get(&self, hash: &Hash) -> Result<Typed, Error> { let path = self.entry_path(hash); let res = read_cache_file(&path, hash); - if let Err(_) = res { - if path.exists() { - // Delete cache file since it's invalid. We ignore the error. - let _ = std::fs::remove_file(&path); - } + if res.is_err() && path.exists() { + // Delete cache file since it's invalid. We ignore the error. + let _ = std::fs::remove_file(&path); } res } |