Merge pull request #152 from teloxide/improve_debug_assert

Improve `debug_assert!` message in `ChatId::unmark`
This commit is contained in:
Waffle Maybe 2021-12-25 11:02:27 +03:00 committed by GitHub
commit 08e2befd2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,7 +32,7 @@ impl ChatId {
&Self::Id(id @ MIN_CHAT_ID..=-1) => Chat(-id as _),
&Self::Id(id @ MIN_CHANNEL_ID..=MAX_CHANNEL_ID) => Channel((MAX_CHANNEL_ID - id) as _),
&Self::Id(id) => {
debug_assert!(0 < id && id < MAX_USER_ID, "malformed chat id");
debug_assert!(0 < id && id < MAX_USER_ID, "malformed chat id: {}", id);
User(id as _)
}
Self::ChannelUsername(_) => return None,