diff --git a/common/src/refcount.rs b/common/src/refcount.rs index cbac8424dc1..910eef436a9 100644 --- a/common/src/refcount.rs +++ b/common/src/refcount.rs @@ -44,7 +44,7 @@ impl RefCount { #[inline] pub fn safe_inc(&self) -> bool { self.strong - .fetch_update(AcqRel, Acquire, |prev| (prev != 0).then(|| prev + 1)) + .fetch_update(AcqRel, Acquire, |prev| (prev != 0).then_some(prev + 1)) .is_ok() } diff --git a/vm/src/object/core.rs b/vm/src/object/core.rs index d3f758f87de..0aae7383e01 100644 --- a/vm/src/object/core.rs +++ b/vm/src/object/core.rs @@ -78,7 +78,7 @@ struct PyObjVTable { debug: unsafe fn(&PyObject, &mut fmt::Formatter) -> fmt::Result, } unsafe fn drop_dealloc_obj(x: *mut PyObject) { - Box::from_raw(x as *mut PyInner); + drop(Box::from_raw(x as *mut PyInner)); } unsafe fn debug_obj(x: &PyObject, f: &mut fmt::Formatter) -> fmt::Result { let x = &*(x as *const PyObject as *const PyInner); @@ -269,7 +269,7 @@ impl WeakRefList { } unsafe fn dealloc(ptr: NonNull>) { - Box::from_raw(ptr.as_ptr()); + drop(Box::from_raw(ptr.as_ptr())); } fn get_weak_references(&self) -> Vec> {