Skip to content

Commit

Permalink
Use where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Aug 11, 2019
1 parent 959bdae commit f971b1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion futures-async-stream-macro/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use syn::{
token, Expr, ExprTuple, ExprVerbatim, Result,
};

pub(crate) fn first_last<T: ToTokens>(tokens: &T) -> (Span, Span) {
pub(crate) fn first_last<T>(tokens: &T) -> (Span, Span)
where
T: ToTokens,
{
let mut spans = TokenStream::new();
tokens.to_tokens(&mut spans);
let good_tokens = spans.into_iter().collect::<Vec<_>>();
Expand Down
7 changes: 5 additions & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ struct Next<'a, S> {
stream: &'a mut S,
}

impl<S: Unpin> Unpin for Next<'_, S> {}
impl<S> Unpin for Next<'_, S> where S: Unpin {}

impl<S: Stream + Unpin> Future for Next<'_, S> {
impl<S> Future for Next<'_, S>
where
S: Stream + Unpin,
{
type Output = Option<S::Item>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Expand Down

0 comments on commit f971b1e

Please sign in to comment.