From 73bd2968ac9cb9e1240cf2b9c035cbe19e6ab89c Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Thu, 22 Sep 2022 23:00:54 -0400 Subject: [PATCH 1/2] Drop unused must-use values immediately This new warning from Rust 1.64 needs @coolreader18's review. --- vm/src/object/core.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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> { From 50fd23ab4797dd3daf4eb9dce25cb3474e558310 Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Thu, 22 Sep 2022 22:38:33 -0400 Subject: [PATCH 2/2] Fix unnecessary closure (clippy) --- common/src/refcount.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() }