From 7e297bb25e3206f3ce5f26be69b1179b6b75d8e9 Mon Sep 17 00:00:00 2001 From: Waffle Date: Thu, 12 Sep 2019 22:24:38 +0300 Subject: [PATCH] Fix compile errors (many `derive`s fixes and `append_to_row` (`&mut mut`)) --- src/core/types/chat.rs | 4 ++-- src/core/types/game.rs | 2 +- src/core/types/mask_position.rs | 2 +- src/core/types/message.rs | 8 ++++---- src/core/types/sticker.rs | 2 +- src/core/types/venue.rs | 2 +- src/core/types/video_note.rs | 2 +- src/core/types/voice.rs | 2 +- src/keyboards/inline_keyboard_markup.rs | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/types/chat.rs b/src/core/types/chat.rs index 6dd2422f..b27e7686 100644 --- a/src/core/types/chat.rs +++ b/src/core/types/chat.rs @@ -1,7 +1,7 @@ use crate::core::types::{ChatPermissions, ChatPhoto, Message}; -#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] pub struct Chat { pub id: i64, #[serde(flatten)] @@ -10,7 +10,7 @@ pub struct Chat { } -#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] #[serde(untagged)] pub enum ChatKind { NonPrivate { diff --git a/src/core/types/game.rs b/src/core/types/game.rs index 2edf6383..bdd43adb 100644 --- a/src/core/types/game.rs +++ b/src/core/types/game.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::{MessageEntity, PhotoSize, Animation}; -#[derive(Debug, Deserialize, Clone)] +#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)] /// This object represents a game. Use BotFather to create and edit games, their short names /// will act as unique identifiers. pub struct Game { diff --git a/src/core/types/mask_position.rs b/src/core/types/mask_position.rs index 4056ebcf..603181a6 100644 --- a/src/core/types/mask_position.rs +++ b/src/core/types/mask_position.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)] +#[derive(Debug, Deserialize, PartialEq, Clone)] pub struct MaskPosition { pub point: String, pub x_shift: f64, diff --git a/src/core/types/message.rs b/src/core/types/message.rs index c2f10258..a5711fc8 100644 --- a/src/core/types/message.rs +++ b/src/core/types/message.rs @@ -4,7 +4,7 @@ use crate::core::types::{ SuccessfulPayment, User, Venue, Video, VideoNote, Voice, }; -#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] pub struct Message { #[serde(rename = "message_id")] pub id: i64, @@ -14,7 +14,7 @@ pub struct Message { pub message_kind: MessageKind, } -#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] #[serde(untagged)] pub enum MessageKind { IncomingMessage { @@ -82,7 +82,7 @@ pub enum Sender { Signature(String), } -#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] #[serde(untagged)] pub enum ForwardKind { ChannelForward { @@ -114,7 +114,7 @@ pub enum ForwardedFrom { SenderName(String), } -#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] #[serde(untagged)] pub enum MediaKind { Animation { diff --git a/src/core/types/sticker.rs b/src/core/types/sticker.rs index d962117d..22e25c10 100644 --- a/src/core/types/sticker.rs +++ b/src/core/types/sticker.rs @@ -1,6 +1,6 @@ use crate::core::types::{MaskPosition, PhotoSize}; -#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)] +#[derive(Debug, Deserialize, PartialEq, Clone)] pub struct Sticker { pub file_id: String, pub width: u16, diff --git a/src/core/types/venue.rs b/src/core/types/venue.rs index c4541447..c0dcc7ee 100644 --- a/src/core/types/venue.rs +++ b/src/core/types/venue.rs @@ -2,7 +2,7 @@ use crate::core::types::Location; /// This object represents a venue. -#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)] +#[derive(Debug, Deserialize, PartialEq, Serialize, Clone)] pub struct Venue { /// Venue location pub location: Location, diff --git a/src/core/types/video_note.rs b/src/core/types/video_note.rs index 00b3f6e2..893664b4 100644 --- a/src/core/types/video_note.rs +++ b/src/core/types/video_note.rs @@ -1,7 +1,7 @@ use serde::Deserialize; use crate::core::types::PhotoSize; -#[derive(Debug, Deserialize, Clone)] +#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)] /// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope) /// (available in Telegram apps as of v.4.0). pub struct VideoNote { diff --git a/src/core/types/voice.rs b/src/core/types/voice.rs index 6147b470..9cd71c09 100644 --- a/src/core/types/voice.rs +++ b/src/core/types/voice.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize, Clone)] +#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)] /// This object represents a voice note. pub struct Voice { /// Identifier for this file diff --git a/src/keyboards/inline_keyboard_markup.rs b/src/keyboards/inline_keyboard_markup.rs index 3fd49ee7..e0ff0663 100644 --- a/src/keyboards/inline_keyboard_markup.rs +++ b/src/keyboards/inline_keyboard_markup.rs @@ -37,7 +37,7 @@ impl InlineKeyboardMarkupBuilder { pub fn append_to_row(mut self, button: InlineKeyboardButton, index: usize) -> Self { match self.keyboard.inline_keyboard.get_mut(index) { - Some(&mut mut buttons) => buttons.push(button), + Some(buttons) => buttons.push(button), None => self.keyboard.inline_keyboard.push(vec![button]) }; self