Skip to content

Commit 27352fb

Browse files
committed
Use take instead of replace with default
Clippy emits: warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` As suggested, use `take` instead of `replace`.
1 parent 85e4b8c commit 27352fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/policy/compiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ fn insert_elem<Pk: MiniscriptKey, Ctx: ScriptContext>(
665665
if !is_worse {
666666
// If the element is not worse any element in the map, remove elements
667667
// whose subtype is the current element and have worse cost.
668-
*map = mem::replace(map, BTreeMap::new())
668+
*map = mem::take(map)
669669
.into_iter()
670670
.filter(|&(ref existing_key, ref existing_elem)| {
671671
let existing_elem_cost = existing_elem.cost_1d(sat_prob, dissat_prob);

0 commit comments

Comments
 (0)