Fix one error

This commit is contained in:
Temirkhan Myrzamadi 2019-12-30 18:51:49 +06:00
parent 117094e9d0
commit 51b52b8317

View file

@ -142,7 +142,7 @@ where
let mut allowed_updates = Some(allowed_updates.into()); let mut allowed_updates = Some(allowed_updates.into());
stream::unfold((bot, 0), move |(bot, mut offset)| async move { stream::unfold((bot, 0), move |(bot, mut offset)| async move {
let updates = bot let updates = match bot
.get_updates() .get_updates()
.offset(offset) .offset(offset)
.timeout(timeout.as_secs().try_into().expect("timeout is too big")) .timeout(timeout.as_secs().try_into().expect("timeout is too big"))
@ -150,15 +150,15 @@ where
.allowed_updates(allowed_updates.take().unwrap_or(&[])) .allowed_updates(allowed_updates.take().unwrap_or(&[]))
.send() .send()
.await .await
.map_or_else( {
|err| vec![Err(err)], Err(err) => vec![Err(err)],
|updates| { Ok(updates) => {
if let Some(upd) = updates.last() { if let Some(upd) = updates.last() {
offset = upd.id + 1; offset = upd.id + 1;
} }
updates.into_iter().map(Ok).collect::<Vec<_>>() updates.into_iter().map(Ok).collect::<Vec<_>>()
}, }
); };
Some((stream::iter(updates), (bot, offset))) Some((stream::iter(updates), (bot, offset)))
}) })