mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Refactor src/dispatching/dialogue/storage/redis_storage.rs
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
This commit is contained in:
parent
5585143ac2
commit
94e61d3403
1 changed files with 10 additions and 13 deletions
|
@ -65,19 +65,16 @@ where
|
||||||
.query_async::<_, redis::Value>(self.conn.lock().await.deref_mut())
|
.query_async::<_, redis::Value>(self.conn.lock().await.deref_mut())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let deleted_rows_count = match deleted_rows_count {
|
if let redis::Value::Bulk(values) = deleted_rows_count {
|
||||||
redis::Value::Bulk(values) => match values[0] {
|
if let redis::Value::Int(deleted_rows_count) = values[0] {
|
||||||
redis::Value::Int(x) => x,
|
match deleted_rows_count {
|
||||||
_ => unreachable!("Must return redis::Value::Int"),
|
0 => return Err(RedisStorageError::RowNotFound),
|
||||||
},
|
_ => return Ok(())
|
||||||
_ => unreachable!("Must return redis::Value::Bulk"),
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if deleted_rows_count == 0 {
|
unreachable!("Must return redis::Value::Bulk(redis::Value::Int(_))");
|
||||||
return Err(RedisStorageError::RowNotFound);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue