Skip to content

Commit

Permalink
Stop using top-level structs
Browse files Browse the repository at this point in the history
  • Loading branch information
Desiders committed Nov 30, 2023
1 parent c2b9caf commit a23a3d9
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/filters/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl Command<'_> {
if self.ignore_mention {
Ok(true)
} else if let Some(ref mention) = command.mention {
bot.send(GetMe).await.map(|user| {
bot.send(GetMe {}).await.map(|user| {
// `unwrap` is safe here, because bot always has username
user.username.unwrap() == *mention
})
Expand Down
4 changes: 2 additions & 2 deletions src/methods/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use serde::Serialize;
pub struct Close {}

impl Close {
pub fn new() -> Self {
Self::default()
pub const fn new() -> Self {
Self {}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/methods/get_forum_topic_icon_stickers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub struct GetForumTopicIconStickers {}

impl GetForumTopicIconStickers {
#[must_use]
pub fn new() -> Self {
Self::default()
pub const fn new() -> Self {
Self {}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/methods/get_me.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use serde::Serialize;
/// # Returns
/// Returns basic information about the bot in form of a [`User`] object
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct GetMe;
pub struct GetMe {}

impl GetMe {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/methods/log_out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub struct LogOut {}

impl LogOut {
#[must_use]
pub fn new() -> Self {
Self::default()
pub const fn new() -> Self {
Self {}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/types/bot_command_scope_all_chat_administrators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#botcommandscopeallchatadministrators>
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct BotCommandScopeAllChatAdministrators;
pub struct BotCommandScopeAllChatAdministrators {}

impl BotCommandScopeAllChatAdministrators {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}
4 changes: 2 additions & 2 deletions src/types/bot_command_scope_all_group_chats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#botcommandscopeallgroupchats>
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct BotCommandScopeAllGroupChats;
pub struct BotCommandScopeAllGroupChats {}

impl BotCommandScopeAllGroupChats {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}
4 changes: 2 additions & 2 deletions src/types/bot_command_scope_all_private_chats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#botcommandscopeallprivatechats>
#[derive(Debug, Default, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct BotCommandScopeAllPrivateChats;
pub struct BotCommandScopeAllPrivateChats {}

impl BotCommandScopeAllPrivateChats {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}
4 changes: 2 additions & 2 deletions src/types/bot_command_scope_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#botcommandscopedefault>
#[derive(Debug, Default, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct BotCommandScopeDefault;
pub struct BotCommandScopeDefault {}

impl BotCommandScopeDefault {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}
6 changes: 3 additions & 3 deletions src/types/callback_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#callbackgame>
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct CallbackGame;
pub struct CallbackGame {}

impl CallbackGame {
#[must_use]
pub fn new() -> Self {
Self
pub const fn new() -> Self {
Self {}
}
}
2 changes: 1 addition & 1 deletion src/types/game_high_score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ use serde::Deserialize;
/// If you've got any questions, please check out our `https://core.telegram.org/bots/faq <https://core.telegram.org/bots/faq>` **Bot FAQ »**
/// <https://core.telegram.org/bots/api#gamehighscore>
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize)]
pub struct GameHighScore;
pub struct GameHighScore {}
4 changes: 2 additions & 2 deletions src/types/menu_button_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#menubuttoncommands>
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct MenuButtonCommands;
pub struct MenuButtonCommands {}

impl MenuButtonCommands {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}
4 changes: 2 additions & 2 deletions src/types/menu_button_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
/// # Documentation
/// <https://core.telegram.org/bots/api#menubuttondefault>
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct MenuButtonDefault;
pub struct MenuButtonDefault {}

impl MenuButtonDefault {
#[must_use]
pub const fn new() -> Self {
Self
Self {}
}
}

0 comments on commit a23a3d9

Please sign in to comment.