mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Remove Constant::map_constant
This commit is contained in:
1 parent
abe644bd72
commit
b2c9b3ce90
2 files changed
+1
-8
No files matched your search
+1
-5
@@ -47,10 +47,6 @@ pub trait Constant: Sized {
|
||||
|
||||
/// Transforms the given Constant to a BorrowedConstant
|
||||
fn borrow_constant(&self) -> BorrowedConstant<Self>;
|
||||
/// Map this Constant to a Bag's constant
|
||||
fn map_constant<Bag: ConstantBag>(self, bag: &Bag) -> Bag::Constant {
|
||||
bag.make_constant(self.borrow_constant())
|
||||
}
|
||||
|
||||
/// Maps the name for the given Bag.
|
||||
fn map_name<Bag: ConstantBag>(
|
||||
@@ -765,7 +761,7 @@ impl<C: Constant> CodeObject<C> {
|
||||
.constants
|
||||
.into_vec()
|
||||
.into_iter()
|
||||
.map(|x| x.map_constant(bag))
|
||||
.map(|x| bag.make_constant(x.borrow_constant()))
|
||||
.collect(),
|
||||
names: map_names(self.names),
|
||||
varnames: map_names(self.varnames),
|
||||
|
||||
@@ -66,9 +66,6 @@ impl Constant for PyConstant {
|
||||
fn borrow_constant(&self) -> BorrowedConstant<Self> {
|
||||
borrow_obj_constant(&self.0)
|
||||
}
|
||||
fn map_constant<Bag: ConstantBag>(self, bag: &Bag) -> Bag::Constant {
|
||||
bag.make_constant(self.borrow_constant())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct PyObjBag<'a>(pub &'a Context);
|
||||
|
||||
Reference in new issue
Block a user