Skip to content

Commit 06f3506

Browse files
committed
formatting fixes on builtin_pow
1 parent abba4ae commit 06f3506

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

vm/src/builtins.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ fn builtin_locals(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
262262

263263
fn builtin_pow(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
264264
arg_check!(
265-
vm,
266-
args,
267-
required = [(x, None), (y, None)],
268-
optional=[(mod_value, Some(vm.ctx.int_type()))]
265+
vm,
266+
args,
267+
required = [(x, None), (y, None)],
268+
optional = [(mod_value, Some(vm.ctx.int_type()))]
269269
);
270270
let pow_method_name = "__pow__".to_string();
271271
let result = match vm.get_attribute(x.clone(), &pow_method_name) {
272272
Ok(attrib) => vm.invoke(attrib, PyFuncArgs::new(vec![y.clone()], vec![])),
273-
Err(..) => Err(vm.new_type_error("unsupported operand type(s) for pow".to_string()))
273+
Err(..) => Err(vm.new_type_error("unsupported operand type(s) for pow".to_string())),
274274
};
275275
//Check if the 3rd argument is defined and perform modulus on the result
276276
//this should be optimized in the future to perform a "power-mod" algorithm in
@@ -279,23 +279,19 @@ fn builtin_pow(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
279279
Some(mod_value) => {
280280
let mod_method_name = "__mod__".to_string();
281281
match vm.get_attribute(
282-
result.expect("result not defined").clone(),
283-
&mod_method_name
284-
) {
285-
Ok(value) => vm.invoke(
286-
value,
287-
PyFuncArgs::new(vec![mod_value.clone()], vec![])
288-
),
289-
Err(..) => Err(
290-
vm.new_type_error("unsupported operand type(s) for mod".to_string())
291-
)
282+
result.expect("result not defined").clone(),
283+
&mod_method_name,
284+
) {
285+
Ok(value) => vm.invoke(value, PyFuncArgs::new(vec![mod_value.clone()], vec![])),
286+
Err(..) => {
287+
Err(vm.new_type_error("unsupported operand type(s) for mod".to_string()))
288+
}
292289
}
293290
}
294-
None => result
291+
None => result,
295292
}
296293
}
297294

298-
299295
pub fn builtin_print(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
300296
trace!("print called with {:?}", args);
301297
for a in args.args {

0 commit comments

Comments
 (0)