From c626a696706020e5e0cc018db8ea468ea165f529 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 11 Mar 2022 12:20:23 +1100 Subject: [PATCH] Move the blanket `impl` outside of `extension_trait`. --- src/future/future/mod.rs | 3 +++ src/io/buf_read/mod.rs | 2 ++ src/io/read/mod.rs | 3 ++- src/io/seek/mod.rs | 2 ++ src/io/write/mod.rs | 2 ++ src/stream/stream/mod.rs | 3 +++ src/utils.rs | 3 --- 7 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/future/future/mod.rs b/src/future/future/mod.rs index 46780f8c..05d099b0 100644 --- a/src/future/future/mod.rs +++ b/src/future/future/mod.rs @@ -285,3 +285,6 @@ extension_trait! { } } } + +impl FutureExt for T {} + diff --git a/src/io/buf_read/mod.rs b/src/io/buf_read/mod.rs index 2b1ee86b..1314dc9f 100644 --- a/src/io/buf_read/mod.rs +++ b/src/io/buf_read/mod.rs @@ -239,6 +239,8 @@ extension_trait! { } } +impl BufReadExt for T {} + pub fn read_until_internal( mut reader: Pin<&mut R>, cx: &mut Context<'_>, diff --git a/src/io/read/mod.rs b/src/io/read/mod.rs index 601bb7f1..9b5b9644 100644 --- a/src/io/read/mod.rs +++ b/src/io/read/mod.rs @@ -372,10 +372,11 @@ extension_trait! { fn chain(self, next: R) -> Chain where Self: Sized { Chain { first: self, second: next, done_first: false } } - } } +impl ReadExt for T {} + /// Initializes a buffer if necessary. /// /// Currently, a buffer is always initialized because `read_initializer` diff --git a/src/io/seek/mod.rs b/src/io/seek/mod.rs index 29723223..33ba25e3 100644 --- a/src/io/seek/mod.rs +++ b/src/io/seek/mod.rs @@ -48,3 +48,5 @@ extension_trait! { } } } + +impl SeekExt for T {} diff --git a/src/io/write/mod.rs b/src/io/write/mod.rs index c8befae3..3463d282 100644 --- a/src/io/write/mod.rs +++ b/src/io/write/mod.rs @@ -185,3 +185,5 @@ extension_trait! { } } } + +impl WriteExt for T {} diff --git a/src/stream/stream/mod.rs b/src/stream/stream/mod.rs index d71dc609..279a8369 100644 --- a/src/stream/stream/mod.rs +++ b/src/stream/stream/mod.rs @@ -2307,3 +2307,6 @@ extension_trait! { } } } + +impl StreamExt for T {} + diff --git a/src/utils.rs b/src/utils.rs index 1f3b7fc8..51b2fb0c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -265,9 +265,6 @@ macro_rules! extension_trait { pub trait $ext: $name { extension_trait!(@ext [$($body_ext)*] -> []); } - - // Blanket implementation of the extension trait for any type implementing the base trait. - impl $ext for T {} }; // Parse the return type in an extension method.