From bea0ff9c1c8b1b17c1450dffe74ae7cd0a6b4ce5 Mon Sep 17 00:00:00 2001 From: "xikai.wxk" Date: Wed, 7 Dec 2022 23:05:17 +0800 Subject: [PATCH] chore: make clippy happy --- components/object_store/src/prefix.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/object_store/src/prefix.rs b/components/object_store/src/prefix.rs index f43fb9bfaa..e0040fb516 100644 --- a/components/object_store/src/prefix.rs +++ b/components/object_store/src/prefix.rs @@ -38,8 +38,12 @@ impl StoreWithPrefix { } fn loc_with_prefix(&self, loc: &Path) -> Path { - let splitted_prefix = self.prefix.as_ref().split(DELIMITER).into_iter(); - let splitted_loc = loc.as_ref().split(DELIMITER).into_iter(); + if self.prefix.as_ref().is_empty() { + return loc.clone(); + } + + let splitted_prefix = self.prefix.as_ref().split(DELIMITER); + let splitted_loc = loc.as_ref().split(DELIMITER); Path::from_iter(splitted_prefix.chain(splitted_loc)) } }