Skip to content

Commit 76e826a

Browse files
committed
Remove redundant path clones
Avoid allocating paths before filesystem operations that only need borrowed paths. Co-Authored-By: HAL 9000
1 parent d51d725 commit 76e826a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/io/fs_store.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ pub(crate) async fn open_or_migrate_fs_store(
2626
fs::create_dir_all(parent_dir).map_err(|_| BuildError::StoragePathAccessFailed)?;
2727
recover_incomplete_fs_store_migration(&storage_dir_path)?;
2828
if !storage_dir_path.exists() {
29-
fs::create_dir_all(storage_dir_path.clone())
30-
.map_err(|_| BuildError::StoragePathAccessFailed)?;
29+
fs::create_dir_all(&storage_dir_path).map_err(|_| BuildError::StoragePathAccessFailed)?;
3130
}
3231

3332
match FilesystemStoreV2::new(storage_dir_path.clone()) {
@@ -37,7 +36,7 @@ pub(crate) async fn open_or_migrate_fs_store(
3736
let v1_store = FilesystemStore::new(storage_dir_path.clone());
3837

3938
let v2_dir = fs_store_sibling_path(&storage_dir_path, "fs_store_v2_migrating");
40-
fs::create_dir_all(v2_dir.clone()).map_err(|_| BuildError::StoragePathAccessFailed)?;
39+
fs::create_dir_all(&v2_dir).map_err(|_| BuildError::StoragePathAccessFailed)?;
4140
let v2_store = FilesystemStoreV2::new(v2_dir.clone())
4241
.map_err(|_| BuildError::KVStoreSetupFailed)?;
4342

0 commit comments

Comments
 (0)