Remove meaningless impls

This commit is contained in:
Henriquelay 2024-03-07 00:51:10 -03:00
parent 69874823d7
commit 77909e04b0
No known key found for this signature in database
GPG key ID: 02843DDA217C9D81
2 changed files with 2 additions and 21 deletions

View file

@ -44,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `filter_video_chat_ended`
- `filter_video_chat_participants_invited`
- `filter_web_app_data`
- Implement `GetChatId` for `teloxide_core::types::{Chat, ChatJoinRequest, ChatMemberUpdated, Recipient, TargetMessage}`.
- Implement `GetChatId` for `teloxide_core::types::{Chat, ChatJoinRequest, ChatMemberUpdated}`.
### Fixed

View file

@ -1,6 +1,5 @@
use crate::types::{
CallbackQuery, Chat, ChatId, ChatJoinRequest, ChatMemberUpdated, Message,
Recipient, TargetMessage, Update,
CallbackQuery, Chat, ChatId, ChatJoinRequest, ChatMemberUpdated, Message, Update,
};
/// Something that may have a chat ID.
@ -27,30 +26,12 @@ impl GetChatId for Update {
}
}
impl GetChatId for Recipient {
fn chat_id(&self) -> Option<ChatId> {
match self {
Recipient::Id(chat_id) => Some(*chat_id),
Recipient::ChannelUsername(_) => None,
}
}
}
impl GetChatId for Chat {
fn chat_id(&self) -> Option<ChatId> {
Some(self.id)
}
}
impl GetChatId for TargetMessage {
fn chat_id(&self) -> Option<ChatId> {
match self {
TargetMessage::Common { chat_id: recipient, .. } => recipient.chat_id(),
TargetMessage::Inline { .. } => None,
}
}
}
impl GetChatId for ChatMemberUpdated {
fn chat_id(&self) -> Option<ChatId> {
Some(self.chat.id)