Fix compile errors (many derives fixes and append_to_row (&mut mut))

This commit is contained in:
Waffle 2019-09-12 22:24:38 +03:00
parent 0d83c1b106
commit 7e297bb25e
9 changed files with 13 additions and 13 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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,

View file

@ -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 {

View file

@ -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,

View file

@ -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,

View file

@ -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 {

View file

@ -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

View file

@ -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