Skip to content

Commit 2d6f256

Browse files
committed
f Remove unnecessary clones
1 parent c47fb7d commit 2d6f256

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning-storage/src/fs_store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl KVStore for FilesystemStore {
8686
std::io::Error::new(std::io::ErrorKind::InvalidInput, msg)
8787
})?
8888
.to_path_buf();
89-
fs::create_dir_all(parent_directory.clone())?;
89+
fs::create_dir_all(&parent_directory)?;
9090

9191
// Do a crazy dance with lots of fsync()s to be overly cautious here...
9292
// We never want to end up in a state where we've lost the old data, or end up using the
@@ -106,7 +106,7 @@ impl KVStore for FilesystemStore {
106106
#[cfg(not(target_os = "windows"))]
107107
{
108108
fs::rename(&tmp_file_path, &dest_file_path)?;
109-
let dir_file = fs::OpenOptions::new().read(true).open(parent_directory.clone())?;
109+
let dir_file = fs::OpenOptions::new().read(true).open(&parent_directory)?;
110110
unsafe {
111111
libc::fsync(dir_file.as_raw_fd());
112112
}
@@ -206,7 +206,7 @@ impl KVStore for FilesystemStore {
206206
return Ok(Vec::new());
207207
}
208208

209-
for entry in fs::read_dir(prefixed_dest.clone())? {
209+
for entry in fs::read_dir(&prefixed_dest)? {
210210
let entry = entry?;
211211
let p = entry.path();
212212

@@ -220,7 +220,7 @@ impl KVStore for FilesystemStore {
220220
}
221221
}
222222

223-
if let Ok(relative_path) = p.strip_prefix(prefixed_dest.clone()) {
223+
if let Ok(relative_path) = p.strip_prefix(&prefixed_dest) {
224224
keys.push(relative_path.display().to_string())
225225
}
226226
}

0 commit comments

Comments
 (0)