forked from Rust-related/RustPython
Fix trivial suggestions
This commit is contained in:
@@ -554,8 +554,7 @@ impl AsNumber for PyFloat {
|
||||
PyFloat::number_op(a, b, float_pow, vm)
|
||||
} else {
|
||||
Err(vm.new_type_error(String::from(
|
||||
"pow() 3rd argument not \\
|
||||
allowed unless all arguments are integers",
|
||||
"pow() 3rd argument not allowed unless all arguments are integers",
|
||||
)))
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -621,10 +621,8 @@ mod builtins {
|
||||
exp: y,
|
||||
modulus,
|
||||
} = args;
|
||||
match modulus {
|
||||
None => vm._pow(&x, &y, vm.ctx.none.as_object()),
|
||||
Some(z) => vm._pow(&x, &y, &z),
|
||||
}
|
||||
let modulus = modulus.as_ref().map_or(vm.ctx.none.as_object(), |m| m);
|
||||
vm._pow(&x, &y, modulus)
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
|
||||
@@ -567,28 +567,22 @@ impl PyType {
|
||||
}
|
||||
_ if name == identifier!(ctx, __pow__) => {
|
||||
toggle_subslot!(as_number, power, |a, b, c, vm| {
|
||||
if vm.is_none(c) {
|
||||
vm.call_special_method(a, identifier!(vm, __pow__), (b.to_owned(),))
|
||||
let args = if vm.is_none(c) {
|
||||
vec![b.to_owned()]
|
||||
} else {
|
||||
vm.call_special_method(
|
||||
a,
|
||||
identifier!(vm, __pow__),
|
||||
(b.to_owned(), c.to_owned()),
|
||||
)
|
||||
}
|
||||
vec![b.to_owned(), c.to_owned()]
|
||||
};
|
||||
vm.call_special_method(a, identifier!(vm, __pow__), args)
|
||||
});
|
||||
}
|
||||
_ if name == identifier!(ctx, __rpow__) => {
|
||||
toggle_subslot!(as_number, right_power, |a, b, c, vm| {
|
||||
if vm.is_none(c) {
|
||||
vm.call_special_method(b, identifier!(vm, __rpow__), (a.to_owned(),))
|
||||
let args = if vm.is_none(c) {
|
||||
vec![a.to_owned()]
|
||||
} else {
|
||||
vm.call_special_method(
|
||||
b,
|
||||
identifier!(vm, __rpow__),
|
||||
(a.to_owned(), c.to_owned()),
|
||||
)
|
||||
}
|
||||
vec![a.to_owned(), c.to_owned()]
|
||||
};
|
||||
vm.call_special_method(b, identifier!(vm, __rpow__), args)
|
||||
});
|
||||
}
|
||||
_ if name == identifier!(ctx, __ipow__) => {
|
||||
|
||||
Reference in New Issue
Block a user