From 43cfdd94ecf9271d2714be183f109369e33ae046 Mon Sep 17 00:00:00 2001 From: Connorcpu Date: Fri, 19 Dec 2014 09:48:59 -0800 Subject: [PATCH 1/2] Fixed macros with missing semicolons --- src/approx.rs | 14 ++++++------- src/matrix.rs | 4 ++-- src/num.rs | 56 +++++++++++++++++++++++++------------------------- src/point.rs | 2 +- src/vector.rs | 10 ++++----- tests/angle.rs | 12 +++++------ 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/approx.rs b/src/approx.rs index e412d3a..0399dbf 100644 --- a/src/approx.rs +++ b/src/approx.rs @@ -39,10 +39,10 @@ macro_rules! approx_float( } } ) -) +); -approx_float!(f32) -approx_float!(f64) +approx_float!(f32); +approx_float!(f64); #[macro_export] 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) { panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)", *given_val, *expected_val, *eps - ) + ); } }) -) +); #[macro_export] macro_rules! assert_approx_eq( @@ -65,7 +65,7 @@ macro_rules! assert_approx_eq( panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)", *given_val, *expected_val, ApproxEq::approx_epsilon(Some(*given_val)) - ) + ); } }) -) +); diff --git a/src/matrix.rs b/src/matrix.rs index 77b5ecc..ad51891 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -422,7 +422,7 @@ impl FixedArray<[[S, ..2], ..2]> for Matrix2 { // 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] @@ -925,7 +925,7 @@ macro_rules! dot_matrix4( ($A[1][$I]) * ($B[$J][1]) + ($A[2][$I]) * ($B[$J][2]) + ($A[3][$I]) * ($B[$J][3]) -)) +)); impl Matrix> for Matrix4 { #[inline] diff --git a/src/num.rs b/src/num.rs index 19225bd..003b395 100644 --- a/src/num.rs +++ b/src/num.rs @@ -32,18 +32,18 @@ macro_rules! partial_ord_int ( fn partial_max(self, other: $T) -> $T { cmp::max(self, other) } } ) -) +); -partial_ord_int!(int) -partial_ord_int!(i8) -partial_ord_int!(i16) -partial_ord_int!(i32) -partial_ord_int!(i64) -partial_ord_int!(uint) -partial_ord_int!(u8) -partial_ord_int!(u16) -partial_ord_int!(u32) -partial_ord_int!(u64) +partial_ord_int!(int); +partial_ord_int!(i8); +partial_ord_int!(i16); +partial_ord_int!(i32); +partial_ord_int!(i64); +partial_ord_int!(uint); +partial_ord_int!(u8); +partial_ord_int!(u16); +partial_ord_int!(u32); +partial_ord_int!(u64); macro_rules! partial_ord_float ( ($T:ident) => ( @@ -52,10 +52,10 @@ macro_rules! partial_ord_float ( fn partial_max(self, other: $T) -> $T { self.max(other) } } ) -) +); -partial_ord_float!(f32) -partial_ord_float!(f64) +partial_ord_float!(f32); +partial_ord_float!(f64); /// Additive neutral element pub trait Zero { @@ -95,18 +95,18 @@ macro_rules! impl_basenum_int ( } } ) -) +); -impl_basenum_int!(i8) -impl_basenum_int!(i16) -impl_basenum_int!(i32) -impl_basenum_int!(i64) -impl_basenum_int!(u8) -impl_basenum_int!(u16) -impl_basenum_int!(u32) -impl_basenum_int!(u64) -impl_basenum_int!(int) -impl_basenum_int!(uint) +impl_basenum_int!(i8); +impl_basenum_int!(i16); +impl_basenum_int!(i32); +impl_basenum_int!(i64); +impl_basenum_int!(u8); +impl_basenum_int!(u16); +impl_basenum_int!(u32); +impl_basenum_int!(u64); +impl_basenum_int!(int); +impl_basenum_int!(uint); macro_rules! impl_basenum_float ( @@ -128,10 +128,10 @@ macro_rules! impl_basenum_float ( } } ) -) +); -impl_basenum_float!(f32) -impl_basenum_float!(f64) +impl_basenum_float!(f32); +impl_basenum_float!(f64); pub fn zero() -> T { Zero::zero() diff --git a/src/point.rs b/src/point.rs index 1566989..be87393 100644 --- a/src/point.rs +++ b/src/point.rs @@ -120,7 +120,7 @@ impl FixedArray<[S, ..2]> for Point2 { #[inline] fn from_fixed(_v: [S, ..2]) -> Point2 { // 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] diff --git a/src/vector.rs b/src/vector.rs index 3eaa0ff..8a135df 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -236,7 +236,7 @@ macro_rules! vec( #[inline] fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> { // 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] @@ -335,7 +335,7 @@ macro_rules! vec( } } ) -) +); macro_rules! fold { (&$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) }; } -vec!(Vector2 { x, y }, 2) -vec!(Vector3 { x, y, z }, 3) -vec!(Vector4 { x, y, z, w }, 4) +vec!(Vector2 { x, y }, 2); +vec!(Vector3 { x, y, z }, 3); +vec!(Vector4 { x, y, z, w }, 4); /// Operations specific to numeric two-dimensional vectors. impl Vector2 { diff --git a/tests/angle.rs b/tests/angle.rs index a567081..c0ace6e 100644 --- a/tests/angle.rs +++ b/tests/angle.rs @@ -32,11 +32,11 @@ fn conv() { #[test] fn equiv() { - assert!(Deg::::full_turn().equiv(&-Deg::::full_turn())) - assert!(Deg::::turn_div_2().equiv(&-Deg::::turn_div_2())) - assert!(Deg::::turn_div_3().sub_a(Deg::::full_turn()).equiv(&Deg::::turn_div_3())) + assert!(Deg::::full_turn().equiv(&-Deg::::full_turn())); + assert!(Deg::::turn_div_2().equiv(&-Deg::::turn_div_2())); + assert!(Deg::::turn_div_3().sub_a(Deg::::full_turn()).equiv(&Deg::::turn_div_3())); - assert!(Rad::::full_turn().equiv(&-Rad::::full_turn())) - assert!(Rad::::turn_div_2().equiv(&-Rad::::turn_div_2())) - assert!(Rad::::turn_div_3().sub_a(Rad::::full_turn()).equiv(&Rad::::turn_div_3())) + assert!(Rad::::full_turn().equiv(&-Rad::::full_turn())); + assert!(Rad::::turn_div_2().equiv(&-Rad::::turn_div_2())); + assert!(Rad::::turn_div_3().sub_a(Rad::::full_turn()).equiv(&Rad::::turn_div_3())); } From 6e9cd482eb1ca39bfcdf5012a9f69ca8c5a2bfff Mon Sep 17 00:00:00 2001 From: Connorcpu Date: Fri, 19 Dec 2014 10:06:39 -0800 Subject: [PATCH 2/2] Fixed macros in the benches --- benches/common/macros.rs | 8 ++--- benches/construction.rs | 6 ++-- benches/mat.rs | 48 ++++++++++++++-------------- benches/quat.rs | 18 +++++------ benches/vec.rs | 68 ++++++++++++++++++++-------------------- 5 files changed, 74 insertions(+), 74 deletions(-) diff --git a/benches/common/macros.rs b/benches/common/macros.rs index 1f154c8..b175a8d 100644 --- a/benches/common/macros.rs +++ b/benches/common/macros.rs @@ -36,7 +36,7 @@ macro_rules! bench_binop( }) } } -) +); macro_rules! bench_binop_deref( ($name: ident, $t1: ty, $t2: ty, $binop: ident) => { @@ -59,7 +59,7 @@ macro_rules! bench_binop_deref( }) } } -) +); macro_rules! bench_unop( ($name: ident, $t: ty, $unop: ident) => { @@ -81,7 +81,7 @@ macro_rules! bench_unop( }) } } -) +); macro_rules! bench_construction( ($name: ident, $t: ty, $constructor: path $(, $args: ident: $types: ty)*) => { @@ -104,4 +104,4 @@ macro_rules! bench_construction( }) } } -) +); diff --git a/benches/construction.rs b/benches/construction.rs index 6e008c3..39b72d7 100644 --- a/benches/construction.rs +++ b/benches/construction.rs @@ -54,7 +54,7 @@ fn _bench_rot3_from_axisangle(bh: &mut Bencher) { bench_from_axis_angle::>(bh) } -bench_construction!(_bench_rot2_from_axisangle, Basis2, Rotation2::from_angle, angle: Rad) +bench_construction!(_bench_rot2_from_axisangle, Basis2, Rotation2::from_angle, angle: Rad); -bench_construction!(_bench_quat_from_euler_angles, Quaternion, Rotation3::from_euler, roll: Rad, pitch: Rad, yaw: Rad) -bench_construction!(_bench_rot3_from_euler_angles, Basis3, Rotation3::from_euler, roll: Rad, pitch: Rad, yaw: Rad) +bench_construction!(_bench_quat_from_euler_angles, Quaternion, Rotation3::from_euler, roll: Rad, pitch: Rad, yaw: Rad); +bench_construction!(_bench_rot3_from_euler_angles, Basis3, Rotation3::from_euler, roll: Rad, pitch: Rad, yaw: Rad); diff --git a/benches/mat.rs b/benches/mat.rs index 5ee510d..e33b8e3 100644 --- a/benches/mat.rs +++ b/benches/mat.rs @@ -26,34 +26,34 @@ use cgmath::*; #[path="common/macros.rs"] mod macros; -bench_binop!(_bench_matrix2_mul_m, Matrix2, Matrix2, mul_m) -bench_binop!(_bench_matrix3_mul_m, Matrix3, Matrix3, mul_m) -bench_binop!(_bench_matrix4_mul_m, Matrix4, Matrix4, mul_m) +bench_binop!(_bench_matrix2_mul_m, Matrix2, Matrix2, mul_m); +bench_binop!(_bench_matrix3_mul_m, Matrix3, Matrix3, mul_m); +bench_binop!(_bench_matrix4_mul_m, Matrix4, Matrix4, mul_m); -bench_binop!(_bench_matrix2_add_m, Matrix2, Matrix2, add_m) -bench_binop!(_bench_matrix3_add_m, Matrix3, Matrix3, add_m) -bench_binop!(_bench_matrix4_add_m, Matrix4, Matrix4, add_m) +bench_binop!(_bench_matrix2_add_m, Matrix2, Matrix2, add_m); +bench_binop!(_bench_matrix3_add_m, Matrix3, Matrix3, add_m); +bench_binop!(_bench_matrix4_add_m, Matrix4, Matrix4, add_m); -bench_binop!(_bench_matrix2_sub_m, Matrix2, Matrix2, sub_m) -bench_binop!(_bench_matrix3_sub_m, Matrix3, Matrix3, sub_m) -bench_binop!(_bench_matrix4_sub_m, Matrix4, Matrix4, sub_m) +bench_binop!(_bench_matrix2_sub_m, Matrix2, Matrix2, sub_m); +bench_binop!(_bench_matrix3_sub_m, Matrix3, Matrix3, sub_m); +bench_binop!(_bench_matrix4_sub_m, Matrix4, Matrix4, sub_m); -bench_binop!(_bench_matrix2_mul_v, Matrix2, Vector2, mul_v) -bench_binop!(_bench_matrix3_mul_v, Matrix3, Vector3, mul_v) -bench_binop!(_bench_matrix4_mul_v, Matrix4, Vector4, mul_v) +bench_binop!(_bench_matrix2_mul_v, Matrix2, Vector2, mul_v); +bench_binop!(_bench_matrix3_mul_v, Matrix3, Vector3, mul_v); +bench_binop!(_bench_matrix4_mul_v, Matrix4, Vector4, mul_v); -bench_binop_deref!(_bench_matrix2_mul_s, Matrix2, f32, mul_s) -bench_binop_deref!(_bench_matrix3_mul_s, Matrix3, f32, mul_s) -bench_binop_deref!(_bench_matrix4_mul_s, Matrix4, f32, mul_s) +bench_binop_deref!(_bench_matrix2_mul_s, Matrix2, f32, mul_s); +bench_binop_deref!(_bench_matrix3_mul_s, Matrix3, f32, mul_s); +bench_binop_deref!(_bench_matrix4_mul_s, Matrix4, f32, mul_s); -bench_binop_deref!(_bench_matrix2_div_s, Matrix2, f32, div_s) -bench_binop_deref!(_bench_matrix3_div_s, Matrix3, f32, div_s) -bench_binop_deref!(_bench_matrix4_div_s, Matrix4, f32, div_s) +bench_binop_deref!(_bench_matrix2_div_s, Matrix2, f32, div_s); +bench_binop_deref!(_bench_matrix3_div_s, Matrix3, f32, div_s); +bench_binop_deref!(_bench_matrix4_div_s, Matrix4, f32, div_s); -bench_unop!(_bench_matrix2_invert, Matrix2, invert) -bench_unop!(_bench_matrix3_invert, Matrix3, invert) -bench_unop!(_bench_matrix4_invert, Matrix4, invert) +bench_unop!(_bench_matrix2_invert, Matrix2, invert); +bench_unop!(_bench_matrix3_invert, Matrix3, invert); +bench_unop!(_bench_matrix4_invert, Matrix4, invert); -bench_unop!(_bench_matrix2_transpose, Matrix2, transpose) -bench_unop!(_bench_matrix3_transpose, Matrix3, transpose) -bench_unop!(_bench_matrix4_transpose, Matrix4, transpose) +bench_unop!(_bench_matrix2_transpose, Matrix2, transpose); +bench_unop!(_bench_matrix3_transpose, Matrix3, transpose); +bench_unop!(_bench_matrix4_transpose, Matrix4, transpose); diff --git a/benches/quat.rs b/benches/quat.rs index eee10e0..77a9c05 100644 --- a/benches/quat.rs +++ b/benches/quat.rs @@ -26,12 +26,12 @@ use cgmath::*; #[path="common/macros.rs"] mod macros; -bench_binop!(_bench_quat_add_q, Quaternion, Quaternion, add_q) -bench_binop!(_bench_quat_sub_q, Quaternion, Quaternion, sub_q) -bench_binop!(_bench_quat_mul_q, Quaternion, Quaternion, mul_q) -bench_binop!(_bench_quat_mul_v, Quaternion, Vector3, mul_v) -bench_binop_deref!(_bench_quat_mul_s, Quaternion, f32, mul_s) -bench_binop_deref!(_bench_quat_div_s, Quaternion, f32, div_s) -bench_unop!(_bench_quat_invert, Quaternion, invert) -bench_unop!(_bench_quat_conjugate, Quaternion, conjugate) -bench_unop!(_bench_quat_normalize, Quaternion, normalize) +bench_binop!(_bench_quat_add_q, Quaternion, Quaternion, add_q); +bench_binop!(_bench_quat_sub_q, Quaternion, Quaternion, sub_q); +bench_binop!(_bench_quat_mul_q, Quaternion, Quaternion, mul_q); +bench_binop!(_bench_quat_mul_v, Quaternion, Vector3, mul_v); +bench_binop_deref!(_bench_quat_mul_s, Quaternion, f32, mul_s); +bench_binop_deref!(_bench_quat_div_s, Quaternion, f32, div_s); +bench_unop!(_bench_quat_invert, Quaternion, invert); +bench_unop!(_bench_quat_conjugate, Quaternion, conjugate); +bench_unop!(_bench_quat_normalize, Quaternion, normalize); diff --git a/benches/vec.rs b/benches/vec.rs index 1072f69..f6e8b19 100644 --- a/benches/vec.rs +++ b/benches/vec.rs @@ -26,49 +26,49 @@ use cgmath::*; #[path="common/macros.rs"] mod macros; -bench_binop!(_bench_vector2_add_v, Vector2, Vector2, add_v) -bench_binop!(_bench_vector3_add_v, Vector3, Vector3, add_v) -bench_binop!(_bench_vector4_add_v, Vector4, Vector4, add_v) +bench_binop!(_bench_vector2_add_v, Vector2, Vector2, add_v); +bench_binop!(_bench_vector3_add_v, Vector3, Vector3, add_v); +bench_binop!(_bench_vector4_add_v, Vector4, Vector4, add_v); -bench_binop!(_bench_vector2_sub_v, Vector2, Vector2, sub_v) -bench_binop!(_bench_vector3_sub_v, Vector3, Vector3, sub_v) -bench_binop!(_bench_vector4_sub_v, Vector4, Vector4, sub_v) +bench_binop!(_bench_vector2_sub_v, Vector2, Vector2, sub_v); +bench_binop!(_bench_vector3_sub_v, Vector3, Vector3, sub_v); +bench_binop!(_bench_vector4_sub_v, Vector4, Vector4, sub_v); -bench_binop!(_bench_vector2_mul_v, Vector2, Vector2, mul_v) -bench_binop!(_bench_vector3_mul_v, Vector3, Vector3, mul_v) -bench_binop!(_bench_vector4_mul_v, Vector4, Vector4, mul_v) +bench_binop!(_bench_vector2_mul_v, Vector2, Vector2, mul_v); +bench_binop!(_bench_vector3_mul_v, Vector3, Vector3, mul_v); +bench_binop!(_bench_vector4_mul_v, Vector4, Vector4, mul_v); -bench_binop!(_bench_vector2_div_v, Vector2, Vector2, div_v) -bench_binop!(_bench_vector3_div_v, Vector3, Vector3, div_v) -bench_binop!(_bench_vector4_div_v, Vector4, Vector4, div_v) +bench_binop!(_bench_vector2_div_v, Vector2, Vector2, div_v); +bench_binop!(_bench_vector3_div_v, Vector3, Vector3, div_v); +bench_binop!(_bench_vector4_div_v, Vector4, Vector4, div_v); -bench_binop_deref!(_bench_vector2_add_s, Vector2, f32, add_s) -bench_binop_deref!(_bench_vector3_add_s, Vector3, f32, add_s) -bench_binop_deref!(_bench_vector4_add_s, Vector4, f32, add_s) +bench_binop_deref!(_bench_vector2_add_s, Vector2, f32, add_s); +bench_binop_deref!(_bench_vector3_add_s, Vector3, f32, add_s); +bench_binop_deref!(_bench_vector4_add_s, Vector4, f32, add_s); -bench_binop_deref!(_bench_vector2_sub_s, Vector2, f32, sub_s) -bench_binop_deref!(_bench_vector3_sub_s, Vector3, f32, sub_s) -bench_binop_deref!(_bench_vector4_sub_s, Vector4, f32, sub_s) +bench_binop_deref!(_bench_vector2_sub_s, Vector2, f32, sub_s); +bench_binop_deref!(_bench_vector3_sub_s, Vector3, f32, sub_s); +bench_binop_deref!(_bench_vector4_sub_s, Vector4, f32, sub_s); -bench_binop_deref!(_bench_vector2_mul_s, Vector2, f32, mul_s) -bench_binop_deref!(_bench_vector3_mul_s, Vector3, f32, mul_s) -bench_binop_deref!(_bench_vector4_mul_s, Vector4, f32, mul_s) +bench_binop_deref!(_bench_vector2_mul_s, Vector2, f32, mul_s); +bench_binop_deref!(_bench_vector3_mul_s, Vector3, f32, mul_s); +bench_binop_deref!(_bench_vector4_mul_s, Vector4, f32, mul_s); -bench_binop_deref!(_bench_vector2_div_s, Vector2, f32, div_s) -bench_binop_deref!(_bench_vector3_div_s, Vector3, f32, div_s) -bench_binop_deref!(_bench_vector4_div_s, Vector4, f32, div_s) +bench_binop_deref!(_bench_vector2_div_s, Vector2, f32, div_s); +bench_binop_deref!(_bench_vector3_div_s, Vector3, f32, div_s); +bench_binop_deref!(_bench_vector4_div_s, Vector4, f32, div_s); -bench_binop!(_bench_vector2_dot, Vector2, Vector2, dot) -bench_binop!(_bench_vector3_dot, Vector3, Vector3, dot) -bench_binop!(_bench_vector4_dot, Vector4, Vector4, dot) +bench_binop!(_bench_vector2_dot, Vector2, Vector2, dot); +bench_binop!(_bench_vector3_dot, Vector3, Vector3, dot); +bench_binop!(_bench_vector4_dot, Vector4, Vector4, dot); -bench_binop!(_bench_vector3_cross, Vector3, Vector3, cross) +bench_binop!(_bench_vector3_cross, Vector3, Vector3, cross); -bench_unop!(_bench_vector2_norm, Vector2, length) -bench_unop!(_bench_vector3_norm, Vector3, length) -bench_unop!(_bench_vector4_norm, Vector4, length) +bench_unop!(_bench_vector2_norm, Vector2, length); +bench_unop!(_bench_vector3_norm, Vector3, length); +bench_unop!(_bench_vector4_norm, Vector4, length); -bench_unop!(_bench_vector2_normalize, Vector2, normalize) -bench_unop!(_bench_vector3_normalize, Vector3, normalize) -bench_unop!(_bench_vector4_normalize, Vector4, normalize) +bench_unop!(_bench_vector2_normalize, Vector2, normalize); +bench_unop!(_bench_vector3_normalize, Vector3, normalize); +bench_unop!(_bench_vector4_normalize, Vector4, normalize);