fail! -> panic!

This commit is contained in:
Tomaka17 2014-10-30 10:11:33 +01:00
parent 498fb60281
commit 4fcfde13de
6 changed files with 13 additions and 13 deletions

View file

@ -49,7 +49,7 @@ macro_rules! assert_approx_eq_eps(
let eps = &($eps);
let (given_val, expected_val) = (&($given), &($expected));
if !given_val.approx_eq_eps(expected_val, eps) {
fail!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
*given_val, *expected_val, *eps
)
}
@ -61,7 +61,7 @@ macro_rules! assert_approx_eq(
($given: expr, $expected: expr) => ({
let (given_val, expected_val) = (&($given), &($expected));
if !given_val.approx_eq(expected_val) {
fail!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
*given_val, *expected_val,
ApproxEq::approx_epsilon(Some(*given_val))
)

View file

@ -422,7 +422,7 @@ impl<S> FixedArray<[[S, ..2], ..2]> for Matrix2<S> {
// y: FixedArray::from_fixed(y),
// },
// }
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
}
#[inline]
@ -502,7 +502,7 @@ impl<S> FixedArray<[[S, ..3], ..3]> for Matrix3<S> {
// z: FixedArray::from_fixed(z),
// },
// }
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
}
#[inline]
@ -587,7 +587,7 @@ impl<S> FixedArray<[[S, ..4], ..4]> for Matrix4<S> {
// w: FixedArray::from_fixed(w),
// },
// }
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
}
#[inline]
@ -1095,7 +1095,7 @@ impl<S: BaseFloat + 'static> Matrix<S, Vector4<S>> for Matrix4<S> {
3 => Matrix3::from_cols(t.x.truncate_n(j),
t.y.truncate_n(j),
t.z.truncate_n(j)),
_ => fail!("out of range")
_ => panic!("out of range")
};
let sign = if (i+j) & 1 == 1 {-one} else {one};
mat.determinant() * sign * inv_det

View file

@ -111,13 +111,13 @@ impl<S: BaseFloat> Intersect<Option<Point3<S>>> for (Plane<S>, Ray3<S>) {
impl<S: BaseFloat> Intersect<Option<Ray3<S>>> for (Plane<S>, Plane<S>) {
fn intersection(&self) -> Option<Ray3<S>> {
fail!("Not yet implemented");
panic!("Not yet implemented");
}
}
impl<S: BaseFloat> Intersect<Option<Point3<S>>> for (Plane<S>, Plane<S>, Plane<S>) {
fn intersection(&self) -> Option<Point3<S>> {
fail!("Not yet implemented");
panic!("Not yet implemented");
}
}

View file

@ -121,7 +121,7 @@ impl<S> FixedArray<[S, ..2]> for Point2<S> {
#[inline]
fn from_fixed(_v: [S, ..2]) -> Point2<S> {
// match v { [x, y] => Point2 { x: x, y: y } }
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
}
#[inline]
@ -275,7 +275,7 @@ impl<S> FixedArray<[S, ..3]> for Point3<S> {
#[inline]
fn from_fixed(_v: [S, ..3]) -> Point3<S> {
// match v { [x, y, z] => Point3 { x: x, y: y, z: z } }
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
}
#[inline]

View file

@ -231,7 +231,7 @@ macro_rules! vec(
#[inline]
fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> {
// match v { [$($field),+] => $Self { $($field: $field),+ } }
fail!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
}
#[inline]
@ -438,7 +438,7 @@ impl<S: BaseNum> Vector4<S> {
1 => Vector3::new(self.x, self.z, self.w),
2 => Vector3::new(self.x, self.y, self.w),
3 => Vector3::new(self.x, self.y, self.z),
_ => fail!("{} is out of range", n)
_ => panic!("{} is out of range", n)
}
}
}

View file

@ -43,7 +43,7 @@ fn to_and_from_quaternion()
if !(ax.approx_eq_eps(&bx, &0.001) &&
ay.approx_eq_eps(&by, &0.001) &&
az.approx_eq_eps(&bz, &0.001)) {
fail!("{} != {}", a, b)
panic!("{} != {}", a, b)
}
}