Fixed macros with missing semicolons

This commit is contained in:
Connorcpu 2014-12-19 09:48:59 -08:00
parent 1831538f35
commit 43cfdd94ec
6 changed files with 49 additions and 49 deletions

View file

@ -39,10 +39,10 @@ macro_rules! approx_float(
} }
} }
) )
) );
approx_float!(f32) approx_float!(f32);
approx_float!(f64) approx_float!(f64);
#[macro_export] #[macro_export]
macro_rules! assert_approx_eq_eps( macro_rules! assert_approx_eq_eps(
@ -52,10 +52,10 @@ macro_rules! assert_approx_eq_eps(
if !given_val.approx_eq_eps(expected_val, eps) { if !given_val.approx_eq_eps(expected_val, eps) {
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)", panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
*given_val, *expected_val, *eps *given_val, *expected_val, *eps
) );
} }
}) })
) );
#[macro_export] #[macro_export]
macro_rules! assert_approx_eq( macro_rules! assert_approx_eq(
@ -65,7 +65,7 @@ macro_rules! assert_approx_eq(
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)", panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
*given_val, *expected_val, *given_val, *expected_val,
ApproxEq::approx_epsilon(Some(*given_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), // y: FixedArray::from_fixed(y),
// }, // },
// } // }
panic!("Unimplemented, pending a fix for rust-lang/rust#16418") panic!("Unimplemented, pending a fix for rust-lang/rust#16418");
} }
#[inline] #[inline]
@ -925,7 +925,7 @@ macro_rules! dot_matrix4(
($A[1][$I]) * ($B[$J][1]) + ($A[1][$I]) * ($B[$J][1]) +
($A[2][$I]) * ($B[$J][2]) + ($A[2][$I]) * ($B[$J][2]) +
($A[3][$I]) * ($B[$J][3]) ($A[3][$I]) * ($B[$J][3])
)) ));
impl<S: BaseFloat + 'static> Matrix<S, Vector4<S>> for Matrix4<S> { impl<S: BaseFloat + 'static> Matrix<S, Vector4<S>> for Matrix4<S> {
#[inline] #[inline]

View file

@ -32,18 +32,18 @@ macro_rules! partial_ord_int (
fn partial_max(self, other: $T) -> $T { cmp::max(self, other) } fn partial_max(self, other: $T) -> $T { cmp::max(self, other) }
} }
) )
) );
partial_ord_int!(int) partial_ord_int!(int);
partial_ord_int!(i8) partial_ord_int!(i8);
partial_ord_int!(i16) partial_ord_int!(i16);
partial_ord_int!(i32) partial_ord_int!(i32);
partial_ord_int!(i64) partial_ord_int!(i64);
partial_ord_int!(uint) partial_ord_int!(uint);
partial_ord_int!(u8) partial_ord_int!(u8);
partial_ord_int!(u16) partial_ord_int!(u16);
partial_ord_int!(u32) partial_ord_int!(u32);
partial_ord_int!(u64) partial_ord_int!(u64);
macro_rules! partial_ord_float ( macro_rules! partial_ord_float (
($T:ident) => ( ($T:ident) => (
@ -52,10 +52,10 @@ macro_rules! partial_ord_float (
fn partial_max(self, other: $T) -> $T { self.max(other) } fn partial_max(self, other: $T) -> $T { self.max(other) }
} }
) )
) );
partial_ord_float!(f32) partial_ord_float!(f32);
partial_ord_float!(f64) partial_ord_float!(f64);
/// Additive neutral element /// Additive neutral element
pub trait Zero { pub trait Zero {
@ -95,18 +95,18 @@ macro_rules! impl_basenum_int (
} }
} }
) )
) );
impl_basenum_int!(i8) impl_basenum_int!(i8);
impl_basenum_int!(i16) impl_basenum_int!(i16);
impl_basenum_int!(i32) impl_basenum_int!(i32);
impl_basenum_int!(i64) impl_basenum_int!(i64);
impl_basenum_int!(u8) impl_basenum_int!(u8);
impl_basenum_int!(u16) impl_basenum_int!(u16);
impl_basenum_int!(u32) impl_basenum_int!(u32);
impl_basenum_int!(u64) impl_basenum_int!(u64);
impl_basenum_int!(int) impl_basenum_int!(int);
impl_basenum_int!(uint) impl_basenum_int!(uint);
macro_rules! impl_basenum_float ( macro_rules! impl_basenum_float (
@ -128,10 +128,10 @@ macro_rules! impl_basenum_float (
} }
} }
) )
) );
impl_basenum_float!(f32) impl_basenum_float!(f32);
impl_basenum_float!(f64) impl_basenum_float!(f64);
pub fn zero<T: Zero>() -> T { pub fn zero<T: Zero>() -> T {
Zero::zero() Zero::zero()

View file

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

View file

@ -236,7 +236,7 @@ macro_rules! vec(
#[inline] #[inline]
fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> { fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> {
// match v { [$($field),+] => $Self { $($field: $field),+ } } // match v { [$($field),+] => $Self { $($field: $field),+ } }
panic!("Unimplemented, pending a fix for rust-lang/rust#16418") panic!("Unimplemented, pending a fix for rust-lang/rust#16418");
} }
#[inline] #[inline]
@ -335,7 +335,7 @@ macro_rules! vec(
} }
} }
) )
) );
macro_rules! fold { macro_rules! fold {
(&$method:ident, { $x:expr, $y:expr }) => { $x.$method(&$y) }; (&$method:ident, { $x:expr, $y:expr }) => { $x.$method(&$y) };
@ -346,9 +346,9 @@ macro_rules! fold {
($method:ident, { $x:expr, $y:expr, $z:expr, $w:expr }) => { $x.$method($y).$method($z).$method($w) }; ($method:ident, { $x:expr, $y:expr, $z:expr, $w:expr }) => { $x.$method($y).$method($z).$method($w) };
} }
vec!(Vector2<S> { x, y }, 2) vec!(Vector2<S> { x, y }, 2);
vec!(Vector3<S> { x, y, z }, 3) vec!(Vector3<S> { x, y, z }, 3);
vec!(Vector4<S> { x, y, z, w }, 4) vec!(Vector4<S> { x, y, z, w }, 4);
/// Operations specific to numeric two-dimensional vectors. /// Operations specific to numeric two-dimensional vectors.
impl<S: BaseNum> Vector2<S> { impl<S: BaseNum> Vector2<S> {

View file

@ -32,11 +32,11 @@ fn conv() {
#[test] #[test]
fn equiv() { fn equiv() {
assert!(Deg::<f32>::full_turn().equiv(&-Deg::<f32>::full_turn())) assert!(Deg::<f32>::full_turn().equiv(&-Deg::<f32>::full_turn()));
assert!(Deg::<f32>::turn_div_2().equiv(&-Deg::<f32>::turn_div_2())) assert!(Deg::<f32>::turn_div_2().equiv(&-Deg::<f32>::turn_div_2()));
assert!(Deg::<f32>::turn_div_3().sub_a(Deg::<f32>::full_turn()).equiv(&Deg::<f32>::turn_div_3())) assert!(Deg::<f32>::turn_div_3().sub_a(Deg::<f32>::full_turn()).equiv(&Deg::<f32>::turn_div_3()));
assert!(Rad::<f32>::full_turn().equiv(&-Rad::<f32>::full_turn())) assert!(Rad::<f32>::full_turn().equiv(&-Rad::<f32>::full_turn()));
assert!(Rad::<f32>::turn_div_2().equiv(&-Rad::<f32>::turn_div_2())) assert!(Rad::<f32>::turn_div_2().equiv(&-Rad::<f32>::turn_div_2()));
assert!(Rad::<f32>::turn_div_3().sub_a(Rad::<f32>::full_turn()).equiv(&Rad::<f32>::turn_div_3())) assert!(Rad::<f32>::turn_div_3().sub_a(Rad::<f32>::full_turn()).equiv(&Rad::<f32>::turn_div_3()));
} }