Some formatting

This commit is contained in:
Windel Bouwman
2018-08-20 21:48:58 +02:00
parent 823730f023
commit 20d73d7478
2 changed files with 12 additions and 16 deletions

View File

@@ -770,10 +770,9 @@ impl PartialEq for PyObject {
PyObjectKind::Integer { value: ref v1i },
PyObjectKind::Integer { value: ref v2i },
) => v2i == v1i,
(
PyObjectKind::Float { value: ref v1i },
PyObjectKind::Float { value: ref v2i },
) => v2i == v1i,
( PyObjectKind::Float { value: ref v1i }, PyObjectKind::Float { value: ref v2i }) => {
v2i == v1i
}
(PyObjectKind::String { value: ref v1i }, PyObjectKind::String { value: ref v2i }) => {
*v2i == *v1i
}

View File

@@ -306,18 +306,15 @@ impl VirtualMachine {
&PyObjectKind::Integer { value: ref v1 },
&PyObjectKind::Integer { value: ref v2 },
) => Ok(self.ctx.new_int(v1.pow(*v2 as u32))),
(
&PyObjectKind::Float { value: ref v1 },
&PyObjectKind::Integer { value: ref v2 },
) => Ok(self.ctx.new_float(v1.powf(*v2 as f64))),
(
&PyObjectKind::Integer { value: ref v1 },
&PyObjectKind::Float { value: ref v2 },
) => Ok(self.ctx.new_float((*v1 as f64).powf(*v2))),
(
&PyObjectKind::Float { value: ref v1 },
&PyObjectKind::Float { value: ref v2 },
) => Ok(self.ctx.new_float(v1.powf(*v2))),
(&PyObjectKind::Float { value: ref v1 }, &PyObjectKind::Integer { value: ref v2 }) => {
Ok(self.ctx.new_float(v1.powf(*v2 as f64)))
}
(&PyObjectKind::Integer { value: ref v1 }, &PyObjectKind::Float { value: ref v2 }) => {
Ok(self.ctx.new_float((*v1 as f64).powf(*v2)))
}
(&PyObjectKind::Float { value: ref v1 }, &PyObjectKind::Float { value: ref v2 }) => {
Ok(self.ctx.new_float(v1.powf(*v2)))
}
_ => panic!("Not impl"),
}
}