Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d15a221

Browse files
Merge pull request #1019 from joshtriplett/fix-ci
Fix CI errors about unused-macro-rules
2 parents 264a712 + abbf944 commit d15a221

File tree

2 files changed

+16
-44
lines changed

2 files changed

+16
-44
lines changed

‎src/stream/product.rs‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use core::ops::Mul;
2727
use core::num::Wrapping;
2828
use crate::stream::stream::StreamExt;
2929

30-
macro_rules! integer_product {
31-
(@impls $one:expr, $($a:ty)*) => ($(
30+
macro_rules! num_product {
31+
($one:expr, $($a:ty)*) => ($(
3232
impl Product for $a {
3333
fn product<'a, S>(stream: S) -> Pin<Box<dyn Future<Output = Self>+ 'a>>
3434
where
@@ -46,32 +46,18 @@ macro_rules! integer_product {
4646
}
4747
}
4848
)*);
49+
}
50+
51+
macro_rules! integer_product {
4952
($($a:ty)*) => (
50-
integer_product!(@impls 1, $($a)*);
51-
integer_product!(@impls Wrapping(1), $(Wrapping<$a>)*);
53+
num_product!(1, $($a)*);
54+
num_product!(Wrapping(1), $(Wrapping<$a>)*);
5255
);
5356
}
5457

5558
macro_rules! float_product {
56-
($($a:ty)*) => ($(
57-
impl Product for $a {
58-
fn product<'a, S>(stream: S) -> Pin<Box<dyn Future<Output = Self>+ 'a>>
59-
where S: Stream<Item = $a> + 'a,
60-
{
61-
Box::pin(async move { stream.fold(1.0, |a, b| a * b).await } )
62-
}
63-
}
64-
impl<'a> Product<&'a $a> for $a {
65-
fn product<'b, S>(stream: S) -> Pin<Box<dyn Future<Output = Self>+ 'b>>
66-
where S: Stream<Item = &'a $a> + 'b,
67-
{
68-
Box::pin(async move { stream.fold(1.0, |a, b| a * b).await } )
69-
}
70-
}
71-
)*);
7259
($($a:ty)*) => (
73-
float_product!($($a)*);
74-
float_product!($(Wrapping<$a>)*);
60+
num_product!(1.0, $($a)*);
7561
);
7662
}
7763

‎src/stream/sum.rs‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use crate::stream::stream::StreamExt;
2727
use core::num::Wrapping;
2828
use core::ops::Add;
2929

30-
macro_rules! integer_sum {
31-
(@impls $zero:expr, $($a:ty)*) => ($(
30+
macro_rules! num_sum {
31+
($zero:expr, $($a:ty)*) => ($(
3232
impl Sum for $a {
3333
fn sum<'a, S>(stream: S) -> Pin<Box<dyn Future<Output = Self>+ 'a>>
3434
where
@@ -46,32 +46,18 @@ macro_rules! integer_sum {
4646
}
4747
}
4848
)*);
49+
}
50+
51+
macro_rules! integer_sum {
4952
($($a:ty)*) => (
50-
integer_sum!(@impls 0, $($a)*);
51-
integer_sum!(@impls Wrapping(0), $(Wrapping<$a>)*);
53+
num_sum!(0, $($a)*);
54+
num_sum!(Wrapping(0), $(Wrapping<$a>)*);
5255
);
5356
}
5457

5558
macro_rules! float_sum {
56-
($($a:ty)*) => ($(
57-
impl Sum for $a {
58-
fn sum<'a, S>(stream: S) -> Pin<Box<dyn Future<Output = Self> + 'a>>
59-
where S: Stream<Item = $a> + 'a,
60-
{
61-
Box::pin(async move { stream.fold(0.0, |a, b| a + b).await } )
62-
}
63-
}
64-
impl<'a> Sum<&'a $a> for $a {
65-
fn sum<'b, S>(stream: S) -> Pin<Box<dyn Future<Output = Self> + 'b>>
66-
where S: Stream<Item = &'a $a> + 'b,
67-
{
68-
Box::pin(async move { stream.fold(0.0, |a, b| a + b).await } )
69-
}
70-
}
71-
)*);
7259
($($a:ty)*) => (
73-
float_sum!(@impls 0.0, $($a)*);
74-
float_sum!(@impls Wrapping(0.0), $(Wrapping<$a>)*);
60+
num_sum!(0.0, $($a)*);
7561
);
7662
}
7763

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /