@@ -175,13 +175,9 @@ mod decl {
175175
176176 #[ pyfunction]
177177 fn divmod ( a : PyObjectRef , b : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
178- vm. call_or_reflection (
179- a. clone ( ) ,
180- b. clone ( ) ,
181- "__divmod__" ,
182- "__rdivmod__" ,
183- |vm, a, b| Err ( vm. new_unsupported_operand_error ( a, b, "divmod" ) ) ,
184- )
178+ vm. call_or_reflection ( a, b, "__divmod__" , "__rdivmod__" , |vm, a, b| {
179+ Err ( vm. new_unsupported_operand_error ( a, b, "divmod" ) )
180+ } )
185181 }
186182
187183 #[ cfg( feature = "rustpython-compiler" ) ]
@@ -307,7 +303,7 @@ mod decl {
307303 default : OptionalArg < PyObjectRef > ,
308304 vm : & VirtualMachine ,
309305 ) -> PyResult {
310- let ret = vm. get_attribute ( obj. clone ( ) , attr) ;
306+ let ret = vm. get_attribute ( obj, attr) ;
311307 if let OptionalArg :: Present ( default) = default {
312308 ret. or_else ( |ex| catch_attr_exception ( ex, default, vm) )
313309 } else {
@@ -322,7 +318,7 @@ mod decl {
322318
323319 #[ pyfunction]
324320 fn hasattr ( obj : PyObjectRef , attr : PyStringRef , vm : & VirtualMachine ) -> PyResult < bool > {
325- if let Err ( ex) = vm. get_attribute ( obj. clone ( ) , attr) {
321+ if let Err ( ex) = vm. get_attribute ( obj, attr) {
326322 catch_attr_exception ( ex, false , vm)
327323 } else {
328324 Ok ( true )
@@ -533,7 +529,7 @@ mod decl {
533529 if objtype:: isinstance ( & value, & vm. ctx . exceptions . stop_iteration ) {
534530 match default_value {
535531 OptionalArg :: Missing => Err ( value) ,
536- OptionalArg :: Present ( value) => Ok ( value. clone ( ) ) ,
532+ OptionalArg :: Present ( value) => Ok ( value) ,
537533 }
538534 } else {
539535 Err ( value)
@@ -595,7 +591,7 @@ mod decl {
595591 ) -> PyResult {
596592 match mod_value {
597593 OptionalArg :: Missing => {
598- vm. call_or_reflection ( x. clone ( ) , y. clone ( ) , "__pow__" , "__rpow__" , |vm, x, y| {
594+ vm. call_or_reflection ( x, y, "__pow__" , "__rpow__" , |vm, x, y| {
599595 Err ( vm. new_unsupported_operand_error ( x, y, "pow" ) )
600596 } )
601597 }
0 commit comments