Skip to content

Commit f5dfea1

Browse files
committed
Simplify
1 parent 06fabbb commit f5dfea1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/value.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,7 @@ impl JsonValue {
195195
/// # }
196196
/// ```
197197
pub fn take(&mut self) -> JsonValue {
198-
let mut placeholder = JsonValue::Null;
199-
200-
mem::swap(self, &mut placeholder);
201-
202-
placeholder
198+
mem::replace(self, JsonValue::Null)
203199
}
204200

205201
/// Works on `JsonValue::Array` - pushes a new value to the array.

0 commit comments

Comments
 (0)