mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 08:15:29 +00:00
craft-cloud-local: collapse the etag conflict check into one let chain
The current clippy denies collapsible_if here. Behaviour is unchanged. A missing file still has nothing to conflict with.
This commit is contained in:
1 parent
b1fce2be74
commit
07d2747efc
1 file changed
+4
-4
@@ -190,10 +190,10 @@ fn read(root: &Path, entry: &Entry) -> Result<Vec<u8>, Fault> {
|
||||
/// conflict with, the same way a provider treats a deleted document.
|
||||
fn write(root: &Path, entry: &Entry, bytes: &[u8]) -> Result<Entry, Fault> {
|
||||
let file = resolve(root, &entry.id)?;
|
||||
if let Ok(meta) = fs::metadata(&file) {
|
||||
if Some(etag_of(&meta)) != entry.etag {
|
||||
return Err(Fault::Conflict);
|
||||
}
|
||||
if let Ok(meta) = fs::metadata(&file)
|
||||
&& Some(etag_of(&meta)) != entry.etag
|
||||
{
|
||||
return Err(Fault::Conflict);
|
||||
}
|
||||
if let Some(parent) = file.parent() {
|
||||
fs::create_dir_all(parent).map_err(|error| io_fault(&error))?;
|
||||
|
||||
Reference in new issue
Block a user