Skip to content

Add semicolons to macro lines #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 46 additions & 46 deletions src/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ macro_rules! forward_val_ref_binop {

macro_rules! forward_all_binop {
(impl $imp:ident for $res:ty, $method:ident) => {
forward_val_val_binop!(impl $imp for $res, $method)
forward_ref_val_binop!(impl $imp for $res, $method)
forward_val_ref_binop!(impl $imp for $res, $method)
forward_val_val_binop!(impl $imp for $res, $method);
forward_ref_val_binop!(impl $imp for $res, $method);
forward_val_ref_binop!(impl $imp for $res, $method);
};
}

forward_all_binop!(impl BitAnd for BigUint, bitand)
forward_all_binop!(impl BitAnd for BigUint, bitand);

impl<'a, 'b> BitAnd<&'b BigUint, BigUint> for &'a BigUint {
#[inline]
Expand All @@ -233,7 +233,7 @@ impl<'a, 'b> BitAnd<&'b BigUint, BigUint> for &'a BigUint {
}
}

forward_all_binop!(impl BitOr for BigUint, bitor)
forward_all_binop!(impl BitOr for BigUint, bitor);

impl<'a, 'b> BitOr<&'b BigUint, BigUint> for &'a BigUint {
fn bitor(self, other: &BigUint) -> BigUint {
Expand All @@ -246,7 +246,7 @@ impl<'a, 'b> BitOr<&'b BigUint, BigUint> for &'a BigUint {
}
}

forward_all_binop!(impl BitXor for BigUint, bitxor)
forward_all_binop!(impl BitXor for BigUint, bitxor);

impl<'a, 'b> BitXor<&'b BigUint, BigUint> for &'a BigUint {
fn bitxor(self, other: &BigUint) -> BigUint {
Expand Down Expand Up @@ -302,7 +302,7 @@ impl One for BigUint {

impl Unsigned for BigUint {}

forward_all_binop!(impl Add for BigUint, add)
forward_all_binop!(impl Add for BigUint, add);

impl<'a, 'b> Add<&'b BigUint, BigUint> for &'a BigUint {
fn add(self, other: &BigUint) -> BigUint {
Expand All @@ -321,7 +321,7 @@ impl<'a, 'b> Add<&'b BigUint, BigUint> for &'a BigUint {
}
}

forward_all_binop!(impl Sub for BigUint, sub)
forward_all_binop!(impl Sub for BigUint, sub);

impl<'a, 'b> Sub<&'b BigUint, BigUint> for &'a BigUint {
fn sub(self, other: &BigUint) -> BigUint {
Expand Down Expand Up @@ -352,7 +352,7 @@ impl<'a, 'b> Sub<&'b BigUint, BigUint> for &'a BigUint {
}


forward_all_binop!(impl Mul for BigUint, mul)
forward_all_binop!(impl Mul for BigUint, mul);

impl<'a, 'b> Mul<&'b BigUint, BigUint> for &'a BigUint {
fn mul(self, other: &BigUint) -> BigUint {
Expand Down Expand Up @@ -421,7 +421,7 @@ impl<'a, 'b> Mul<&'b BigUint, BigUint> for &'a BigUint {
}


forward_all_binop!(impl Div for BigUint, div)
forward_all_binop!(impl Div for BigUint, div);

impl<'a, 'b> Div<&'b BigUint, BigUint> for &'a BigUint {
#[inline]
Expand All @@ -431,7 +431,7 @@ impl<'a, 'b> Div<&'b BigUint, BigUint> for &'a BigUint {
}
}

forward_all_binop!(impl Rem for BigUint, rem)
forward_all_binop!(impl Rem for BigUint, rem);

impl<'a, 'b> Rem<&'b BigUint, BigUint> for &'a BigUint {
#[inline]
Expand Down Expand Up @@ -702,7 +702,7 @@ impl ToBigUint for BigUint {
}
}

macro_rules! impl_to_biguint(
macro_rules! impl_to_biguint {
($T:ty, $from_ty:path) => {
impl ToBigUint for $T {
#[inline]
Expand All @@ -711,18 +711,18 @@ macro_rules! impl_to_biguint(
}
}
}
)
}

impl_to_biguint!(int, FromPrimitive::from_int)
impl_to_biguint!(i8, FromPrimitive::from_i8)
impl_to_biguint!(i16, FromPrimitive::from_i16)
impl_to_biguint!(i32, FromPrimitive::from_i32)
impl_to_biguint!(i64, FromPrimitive::from_i64)
impl_to_biguint!(uint, FromPrimitive::from_uint)
impl_to_biguint!(u8, FromPrimitive::from_u8)
impl_to_biguint!(u16, FromPrimitive::from_u16)
impl_to_biguint!(u32, FromPrimitive::from_u32)
impl_to_biguint!(u64, FromPrimitive::from_u64)
impl_to_biguint!(int, FromPrimitive::from_int);
impl_to_biguint!(i8, FromPrimitive::from_i8);
impl_to_biguint!(i16, FromPrimitive::from_i16);
impl_to_biguint!(i32, FromPrimitive::from_i32);
impl_to_biguint!(i64, FromPrimitive::from_i64);
impl_to_biguint!(uint, FromPrimitive::from_uint);
impl_to_biguint!(u8, FromPrimitive::from_u8);
impl_to_biguint!(u16, FromPrimitive::from_u16);
impl_to_biguint!(u32, FromPrimitive::from_u32);
impl_to_biguint!(u64, FromPrimitive::from_u64);

fn to_str_radix(me: &BigUint, radix: uint) -> String {
assert!(1 < radix && radix <= 16, "The radix must be within (1, 16]");
Expand Down Expand Up @@ -1077,7 +1077,7 @@ impl Signed for BigInt {
fn is_negative(&self) -> bool { self.sign == Minus }
}

forward_all_binop!(impl Add for BigInt, add)
forward_all_binop!(impl Add for BigInt, add);

impl<'a, 'b> Add<&'b BigInt, BigInt> for &'a BigInt {
#[inline]
Expand All @@ -1093,7 +1093,7 @@ impl<'a, 'b> Add<&'b BigInt, BigInt> for &'a BigInt {
}
}

forward_all_binop!(impl Sub for BigInt, sub)
forward_all_binop!(impl Sub for BigInt, sub);

impl<'a, 'b> Sub<&'b BigInt, BigInt> for &'a BigInt {
#[inline]
Expand All @@ -1113,7 +1113,7 @@ impl<'a, 'b> Sub<&'b BigInt, BigInt> for &'a BigInt {
}
}

forward_all_binop!(impl Mul for BigInt, mul)
forward_all_binop!(impl Mul for BigInt, mul);

impl<'a, 'b> Mul<&'b BigInt, BigInt> for &'a BigInt {
#[inline]
Expand All @@ -1130,7 +1130,7 @@ impl<'a, 'b> Mul<&'b BigInt, BigInt> for &'a BigInt {
}
}

forward_all_binop!(impl Div for BigInt, div)
forward_all_binop!(impl Div for BigInt, div);

impl<'a, 'b> Div<&'b BigInt, BigInt> for &'a BigInt {
#[inline]
Expand All @@ -1140,7 +1140,7 @@ impl<'a, 'b> Div<&'b BigInt, BigInt> for &'a BigInt {
}
}

forward_all_binop!(impl Rem for BigInt, rem)
forward_all_binop!(impl Rem for BigInt, rem);

impl<'a, 'b> Rem<&'b BigInt, BigInt> for &'a BigInt {
#[inline]
Expand Down Expand Up @@ -1359,7 +1359,7 @@ impl ToBigInt for BigUint {
}
}

macro_rules! impl_to_bigint(
macro_rules! impl_to_bigint {
($T:ty, $from_ty:path) => {
impl ToBigInt for $T {
#[inline]
Expand All @@ -1368,18 +1368,18 @@ macro_rules! impl_to_bigint(
}
}
}
)
}

impl_to_bigint!(int, FromPrimitive::from_int)
impl_to_bigint!(i8, FromPrimitive::from_i8)
impl_to_bigint!(i16, FromPrimitive::from_i16)
impl_to_bigint!(i32, FromPrimitive::from_i32)
impl_to_bigint!(i64, FromPrimitive::from_i64)
impl_to_bigint!(uint, FromPrimitive::from_uint)
impl_to_bigint!(u8, FromPrimitive::from_u8)
impl_to_bigint!(u16, FromPrimitive::from_u16)
impl_to_bigint!(u32, FromPrimitive::from_u32)
impl_to_bigint!(u64, FromPrimitive::from_u64)
impl_to_bigint!(int, FromPrimitive::from_int);
impl_to_bigint!(i8, FromPrimitive::from_i8);
impl_to_bigint!(i16, FromPrimitive::from_i16);
impl_to_bigint!(i32, FromPrimitive::from_i32);
impl_to_bigint!(i64, FromPrimitive::from_i64);
impl_to_bigint!(uint, FromPrimitive::from_uint);
impl_to_bigint!(u8, FromPrimitive::from_u8);
impl_to_bigint!(u16, FromPrimitive::from_u16);
impl_to_bigint!(u32, FromPrimitive::from_u32);
impl_to_bigint!(u64, FromPrimitive::from_u64);

impl FromStrRadix for BigInt {
/// Creates and initializes a BigInt.
Expand Down Expand Up @@ -2615,7 +2615,7 @@ mod bigint_tests {
assert!(&c + (-b) == a);
assert!(&a + (-c) == (-b));
assert!(&b + (-c) == (-a));
assert!((-a) + (-b) == (-c))
assert!((-a) + (-b) == (-c));
assert!(&a + (-a) == Zero::zero());
}
}
Expand All @@ -2630,8 +2630,8 @@ mod bigint_tests {

assert!(&c - &a == b);
assert!(&c - &b == a);
assert!((-b) - &a == (-c))
assert!((-a) - &b == (-c))
assert!((-b) - &a == (-c));
assert!((-a) - &b == (-c));
assert!(&b - (-a) == c);
assert!(&a - (-b) == c);
assert!((-c) - (-a) == (-b));
Expand Down Expand Up @@ -2812,7 +2812,7 @@ mod bigint_tests {
assert!(c.checked_add(&(-b)).unwrap() == a);
assert!(a.checked_add(&(-c)).unwrap() == (-b));
assert!(b.checked_add(&(-c)).unwrap() == (-a));
assert!((-a).checked_add(&(-b)).unwrap() == (-c))
assert!((-a).checked_add(&(-b)).unwrap() == (-c));
assert!(a.checked_add(&(-a)).unwrap() == Zero::zero());
}
}
Expand All @@ -2827,8 +2827,8 @@ mod bigint_tests {

assert!(c.checked_sub(&a).unwrap() == b);
assert!(c.checked_sub(&b).unwrap() == a);
assert!((-b).checked_sub(&a).unwrap() == (-c))
assert!((-a).checked_sub(&b).unwrap() == (-c))
assert!((-b).checked_sub(&a).unwrap() == (-c));
assert!((-a).checked_sub(&b).unwrap() == (-c));
assert!(b.checked_sub(&(-a)).unwrap() == c);
assert!(a.checked_sub(&(-b)).unwrap() == c);
assert!((-c).checked_sub(&(-a)).unwrap() == (-b));
Expand Down
14 changes: 7 additions & 7 deletions src/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ macro_rules! forward_val_ref_binop {

macro_rules! forward_all_binop {
(impl $imp:ident, $method:ident) => {
forward_val_val_binop!(impl $imp, $method)
forward_ref_val_binop!(impl $imp, $method)
forward_val_ref_binop!(impl $imp, $method)
forward_val_val_binop!(impl $imp, $method);
forward_ref_val_binop!(impl $imp, $method);
forward_val_ref_binop!(impl $imp, $method);
};
}

/* arithmetic */
forward_all_binop!(impl Add, add)
forward_all_binop!(impl Add, add);

// (a + i b) + (c + i d) == (a + c) + i (b + d)
impl<'a, 'b, T: Clone + Num> Add<&'b Complex<T>, Complex<T>> for &'a Complex<T> {
Expand All @@ -155,7 +155,7 @@ impl<'a, 'b, T: Clone + Num> Add<&'b Complex<T>, Complex<T>> for &'a Complex<T>
}
}

forward_all_binop!(impl Sub, sub)
forward_all_binop!(impl Sub, sub);

// (a + i b) - (c + i d) == (a - c) + i (b - d)
impl<'a, 'b, T: Clone + Num> Sub<&'b Complex<T>, Complex<T>> for &'a Complex<T> {
Expand All @@ -166,7 +166,7 @@ impl<'a, 'b, T: Clone + Num> Sub<&'b Complex<T>, Complex<T>> for &'a Complex<T>
}
}

forward_all_binop!(impl Mul, mul)
forward_all_binop!(impl Mul, mul);

// (a + i b) * (c + i d) == (a*c - b*d) + i (a*d + b*c)
impl<'a, 'b, T: Clone + Num> Mul<&'b Complex<T>, Complex<T>> for &'a Complex<T> {
Expand All @@ -177,7 +177,7 @@ impl<'a, 'b, T: Clone + Num> Mul<&'b Complex<T>, Complex<T>> for &'a Complex<T>
}
}

forward_all_binop!(impl Div, div)
forward_all_binop!(impl Div, div);

// (a + i b) / (c + i d) == [(a + i b) * (c - i d)] / (c*c + d*d)
// == [(a*c + b*d) / (c*c + d*d)] + i [(b*c - a*d) / (c*c + d*d)]
Expand Down
20 changes: 10 additions & 10 deletions src/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,11 @@ macro_rules! impl_integer_for_int {
)
}

impl_integer_for_int!(i8, test_integer_i8)
impl_integer_for_int!(i16, test_integer_i16)
impl_integer_for_int!(i32, test_integer_i32)
impl_integer_for_int!(i64, test_integer_i64)
impl_integer_for_int!(int, test_integer_int)
impl_integer_for_int!(i8, test_integer_i8);
impl_integer_for_int!(i16, test_integer_i16);
impl_integer_for_int!(i32, test_integer_i32);
impl_integer_for_int!(i64, test_integer_i64);
impl_integer_for_int!(int, test_integer_int);

macro_rules! impl_integer_for_uint {
($T:ty, $test_mod:ident) => (
Expand Down Expand Up @@ -501,8 +501,8 @@ macro_rules! impl_integer_for_uint {
)
}

impl_integer_for_uint!(u8, test_integer_u8)
impl_integer_for_uint!(u16, test_integer_u16)
impl_integer_for_uint!(u32, test_integer_u32)
impl_integer_for_uint!(u64, test_integer_u64)
impl_integer_for_uint!(uint, test_integer_uint)
impl_integer_for_uint!(u8, test_integer_u8);
impl_integer_for_uint!(u16, test_integer_u16);
impl_integer_for_uint!(u32, test_integer_u32);
impl_integer_for_uint!(u64, test_integer_u64);
impl_integer_for_uint!(uint, test_integer_uint);
28 changes: 14 additions & 14 deletions src/rational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl Ratio<BigInt> {
// "method name" (return value is bool in that case)
macro_rules! cmp_impl {
(impl $imp:ident, $($method:ident),+) => {
cmp_impl!(impl $imp, $($method -> bool),+)
cmp_impl!(impl $imp, $($method -> bool),+);
};
// return something other than a Ratio<T>
(impl $imp:ident, $($method:ident -> $res:ty),*) => {
Expand All @@ -225,11 +225,11 @@ macro_rules! cmp_impl {
}
};
}
cmp_impl!(impl PartialEq, eq, ne)
cmp_impl!(impl PartialEq, eq, ne);
cmp_impl!(impl PartialOrd, lt -> bool, gt -> bool, le -> bool, ge -> bool,
partial_cmp -> Option<cmp::Ordering>)
cmp_impl!(impl Eq, )
cmp_impl!(impl Ord, cmp -> cmp::Ordering)
partial_cmp -> Option<cmp::Ordering>);
cmp_impl!(impl Eq, );
cmp_impl!(impl Ord, cmp -> cmp::Ordering);

macro_rules! forward_val_val_binop {
(impl $imp:ident, $method:ident) => {
Expand Down Expand Up @@ -266,14 +266,14 @@ macro_rules! forward_val_ref_binop {

macro_rules! forward_all_binop {
(impl $imp:ident, $method:ident) => {
forward_val_val_binop!(impl $imp, $method)
forward_ref_val_binop!(impl $imp, $method)
forward_val_ref_binop!(impl $imp, $method)
forward_val_val_binop!(impl $imp, $method);
forward_ref_val_binop!(impl $imp, $method);
forward_val_ref_binop!(impl $imp, $method);
};
}

/* Arithmetic */
forward_all_binop!(impl Mul, mul)
forward_all_binop!(impl Mul, mul);
// a/b * c/d = (a*c)/(b*d)
impl<'a, 'b, T: Clone + Integer + PartialOrd>
Mul<&'b Ratio<T>, Ratio<T>> for &'a Ratio<T> {
Expand All @@ -283,7 +283,7 @@ impl<'a, 'b, T: Clone + Integer + PartialOrd>
}
}

forward_all_binop!(impl Div, div)
forward_all_binop!(impl Div, div);
// (a/b) / (c/d) = (a*d)/(b*c)
impl<'a, 'b, T: Clone + Integer + PartialOrd>
Div<&'b Ratio<T>, Ratio<T>> for &'a Ratio<T> {
Expand All @@ -296,7 +296,7 @@ impl<'a, 'b, T: Clone + Integer + PartialOrd>
// Abstracts the a/b `op` c/d = (a*d `op` b*d) / (b*d) pattern
macro_rules! arith_impl {
(impl $imp:ident, $method:ident) => {
forward_all_binop!(impl $imp, $method)
forward_all_binop!(impl $imp, $method);
impl<'a, 'b, T: Clone + Integer + PartialOrd>
$imp<&'b Ratio<T>,Ratio<T>> for &'a Ratio<T> {
#[inline]
Expand All @@ -309,13 +309,13 @@ macro_rules! arith_impl {
}

// a/b + c/d = (a*d + b*c)/(b*d)
arith_impl!(impl Add, add)
arith_impl!(impl Add, add);

// a/b - c/d = (a*d - b*c)/(b*d)
arith_impl!(impl Sub, sub)
arith_impl!(impl Sub, sub);

// a/b % c/d = (a*d % b*c)/(b*d)
arith_impl!(impl Rem, rem)
arith_impl!(impl Rem, rem);

impl<T: Clone + Integer + PartialOrd>
Neg<Ratio<T>> for Ratio<T> {
Expand Down
Loading