refaactor: small cleanup
This commit is contained in:
parent
6ad77d8daa
commit
7e5cff719a
1 changed files with 10 additions and 14 deletions
|
|
@ -389,21 +389,17 @@ impl RustyPipeBuilder {
|
||||||
Box::new(FileStorage::new(cache_file))
|
Box::new(FileStorage::new(cache_file))
|
||||||
});
|
});
|
||||||
|
|
||||||
let cdata = if let Some(storage) = &storage {
|
let cdata = storage
|
||||||
if let Some(data) = storage.read() {
|
.as_ref()
|
||||||
match serde_json::from_str::<CacheData>(&data) {
|
.and_then(|storage| storage.read())
|
||||||
Ok(data) => data,
|
.and_then(|data| match serde_json::from_str::<CacheData>(&data) {
|
||||||
Err(e) => {
|
Ok(data) => Some(data),
|
||||||
log::error!("Could not deserialize cache. Error: {}", e);
|
Err(e) => {
|
||||||
CacheData::default()
|
log::error!("Could not deserialize cache. Error: {}", e);
|
||||||
}
|
None
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
CacheData::default()
|
.unwrap_or_default();
|
||||||
}
|
|
||||||
} else {
|
|
||||||
CacheData::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
RustyPipe {
|
RustyPipe {
|
||||||
inner: Arc::new(RustyPipeRef {
|
inner: Arc::new(RustyPipeRef {
|
||||||
|
|
|
||||||
Reference in a new issue