Skip to content

Commit

Permalink
Remove unnecessary types in extension_trait.
Browse files Browse the repository at this point in the history
The remaining type requires the square brackets (for now) because a `ty`
cannot immediately precede a `$(tt)*`.
  • Loading branch information
nnethercote committed Mar 11, 2022
1 parent c10d2d3 commit 6b3667d
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 54 deletions.
15 changes: 7 additions & 8 deletions src/future/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extension_trait! {
/// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn delay(self, dur: Duration) -> impl Future<Output = Self::Output> [DelayFuture<Self>]
fn delay(self, dur: Duration) -> [DelayFuture<Self>]
where
Self: Sized,
{
Expand All @@ -70,8 +70,7 @@ extension_trait! {
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn flatten(
self,
) -> impl Future<Output = <Self::Output as IntoFuture>::Output>
[FlattenFuture<Self, <Self::Output as IntoFuture>::Future>]
) -> [FlattenFuture<Self, <Self::Output as IntoFuture>::Future>]
where
Self: Sized,
<Self as Future>::Output: IntoFuture,
Expand Down Expand Up @@ -113,7 +112,7 @@ extension_trait! {
fn race<F>(
self,
other: F,
) -> impl Future<Output = <Self as std::future::Future>::Output> [Race<Self, F>]
) -> [Race<Self, F>]
where
Self: std::future::Future + Sized,
F: std::future::Future<Output = <Self as std::future::Future>::Output>,
Expand Down Expand Up @@ -159,7 +158,7 @@ extension_trait! {
fn try_race<F, T, E>(
self,
other: F
) -> impl Future<Output = <Self as std::future::Future>::Output> [TryRace<Self, F>]
) -> [TryRace<Self, F>]
where
Self: std::future::Future<Output = Result<T, E>> + Sized,
F: std::future::Future<Output = <Self as std::future::Future>::Output>,
Expand Down Expand Up @@ -196,7 +195,7 @@ extension_trait! {
fn join<F>(
self,
other: F
) -> impl Future<Output = (<Self as std::future::Future>::Output, <F as std::future::Future>::Output)> [Join<Self, F>]
) -> [Join<Self, F>]
where
Self: std::future::Future + Sized,
F: std::future::Future,
Expand Down Expand Up @@ -243,7 +242,7 @@ extension_trait! {
fn try_join<F, A, B, E>(
self,
other: F
) -> impl Future<Output = Result<(A, B), E>> [TryJoin<Self, F>]
) -> [TryJoin<Self, F>]
where
Self: std::future::Future<Output = Result<A, E>> + Sized,
F: std::future::Future<Output = Result<B, E>>,
Expand Down Expand Up @@ -279,7 +278,7 @@ extension_trait! {
"#]
#[cfg(any(all(feature = "default", feature = "unstable"), feature = "docs"))]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn timeout(self, dur: Duration) -> impl Future<Output = Self::Output> [TimeoutFuture<Self>]
fn timeout(self, dur: Duration) -> [TimeoutFuture<Self>]
where Self: Sized
{
TimeoutFuture::new(self, dur)
Expand Down
4 changes: 2 additions & 2 deletions src/io/buf_read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension_trait! {
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> impl Future<Output = usize> [ReadUntilFuture<'a, Self>]
) -> [ReadUntilFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down Expand Up @@ -131,7 +131,7 @@ extension_trait! {
fn read_line<'a>(
&'a mut self,
buf: &'a mut String,
) -> impl Future<Output = io::Result<usize>> [ReadLineFuture<'a, Self>]
) -> [ReadLineFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down
10 changes: 5 additions & 5 deletions src/io/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension_trait! {
fn read<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> impl Future<Output = io::Result<usize>> [ReadFuture<'a, Self>]
) -> [ReadFuture<'a, Self>]
where
Self: Unpin
{
Expand All @@ -86,7 +86,7 @@ extension_trait! {
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> impl Future<Output = io::Result<usize>> [ReadVectoredFuture<'a, Self>]
) -> [ReadVectoredFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down Expand Up @@ -123,7 +123,7 @@ extension_trait! {
fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> impl Future<Output = io::Result<usize>> [ReadToEndFuture<'a, Self>]
) -> [ReadToEndFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down Expand Up @@ -162,7 +162,7 @@ extension_trait! {
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> impl Future<Output = io::Result<usize>> [ReadToStringFuture<'a, Self>]
) -> [ReadToStringFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down Expand Up @@ -217,7 +217,7 @@ extension_trait! {
fn read_exact<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> impl Future<Output = io::Result<()>> [ReadExactFuture<'a, Self>]
) -> [ReadExactFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down
2 changes: 1 addition & 1 deletion src/io/seek/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension_trait! {
fn seek(
&mut self,
pos: SeekFrom,
) -> impl Future<Output = io::Result<u64>> [SeekFuture<'_, Self>]
) -> [SeekFuture<'_, Self>]
where
Self: Unpin,
{
Expand Down
10 changes: 5 additions & 5 deletions src/io/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension_trait! {
fn write<'a>(
&'a mut self,
buf: &'a [u8],
) -> impl Future<Output = io::Result<usize>> [WriteFuture<'a, Self>]
) -> [WriteFuture<'a, Self>]
where
Self: Unpin,
{
Expand All @@ -75,7 +75,7 @@ extension_trait! {
# Ok(()) }) }
```
"#]
fn flush(&mut self) -> impl Future<Output = io::Result<()>> [FlushFuture<'_, Self>]
fn flush(&mut self) -> [FlushFuture<'_, Self>]
where
Self: Unpin,
{
Expand All @@ -97,7 +97,7 @@ extension_trait! {
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> impl Future<Output = io::Result<usize>> [WriteVectoredFuture<'a, Self>]
) -> [WriteVectoredFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down Expand Up @@ -133,7 +133,7 @@ extension_trait! {
fn write_all<'a>(
&'a mut self,
buf: &'a [u8],
) -> impl Future<Output = io::Result<()>> [WriteAllFuture<'a, Self>]
) -> [WriteAllFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down Expand Up @@ -170,7 +170,7 @@ extension_trait! {
fn write_fmt<'a>(
&'a mut self,
fmt: std::fmt::Arguments<'_>,
) -> impl Future<Output = io::Result<()>> [WriteFmtFuture<'a, Self>]
) -> [WriteFmtFuture<'a, Self>]
where
Self: Unpin,
{
Expand Down

0 comments on commit 6b3667d

Please sign in to comment.