Merge pull request #124 from teloxide/fix-fmt

Fix rustfmt
This commit is contained in:
Temirkhan Myrzamadi 2020-01-05 02:41:55 +06:00 committed by GitHub
commit ae0454a716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 108 deletions

View file

@ -186,8 +186,7 @@ impl<'a, HandlerE, Eh> FilterDispatcher<'a, HandlerE, Eh> {
Eh: ErrorHandler<Either<UpdaterE, HandlerE>>,
{
updater
.for_each_concurrent(None, |res| {
async {
.for_each_concurrent(None, |res| async {
let Update { kind, id } = match res {
Ok(upd) => upd,
Err(err) => {
@ -262,7 +261,6 @@ impl<'a, HandlerE, Eh> FilterDispatcher<'a, HandlerE, Eh> {
.await;
}
}
}
})
.await;
}
@ -310,17 +308,13 @@ mod tests {
let counter2 = &AtomicI32::new(0);
let mut dp = FilterDispatcher::<Infallible, _>::new(|_| async {})
.message_handler(true, |_mes: Message| {
async move {
.message_handler(true, |_mes: Message| async move {
counter.fetch_add(1, Ordering::SeqCst);
Ok::<_, Infallible>(())
}
})
.message_handler(true, |_mes: Message| {
async move {
.message_handler(true, |_mes: Message| async move {
counter2.fetch_add(1, Ordering::SeqCst);
Ok::<_, Infallible>(())
}
});
dp.dispatch(one_message_updater()).await;

View file

@ -146,8 +146,7 @@ pub fn polling(
stream::unfold(
(allowed_updates, bot, 0),
move |(mut allowed_updates, bot, mut offset)| {
async move {
move |(mut allowed_updates, bot, mut offset)| async move {
let mut req = bot.get_updates().offset(offset);
req.timeout = timeout;
req.limit = limit;
@ -164,7 +163,6 @@ pub fn polling(
};
Some((stream::iter(updates), (allowed_updates, bot, offset)))
}
},
)
.flatten()

View file

@ -39,13 +39,11 @@ pub async fn download_file_stream(
.await?
.error_for_status()?;
Ok(futures::stream::unfold(res, |mut res| {
async {
Ok(futures::stream::unfold(res, |mut res| async {
match res.chunk().await {
Err(err) => Some((Err(err), res)),
Ok(Some(c)) => Some((Ok(c), res)),
Ok(None) => None,
}
}
}))
}