From d2e4cb85af2c6101cd435c10cfd3d4084cd83e76 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 18 Jun 2026 00:50:06 +0800 Subject: refactor: use `io::Error::other` and simplify closures --- rola-bucket/src/protocol.rs | 2 ++ rola-bucket/src/protocol/local_fs.rs | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'rola-bucket/src') diff --git a/rola-bucket/src/protocol.rs b/rola-bucket/src/protocol.rs index b4d60a8..6d1074a 100644 --- a/rola-bucket/src/protocol.rs +++ b/rola-bucket/src/protocol.rs @@ -1,3 +1,5 @@ +#![allow(clippy::manual_async_fn)] + use std::path::Path; mod error; diff --git a/rola-bucket/src/protocol/local_fs.rs b/rola-bucket/src/protocol/local_fs.rs index 1f287f2..b3885a7 100644 --- a/rola-bucket/src/protocol/local_fs.rs +++ b/rola-bucket/src/protocol/local_fs.rs @@ -38,7 +38,7 @@ impl BucketTransferProtocol for LocalFileSystemProtocol { let abs_send_path = req.absolute_file_path_to_upload; let abs_receive_path = bucket_root.join(req.relative_file_path_to_receive); copy_with_temp_rename(abs_send_path, abs_receive_path) - .map_err(|e| BucketTransferProtocolError::IoError(e))?; + .map_err(BucketTransferProtocolError::IoError)?; Ok(()) } @@ -54,7 +54,7 @@ impl BucketTransferProtocol for LocalFileSystemProtocol { let abs_send_path = bucket_root.join(req.relative_file_path_to_transfer); let abs_receive_path = req.absolute_file_path_to_download; copy_with_temp_rename(abs_send_path, abs_receive_path) - .map_err(|e| BucketTransferProtocolError::IoError(e))?; + .map_err(BucketTransferProtocolError::IoError)?; Ok(()) } @@ -70,7 +70,7 @@ impl BucketTransferProtocol for LocalFileSystemProtocol { let abs_send_path = req.absolute_file_path_to_transfer; let abs_receive_path = client_root.join(req.relative_file_path_to_download); copy_with_temp_rename(abs_send_path, abs_receive_path) - .map_err(|e| BucketTransferProtocolError::IoError(e))?; + .map_err(BucketTransferProtocolError::IoError)?; Ok(()) } @@ -86,7 +86,7 @@ impl BucketTransferProtocol for LocalFileSystemProtocol { let abs_send_path = req.absolute_file_path_to_receive; let abs_receive_path = client_root.join(req.relative_file_path_to_upload); copy_with_temp_rename(abs_send_path, abs_receive_path) - .map_err(|e| BucketTransferProtocolError::IoError(e))?; + .map_err(BucketTransferProtocolError::IoError)?; Ok(()) } } -- cgit