Skip to content

Commit 001b75d

Browse files
committed
avoid Fn* supertraits on Parallel* as they slightly impact type inference
1 parent ec1e9b8 commit 001b75d

File tree

5 files changed

+3
-8
lines changed

5 files changed

+3
-8
lines changed

amadeus-core/src/par_pipe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub trait PipeTask<Source> {
1515
}
1616

1717
macro_rules! pipe {
18-
($pipe:ident $sink:ident $from_sink:ident $send:ident $assert_pipe:ident $assert_sink:ident) => {
19-
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
18+
($pipe:ident $sink:ident $from_sink:ident $send:ident $assert_pipe:ident $assert_sink:ident $($meta:meta)*) => {
19+
$(#[$meta])*
2020
#[must_use]
2121
pub trait $pipe<Source> {
2222
type Item;
@@ -285,4 +285,4 @@ macro_rules! pipe {
285285
}
286286

287287
pipe!(ParallelPipe ParallelSink FromParallelStream Send assert_parallel_pipe assert_parallel_sink);
288-
pipe!(DistributedPipe DistributedSink FromDistributedStream ProcessSend assert_distributed_pipe assert_distributed_sink);
288+
pipe!(DistributedPipe DistributedSink FromDistributedStream ProcessSend assert_distributed_pipe assert_distributed_sink cfg_attr(not(feature = "doc"), serde_closure::generalize));

amadeus-core/src/par_stream.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ pub(crate) fn assert_distributed_stream<T, I: DistributedStream<Item = T>>(i: I)
558558
}
559559

560560
#[async_trait(?Send)]
561-
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
562561
#[must_use]
563562
pub trait ParallelStream {
564563
type Item;

amadeus-core/src/pool.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub trait ProcessPool: Clone + Send + Sync + RefUnwindSafe + UnwindSafe + Unpin
2121
T: ProcessSend + 'static;
2222
}
2323

24-
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
2524
pub trait ThreadPool: Clone + Send + Sync + RefUnwindSafe + UnwindSafe + Unpin {
2625
fn threads(&self) -> usize;
2726
fn spawn<F, Fut, T>(&self, work: F) -> BoxFuture<'static, Result<T>>
@@ -51,7 +50,6 @@ where
5150
}
5251
}
5352

54-
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
5553
impl<P: ?Sized> ThreadPool for &P
5654
where
5755
P: ThreadPool,

src/pool.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ impl ProcessPoolTrait for ThreadPool {
5656
}
5757
}
5858

59-
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
6059
impl ThreadPoolTrait for ThreadPool {
6160
fn threads(&self) -> usize {
6261
ThreadPool::threads(self)

src/pool/thread.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ struct ThreadPoolInner {
2121

2222
#[derive(Debug)]
2323
pub struct ThreadPool(Arc<ThreadPoolInner>);
24-
#[cfg_attr(not(feature = "doc"), serde_closure::generalize)]
2524
impl ThreadPool {
2625
pub fn new(tasks_per_core: Option<usize>) -> io::Result<Self> {
2726
let logical_cores = num_cpus::get();

0 commit comments

Comments
 (0)