diff options
| author | Sebastian Gesemann <s.gesemann@gmail.com> | 2015-01-16 11:22:46 +0100 |
|---|---|---|
| committer | Sebastian Gesemann <s.gesemann@gmail.com> | 2015-01-16 11:22:46 +0100 |
| commit | c6c14b928f45302238f4dd4e32ee97e50af1bd6e (patch) | |
| tree | 9a0f400eff2bf9059c0d32ac509fd3543d21300d /src/libcore | |
| parent | 39676c8bf0ad0fe7249f788ab6ab6790360af73c (diff) | |
| download | rust-c6c14b928f45302238f4dd4e32ee97e50af1bd6e.tar.gz rust-c6c14b928f45302238f4dd4e32ee97e50af1bd6e.zip | |
inline forward_xxx_xxx_binop macros as per suggestion
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/ops.rs | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 88e0aac2b12..2007971d84d 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -120,9 +120,9 @@ macro_rules! forward_ref_unop { } } -// implements the binary operator "&T op U" -// based on "T + U" where T and U are expected `Copy`able -macro_rules! forward_ref_val_binop { +// implements binary operators "&T op U", "T op &U", "&T op &U" +// based on "T op U" where T and U are expected to be `Copy`able +macro_rules! forward_ref_binop { (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { #[unstable] impl<'a> $imp<$u> for &'a $t { @@ -133,13 +133,7 @@ macro_rules! forward_ref_val_binop { $imp::$method(*self, other) } } - } -} -// implements the binary operator "T op &U" -// based on "T + U" where T and U are expected `Copy`able -macro_rules! forward_val_ref_binop { - (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { #[unstable] impl<'a> $imp<&'a $u> for $t { type Output = <$t as $imp<$u>>::Output; @@ -149,13 +143,7 @@ macro_rules! forward_val_ref_binop { $imp::$method(self, *other) } } - } -} -// implements the binary operator "&T op &U" -// based on "T + U" where T and U are expected `Copy`able -macro_rules! forward_ref_ref_binop { - (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { #[unstable] impl<'a, 'b> $imp<&'a $u> for &'b $t { type Output = <$t as $imp<$u>>::Output; @@ -168,16 +156,6 @@ macro_rules! forward_ref_ref_binop { } } -// implements binary operators "&T op U", "T op &U", "&T op &U" -// based on "T + U" where T and U are expected `Copy`able -macro_rules! forward_ref_binop { - (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { - forward_ref_val_binop! { impl $imp, $method for $t, $u } - forward_val_ref_binop! { impl $imp, $method for $t, $u } - forward_ref_ref_binop! { impl $imp, $method for $t, $u } - } -} - /// The `Add` trait is used to specify the functionality of `+`. /// /// # Example |
