@@ -143,52 +143,6 @@ impl fmt::Display for PyStr {
143143 }
144144}
145145
146- pub trait IntoPyStrRef {
147- fn into_pystr_ref ( self , vm : & VirtualMachine ) -> PyStrRef ;
148- }
149-
150- impl IntoPyStrRef for PyStrRef {
151- #[ inline]
152- fn into_pystr_ref ( self , _vm : & VirtualMachine ) -> PyRef < PyStr > {
153- self
154- }
155- }
156-
157- impl IntoPyStrRef for PyStr {
158- #[ inline]
159- fn into_pystr_ref ( self , vm : & VirtualMachine ) -> PyRef < PyStr > {
160- self . into_ref ( vm)
161- }
162- }
163-
164- impl IntoPyStrRef for AsciiString {
165- #[ inline]
166- fn into_pystr_ref ( self , vm : & VirtualMachine ) -> PyRef < PyStr > {
167- PyStr :: from ( self ) . into_ref ( vm)
168- }
169- }
170-
171- impl IntoPyStrRef for String {
172- #[ inline]
173- fn into_pystr_ref ( self , vm : & VirtualMachine ) -> PyRef < PyStr > {
174- PyStr :: from ( self ) . into_ref ( vm)
175- }
176- }
177-
178- impl IntoPyStrRef for & str {
179- #[ inline]
180- fn into_pystr_ref ( self , vm : & VirtualMachine ) -> PyRef < PyStr > {
181- PyStr :: from ( self ) . into_ref ( vm)
182- }
183- }
184-
185- impl IntoPyStrRef for & ' static PyStrInterned {
186- #[ inline]
187- fn into_pystr_ref ( self , _vm : & VirtualMachine ) -> PyRef < PyStr > {
188- self . to_owned ( )
189- }
190- }
191-
192146pub trait AsPyStr < ' a >
193147where
194148 Self : ' a ,
@@ -655,7 +609,7 @@ impl PyStr {
655609 if s == stripped {
656610 zelf
657611 } else {
658- stripped . into_pystr_ref ( vm )
612+ vm . ctx . new_str ( stripped )
659613 }
660614 }
661615
@@ -674,7 +628,7 @@ impl PyStr {
674628 if s == stripped {
675629 zelf
676630 } else {
677- stripped . into_pystr_ref ( vm )
631+ vm . ctx . new_str ( stripped )
678632 }
679633 }
680634
@@ -985,7 +939,7 @@ impl PyStr {
985939 }
986940 Err ( iter) => zelf. as_str ( ) . py_join ( iter) ?,
987941 } ;
988- Ok ( joined . into_pystr_ref ( vm ) )
942+ Ok ( vm . ctx . new_str ( joined ) )
989943 }
990944
991945 // FIXME: two traversals of str is expensive
0 commit comments