Skip to content

Commit 3009d91

Browse files
committed
clippy
1 parent 3352a85 commit 3009d91

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

crates/vm/src/object/core.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub(super) unsafe fn debug_obj<T: PyPayload + core::fmt::Debug>(
9393
}
9494

9595
/// Call `try_trace` on payload
96-
pub(super) unsafe fn try_trace_obj<T: PyPayload>(x: &PyObject, tracer_fn: &mut TraverseFn<'_>) {
96+
pub(super) unsafe fn try_traverse_obj<T: PyPayload>(x: &PyObject, tracer_fn: &mut TraverseFn<'_>) {
9797
let x = unsafe { &*(x as *const PyObject as *const PyInner<T>) };
9898
let payload = &x.payload;
9999
payload.try_traverse(tracer_fn)
@@ -124,12 +124,6 @@ bitflags::bitflags! {
124124
}
125125
}
126126

127-
/// Call `try_clear` on payload to extract child references (tp_clear)
128-
pub(super) unsafe fn try_clear_obj<T: PyPayload>(x: *mut PyObject, out: &mut Vec<PyObjectRef>) {
129-
let x = unsafe { &mut *(x as *mut PyInner<T>) };
130-
x.payload.try_clear(out);
131-
}
132-
133127
/// This is an actual python object. It consists of a `typ` which is the
134128
/// python class, and carries some rust payload optionally. This rust
135129
/// payload can be a rust float or rust int in case of float and int objects.

crates/vm/src/object/traverse_object.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use alloc::fmt;
22
use core::any::TypeId;
33

44
use crate::{
5-
PyObject, PyObjectRef,
5+
PyObject,
66
object::{
77
Erased, InstanceDict, MaybeTraverse, PyInner, PyObjectPayload, debug_obj, drop_dealloc_obj,
8-
try_clear_obj, try_trace_obj,
8+
try_traverse_obj,
99
},
1010
};
1111

@@ -16,9 +16,6 @@ pub(in crate::object) struct PyObjVTable {
1616
pub(in crate::object) drop_dealloc: unsafe fn(*mut PyObject),
1717
pub(in crate::object) debug: unsafe fn(&PyObject, &mut fmt::Formatter<'_>) -> fmt::Result,
1818
pub(in crate::object) trace: Option<unsafe fn(&PyObject, &mut TraverseFn<'_>)>,
19-
/// Clear for circular reference resolution (tp_clear).
20-
/// Called just before deallocation to extract child references.
21-
pub(in crate::object) clear: Option<unsafe fn(*mut PyObject, &mut Vec<PyObjectRef>)>,
2219
}
2320

2421
impl PyObjVTable {
@@ -29,14 +26,7 @@ impl PyObjVTable {
2926
debug: debug_obj::<T>,
3027
trace: const {
3128
if T::HAS_TRAVERSE {
32-
Some(try_trace_obj::<T>)
33-
} else {
34-
None
35-
}
36-
},
37-
clear: const {
38-
if T::HAS_CLEAR {
39-
Some(try_clear_obj::<T>)
29+
Some(try_traverse_obj::<T>)
4030
} else {
4131
None
4232
}

0 commit comments

Comments
 (0)