Fix lints

This commit is contained in:
Edward Shen 2021-05-20 13:42:08 -04:00
parent a3f3b5e3ab
commit 7f16e697e6
Signed by: edward
GPG key ID: 19182661E818369F

22
src/cache/fs.rs vendored
View file

@ -91,20 +91,18 @@ pub(super) async fn read_file(
return None; return None;
} }
let header = match Header::from_slice(&header_bytes) { let header = if let Some(header) = Header::from_slice(&header_bytes) {
Some(header) => header, header
None => { } else {
warn!("Found file, but encrypted header was invalid. Assuming corrupted!"); warn!("Found file, but encrypted header was invalid. Assuming corrupted!");
return None; return None;
}
}; };
let secret_stream = match SecretStream::init_pull(&header, key) { let secret_stream = if let Ok(stream) = SecretStream::init_pull(&header, key) {
Ok(stream) => stream, stream
Err(_) => { } else {
warn!("Failed to init secret stream with key and header. Assuming corrupted!"); warn!("Failed to init secret stream with key and header. Assuming corrupted!");
return None; return None;
}
}; };
Box::pin(EncryptedDiskReader::new(file, secret_stream)) Box::pin(EncryptedDiskReader::new(file, secret_stream))