diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-25 14:23:55 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-25 14:23:55 +0800 |
| commit | e2e29c3934e40cfd4fde6f1b5e7517810c3bf1cd (patch) | |
| tree | 2629abac480a4ca697c8dec09e7f79f690be3b8b /crates/vcs/src/workspace/vault/virtual_file.rs | |
| parent | 300b0eeb68618a2b66469e83b79384a2d612c05d (diff) | |
Fixed by Clippy
Diffstat (limited to 'crates/vcs/src/workspace/vault/virtual_file.rs')
| -rw-r--r-- | crates/vcs/src/workspace/vault/virtual_file.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/vcs/src/workspace/vault/virtual_file.rs b/crates/vcs/src/workspace/vault/virtual_file.rs index 6e8c28d..95f3d8c 100644 --- a/crates/vcs/src/workspace/vault/virtual_file.rs +++ b/crates/vcs/src/workspace/vault/virtual_file.rs @@ -236,11 +236,10 @@ impl Vault { VirtualFileMeta::write_to(&meta, self.virtual_file_meta_path(&new_id)).await?; // Move temp file to virtual file directory - if let Some(parent) = move_path.parent() { - if !parent.exists() { + if let Some(parent) = move_path.parent() + && !parent.exists() { fs::create_dir_all(parent).await?; } - } fs::rename(receive_path, move_path).await?; Ok(new_id) @@ -251,7 +250,7 @@ impl Vault { fs::remove_file(receive_path).await?; } - Err(Error::new(ErrorKind::Other, e)) + Err(Error::other(e)) } } } @@ -312,7 +311,7 @@ impl Vault { VirtualFileMeta::write_to(&meta, self.virtual_file_meta_path(virtual_file_id)) .await?; - return Ok(()); + Ok(()) } Err(e) => { // Read failed, remove temp file. @@ -320,7 +319,7 @@ impl Vault { fs::remove_file(receive_path).await?; } - return Err(Error::new(ErrorKind::Other, e)); + Err(Error::other(e)) } } } |
