Skip to content

Commit

Permalink
Make clippy happy
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo committed Jan 5, 2022
1 parent 2a4fa8d commit 0f902bc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/dal2/src/services/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down Expand Up @@ -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)
}
Expand All @@ -171,7 +171,7 @@ impl Backend {
#[async_trait]
impl<S: Send + Sync> Read<S> for Backend {
async fn read(&self, args: &ReadBuilder<S>) -> Result<Reader> {
let p = self.get_abs_path(&args.path);
let p = self.get_abs_path(args.path);

// TODO: Handle range header here.
let resp = self
Expand Down

0 comments on commit 0f902bc

Please sign in to comment.