Skip to content

Commit b50ecf1

Browse files
Merge pull request RustPython#675 from skinny121/property_type_param
Remove type parameter from PropertyBuilder
2 parents 8dcea92 + 067fc09 commit b50ecf1

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

vm/src/obj/objproperty.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
*/
44

5-
use std::marker::PhantomData;
6-
75
use crate::obj::objstr::PyStringRef;
86
use crate::obj::objtype::PyClassRef;
97
use crate::pyobject::{
@@ -92,30 +90,27 @@ impl PyPropertyRef {
9290
}
9391
}
9492

95-
pub struct PropertyBuilder<'a, T> {
93+
pub struct PropertyBuilder<'a> {
9694
ctx: &'a PyContext,
9795
getter: Option<PyObjectRef>,
9896
setter: Option<PyObjectRef>,
99-
_return: PhantomData<T>,
10097
}
10198

102-
impl<'a, T> PropertyBuilder<'a, T> {
99+
impl<'a> PropertyBuilder<'a> {
103100
pub fn new(ctx: &'a PyContext) -> Self {
104101
Self {
105102
ctx,
106103
getter: None,
107104
setter: None,
108-
_return: PhantomData,
109105
}
110106
}
111107

112-
pub fn add_getter<I, F: IntoPyNativeFunc<I, T>>(self, func: F) -> Self {
108+
pub fn add_getter<I, V, F: IntoPyNativeFunc<I, V>>(self, func: F) -> Self {
113109
let func = self.ctx.new_rustfunc(func);
114110
Self {
115111
ctx: self.ctx,
116112
getter: Some(func),
117113
setter: self.setter,
118-
_return: PhantomData,
119114
}
120115
}
121116

@@ -125,7 +120,6 @@ impl<'a, T> PropertyBuilder<'a, T> {
125120
ctx: self.ctx,
126121
getter: self.getter,
127122
setter: Some(func),
128-
_return: PhantomData,
129123
}
130124
}
131125

vm/src/pyobject.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,9 @@ impl PyContext {
596596
PyObject::new(Frame::new(code, scope), self.frame_type())
597597
}
598598

599-
pub fn new_property<F, T, R>(&self, f: F) -> PyObjectRef
599+
pub fn new_property<F, I, V>(&self, f: F) -> PyObjectRef
600600
where
601-
F: IntoPyNativeFunc<T, R>,
601+
F: IntoPyNativeFunc<I, V>,
602602
{
603603
PropertyBuilder::new(self).add_getter(f).create()
604604
}

0 commit comments

Comments
 (0)