@@ -47,13 +47,9 @@ pub trait Constant: Sized {
4747
4848 /// Transforms the given Constant to a BorrowedConstant
4949 fn borrow_constant ( & self ) -> BorrowedConstant < Self > ;
50- /// Get the data this Constant holds.
51- fn into_data ( self ) -> ConstantData {
52- self . borrow_constant ( ) . into_data ( )
53- }
5450 /// Map this Constant to a Bag's constant
5551 fn map_constant < Bag : ConstantBag > ( self , bag : & Bag ) -> Bag :: Constant {
56- bag. make_constant ( self . into_data ( ) )
52+ bag. make_constant ( self . borrow_constant ( ) . to_owned ( ) )
5753 }
5854
5955 /// Maps the name for the given Bag.
@@ -84,9 +80,6 @@ impl Constant for ConstantData {
8480 ConstantData :: Ellipsis => Ellipsis ,
8581 }
8682 }
87- fn into_data ( self ) -> ConstantData {
88- self
89- }
9083 fn map_name < Bag : ConstantBag > ( name : String , bag : & Bag ) -> <Bag :: Constant as Constant >:: Name {
9184 bag. make_name ( name)
9285 }
@@ -97,7 +90,7 @@ pub trait ConstantBag: Sized {
9790 type Constant : Constant ;
9891 fn make_constant ( & self , constant : ConstantData ) -> Self :: Constant ;
9992 fn make_constant_borrowed < C : Constant > ( & self , constant : BorrowedConstant < C > ) -> Self :: Constant {
100- self . make_constant ( constant. into_data ( ) )
93+ self . make_constant ( constant. to_owned ( ) )
10194 }
10295 fn make_name ( & self , name : String ) -> <Self :: Constant as Constant >:: Name ;
10396 fn make_name_ref ( & self , name : & str ) -> <Self :: Constant as Constant >:: Name {
@@ -556,7 +549,7 @@ impl<C: Constant> BorrowedConstant<'_, C> {
556549 BorrowedConstant :: Ellipsis => write ! ( f, "..." ) ,
557550 }
558551 }
559- pub fn into_data ( self ) -> ConstantData {
552+ pub fn to_owned ( self ) -> ConstantData {
560553 use ConstantData :: * ;
561554 match self {
562555 BorrowedConstant :: Integer { value } => Integer {
@@ -575,7 +568,7 @@ impl<C: Constant> BorrowedConstant<'_, C> {
575568 code : Box :: new ( code. map_clone_bag ( & BasicBag ) ) ,
576569 } ,
577570 BorrowedConstant :: Tuple { elements } => Tuple {
578- elements : elements. map ( BorrowedConstant :: into_data ) . collect ( ) ,
571+ elements : elements. map ( BorrowedConstant :: to_owned ) . collect ( ) ,
579572 } ,
580573 BorrowedConstant :: None => None ,
581574 BorrowedConstant :: Ellipsis => Ellipsis ,
0 commit comments