@@ -20,7 +20,7 @@ fn int_new(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
2020 required = [ ( cls, None ) ] ,
2121 optional = [ ( val_option, None ) ]
2222 ) ;
23- if !objtype:: issubclass ( cls, vm. ctx . int_type ( ) ) {
23+ if !objtype:: issubclass ( cls, & vm. ctx . int_type ( ) ) {
2424 return Err ( vm. new_type_error ( format ! ( "{:?} is not a subtype of int" , cls) ) ) ;
2525 }
2626
@@ -38,11 +38,11 @@ fn int_new(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
3838
3939// Casting function:
4040pub fn to_int ( vm : & mut VirtualMachine , obj : & PyObjectRef , base : u32 ) -> Result < i32 , PyObjectRef > {
41- let val = if objtype:: isinstance ( obj, vm. ctx . int_type ( ) ) {
41+ let val = if objtype:: isinstance ( obj, & vm. ctx . int_type ( ) ) {
4242 get_value ( obj)
43- } else if objtype:: isinstance ( obj, vm. ctx . float_type ( ) ) {
43+ } else if objtype:: isinstance ( obj, & vm. ctx . float_type ( ) ) {
4444 objfloat:: get_value ( obj) as i32
45- } else if objtype:: isinstance ( obj, vm. ctx . str_type ( ) ) {
45+ } else if objtype:: isinstance ( obj, & vm. ctx . str_type ( ) ) {
4646 let s = objstr:: get_value ( obj) ;
4747 match i32:: from_str_radix ( & s, base) {
4848 Ok ( v) => v,
@@ -85,11 +85,11 @@ fn int_eq(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
8585 args,
8686 required = [ ( zelf, Some ( vm. ctx. int_type( ) ) ) , ( other, None ) ]
8787 ) ;
88- let result = if objtype:: isinstance ( other, vm. ctx . int_type ( ) ) {
88+ let result = if objtype:: isinstance ( other, & vm. ctx . int_type ( ) ) {
8989 let zelf = i32:: from_pyobj ( zelf) ;
9090 let other = i32:: from_pyobj ( other) ;
9191 zelf == other
92- } else if objtype:: isinstance ( other, vm. ctx . float_type ( ) ) {
92+ } else if objtype:: isinstance ( other, & vm. ctx . float_type ( ) ) {
9393 let zelf = i32:: from_pyobj ( zelf) as f64 ;
9494 let other = objfloat:: get_value ( other) ;
9595 zelf == other
@@ -178,9 +178,9 @@ fn int_add(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
178178 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
179179 ) ;
180180 let i = i32:: from_pyobj ( i) ;
181- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
181+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
182182 Ok ( vm. ctx . new_int ( i + get_value ( i2) ) )
183- } else if objtype:: isinstance ( i2, vm. ctx . float_type ( ) ) {
183+ } else if objtype:: isinstance ( i2, & vm. ctx . float_type ( ) ) {
184184 Ok ( vm. ctx . new_float ( i as f64 + objfloat:: get_value ( i2) ) )
185185 } else {
186186 Err ( vm. new_type_error ( format ! ( "Cannot add {:?} and {:?}" , i, i2) ) )
@@ -193,7 +193,7 @@ fn int_floordiv(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
193193 args,
194194 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
195195 ) ;
196- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
196+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
197197 Ok ( vm. ctx . new_int ( get_value ( i) / get_value ( i2) ) )
198198 } else {
199199 Err ( vm. new_type_error ( format ! ( "Cannot floordiv {:?} and {:?}" , i, i2) ) )
@@ -207,9 +207,9 @@ fn int_sub(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
207207 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
208208 ) ;
209209 let i = i32:: from_pyobj ( i) ;
210- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
210+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
211211 Ok ( vm. ctx . new_int ( i - get_value ( i2) ) )
212- } else if objtype:: isinstance ( i2, vm. ctx . float_type ( ) ) {
212+ } else if objtype:: isinstance ( i2, & vm. ctx . float_type ( ) ) {
213213 Ok ( vm. ctx . new_float ( i as f64 - objfloat:: get_value ( i2) ) )
214214 } else {
215215 Err ( vm. new_type_error ( format ! ( "Cannot substract {:?} and {:?}" , i, i2) ) )
@@ -222,9 +222,9 @@ fn int_mul(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
222222 args,
223223 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
224224 ) ;
225- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
225+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
226226 Ok ( vm. ctx . new_int ( get_value ( i) * get_value ( i2) ) )
227- } else if objtype:: isinstance ( i2, vm. ctx . float_type ( ) ) {
227+ } else if objtype:: isinstance ( i2, & vm. ctx . float_type ( ) ) {
228228 Ok ( vm
229229 . ctx
230230 . new_float ( get_value ( i) as f64 * objfloat:: get_value ( i2) ) )
@@ -240,9 +240,9 @@ fn int_truediv(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
240240 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
241241 ) ;
242242 let v1 = get_value ( i) ;
243- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
243+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
244244 Ok ( vm. ctx . new_float ( v1 as f64 / get_value ( i2) as f64 ) )
245- } else if objtype:: isinstance ( i2, vm. ctx . float_type ( ) ) {
245+ } else if objtype:: isinstance ( i2, & vm. ctx . float_type ( ) ) {
246246 Ok ( vm. ctx . new_float ( v1 as f64 / objfloat:: get_value ( i2) ) )
247247 } else {
248248 Err ( vm. new_type_error ( format ! ( "Cannot divide {:?} and {:?}" , i, i2) ) )
@@ -256,7 +256,7 @@ fn int_mod(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
256256 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
257257 ) ;
258258 let v1 = get_value ( i) ;
259- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
259+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
260260 Ok ( vm. ctx . new_int ( v1 % get_value ( i2) ) )
261261 } else {
262262 Err ( vm. new_type_error ( format ! ( "Cannot modulo {:?} and {:?}" , i, i2) ) )
@@ -270,10 +270,10 @@ fn int_pow(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
270270 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
271271 ) ;
272272 let v1 = get_value ( i) ;
273- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
273+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
274274 let v2 = get_value ( i2) ;
275275 Ok ( vm. ctx . new_int ( v1. pow ( v2 as u32 ) ) )
276- } else if objtype:: isinstance ( i2, vm. ctx . float_type ( ) ) {
276+ } else if objtype:: isinstance ( i2, & vm. ctx . float_type ( ) ) {
277277 let v2 = objfloat:: get_value ( i2) ;
278278 Ok ( vm. ctx . new_float ( ( v1 as f64 ) . powf ( v2) ) )
279279 } else {
@@ -288,7 +288,7 @@ fn int_divmod(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
288288 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
289289 ) ;
290290 let args = PyFuncArgs :: new ( vec ! [ i. clone( ) , i2. clone( ) ] , vec ! [ ] ) ;
291- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
291+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
292292 let r1 = int_floordiv ( vm, args. clone ( ) ) ;
293293 let r2 = int_mod ( vm, args. clone ( ) ) ;
294294 Ok ( vm. ctx . new_tuple ( vec ! [ r1. unwrap( ) , r2. unwrap( ) ] ) )
@@ -304,7 +304,7 @@ fn int_xor(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
304304 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
305305 ) ;
306306 let v1 = get_value ( i) ;
307- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
307+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
308308 let v2 = get_value ( i2) ;
309309 Ok ( vm. ctx . new_int ( v1 ^ v2) )
310310 } else {
@@ -319,7 +319,7 @@ fn int_or(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
319319 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
320320 ) ;
321321 let v1 = get_value ( i) ;
322- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
322+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
323323 let v2 = get_value ( i2) ;
324324 Ok ( vm. ctx . new_int ( v1 | v2) )
325325 } else {
@@ -334,7 +334,7 @@ fn int_and(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
334334 required = [ ( i, Some ( vm. ctx. int_type( ) ) ) , ( i2, None ) ]
335335 ) ;
336336 let v1 = get_value ( i) ;
337- if objtype:: isinstance ( i2, vm. ctx . int_type ( ) ) {
337+ if objtype:: isinstance ( i2, & vm. ctx . int_type ( ) ) {
338338 let v2 = get_value ( i2) ;
339339 Ok ( vm. ctx . new_int ( v1 & v2) )
340340 } else {
0 commit comments