Skip to content

Commit cc69f10

Browse files
committed
avoid cloning sef.data before the replace
1 parent c6334b0 commit cc69f10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/redisjson.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ impl RedisJSON {
6363
}
6464

6565
pub fn delete_path(&mut self, path: &str) -> Result<usize, Error> {
66-
self.data = jsonpath_lib::delete(self.data.clone(), path)?;
66+
let current_value = mem::replace(&mut self.data, Value::Null);
67+
self.data = jsonpath_lib::delete(current_value, path)?;
6768

6869
let res : usize = match self.data {
6970
Value::Null => 0,

0 commit comments

Comments
 (0)