@@ -138,7 +138,7 @@ impl VirtualMachine {
138
138
139
139
// Container of the virtual machine state:
140
140
pub fn to_str ( & mut self , obj : PyObjectRef ) -> PyResult {
141
- self . call_method ( obj, "__str__" . to_string ( ) , vec ! [ ] )
141
+ self . call_method ( obj, "__str__" , vec ! [ ] )
142
142
}
143
143
144
144
pub fn current_frame ( & self ) -> & Frame {
@@ -327,28 +327,28 @@ impl VirtualMachine {
327
327
}
328
328
329
329
fn _sub ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
330
- self . call_method ( a, "__sub__" . to_string ( ) , vec ! [ b] )
330
+ self . call_method ( a, "__sub__" , vec ! [ b] )
331
331
}
332
332
333
333
fn _add ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
334
- self . call_method ( a, "__add__" . to_string ( ) , vec ! [ b] )
334
+ self . call_method ( a, "__add__" , vec ! [ b] )
335
335
}
336
336
337
337
fn _mul ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
338
- self . call_method ( a, "__mul__" . to_string ( ) , vec ! [ b] )
338
+ self . call_method ( a, "__mul__" , vec ! [ b] )
339
339
}
340
340
341
341
fn _div ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
342
- self . call_method ( a, "__truediv__" . to_string ( ) , vec ! [ b] )
342
+ self . call_method ( a, "__truediv__" , vec ! [ b] )
343
343
}
344
344
345
345
fn call_method (
346
346
& mut self ,
347
347
obj : PyObjectRef ,
348
- method_name : String ,
348
+ method_name : & str ,
349
349
args : Vec < PyObjectRef > ,
350
350
) -> PyResult {
351
- let func = match self . get_attribute ( obj, & method_name) {
351
+ let func = match self . get_attribute ( obj, method_name) {
352
352
Ok ( v) => v,
353
353
Err ( err) => return Err ( err) ,
354
354
} ;
@@ -360,11 +360,11 @@ impl VirtualMachine {
360
360
}
361
361
362
362
fn _pow ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
363
- self . call_method ( a, "__pow__" . to_string ( ) , vec ! [ b] )
363
+ self . call_method ( a, "__pow__" , vec ! [ b] )
364
364
}
365
365
366
366
fn _modulo ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
367
- self . call_method ( a, "__mod__" . to_string ( ) , vec ! [ b] )
367
+ self . call_method ( a, "__mod__" , vec ! [ b] )
368
368
}
369
369
370
370
fn execute_binop ( & mut self , op : & bytecode:: BinaryOperator ) -> Option < PyResult > {
@@ -618,7 +618,7 @@ impl VirtualMachine {
618
618
None
619
619
}
620
620
621
- pub fn get_attribute ( & mut self , obj : PyObjectRef , attr_name : & String ) -> PyResult {
621
+ pub fn get_attribute ( & mut self , obj : PyObjectRef , attr_name : & str ) -> PyResult {
622
622
objtype:: get_attribute ( self , obj. clone ( ) , attr_name)
623
623
}
624
624
0 commit comments