diff --git a/jit/src/lib.rs b/jit/src/lib.rs index d0f404f2d..01a860b33 100644 --- a/jit/src/lib.rs +++ b/jit/src/lib.rs @@ -273,7 +273,7 @@ union UnTypedAbiValue { } impl UnTypedAbiValue { - unsafe fn to_typed(&self, ty: &JitType) -> AbiValue { + unsafe fn to_typed(self, ty: &JitType) -> AbiValue { match ty { JitType::Int => AbiValue::Int(self.int), JitType::Float => AbiValue::Float(self.float), diff --git a/vm/src/builtins/list.rs b/vm/src/builtins/list.rs index 91f57befa..8bdf5058a 100644 --- a/vm/src/builtins/list.rs +++ b/vm/src/builtins/list.rs @@ -132,7 +132,7 @@ impl PyList { #[pymethod] fn clear(&self) { - let _removed = std::mem::replace(self.borrow_vec_mut().deref_mut(), Vec::new()); + let _removed = std::mem::take(self.borrow_vec_mut().deref_mut()); } #[pymethod] diff --git a/vm/src/dictdatatype.rs b/vm/src/dictdatatype.rs index e3bc1b471..925193f83 100644 --- a/vm/src/dictdatatype.rs +++ b/vm/src/dictdatatype.rs @@ -304,7 +304,7 @@ impl Dict { inner.used = 0; inner.filled = 0; // defer dec rc - std::mem::replace(&mut inner.entries, Vec::new()) + std::mem::take(&mut inner.entries) }; }