Skip to content

Commit c6c14b9

Browse files
committed
inline forward_xxx_xxx_binop macros as per suggestion
1 parent 39676c8 commit c6c14b9

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

src/libcore/ops.rs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ macro_rules! forward_ref_unop {
120120
}
121121
}
122122

123-
// implements the binary operator "&T op U"
124-
// based on "T + U" where T and U are expected `Copy`able
125-
macro_rules! forward_ref_val_binop {
123+
// implements binary operators "&T op U", "T op &U", "&T op &U"
124+
// based on "T op U" where T and U are expected to be `Copy`able
125+
macro_rules! forward_ref_binop {
126126
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
127127
#[unstable]
128128
impl<'a> $imp<$u> for &'a $t {
@@ -133,13 +133,7 @@ macro_rules! forward_ref_val_binop {
133133
$imp::$method(*self, other)
134134
}
135135
}
136-
}
137-
}
138136

139-
// implements the binary operator "T op &U"
140-
// based on "T + U" where T and U are expected `Copy`able
141-
macro_rules! forward_val_ref_binop {
142-
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
143137
#[unstable]
144138
impl<'a> $imp<&'a $u> for $t {
145139
type Output = <$t as $imp<$u>>::Output;
@@ -149,13 +143,7 @@ macro_rules! forward_val_ref_binop {
149143
$imp::$method(self, *other)
150144
}
151145
}
152-
}
153-
}
154146

155-
// implements the binary operator "&T op &U"
156-
// based on "T + U" where T and U are expected `Copy`able
157-
macro_rules! forward_ref_ref_binop {
158-
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
159147
#[unstable]
160148
impl<'a, 'b> $imp<&'a $u> for &'b $t {
161149
type Output = <$t as $imp<$u>>::Output;
@@ -168,16 +156,6 @@ macro_rules! forward_ref_ref_binop {
168156
}
169157
}
170158

171-
// implements binary operators "&T op U", "T op &U", "&T op &U"
172-
// based on "T + U" where T and U are expected `Copy`able
173-
macro_rules! forward_ref_binop {
174-
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
175-
forward_ref_val_binop! { impl $imp, $method for $t, $u }
176-
forward_val_ref_binop! { impl $imp, $method for $t, $u }
177-
forward_ref_ref_binop! { impl $imp, $method for $t, $u }
178-
}
179-
}
180-
181159
/// The `Add` trait is used to specify the functionality of `+`.
182160
///
183161
/// # Example

0 commit comments

Comments
 (0)