We should panic on division by zero (#5844)

This commit is contained in:
Bastian Köcher
2020-04-30 14:01:48 +02:00
committed by GitHub
parent c05ec630ff
commit db2e916904
@@ -167,8 +167,7 @@ impl ops::Div for Fixed64 {
fn div(self, rhs: Self) -> Self::Output {
if rhs.0 == 0 {
let zero = 0;
return Fixed64::from_parts( self.0 / zero);
panic!("attempt to divide by zero");
}
let (n, d) = if rhs.0 < 0 {
(-self.0, rhs.0.abs() as u64)