From 0f902bcb02d51d3484a0fa679edebf96b3b7410e Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 5 Jan 2022 14:16:50 +0800 Subject: [PATCH] Make clippy happy Signed-off-by: Xuanwo --- common/dal2/src/services/s3.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/dal2/src/services/s3.rs b/common/dal2/src/services/s3.rs index 072ef5da83bb..c6ab58710c56 100644 --- a/common/dal2/src/services/s3.rs +++ b/common/dal2/src/services/s3.rs @@ -89,7 +89,7 @@ impl Builder { // strip the prefix of "/" in root only once. let root = if let Some(root) = self.root { - root.strip_prefix("/").unwrap_or(&root).to_string() + root.strip_prefix('/').unwrap_or(&root).to_string() } else { String::new() }; @@ -160,8 +160,8 @@ impl Backend { /// If user input an absolute path, we will return it as it is with the prefix `/` striped. /// If user input a relative path, we will calculate the absolute path with the root. fn get_abs_path(&self, path: &str) -> String { - if path.starts_with("/") { - path.strip_prefix("/").unwrap().to_string() + if path.starts_with('/') { + path.strip_prefix('/').unwrap().to_string() } else { format!("{}/{}", self.root, path) } @@ -171,7 +171,7 @@ impl Backend { #[async_trait] impl Read for Backend { async fn read(&self, args: &ReadBuilder) -> Result { - let p = self.get_abs_path(&args.path); + let p = self.get_abs_path(args.path); // TODO: Handle range header here. let resp = self