From 69e70b1d0e0ef82336a093a7090a504e0f622f1f Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Fri, 3 Jan 2020 15:54:26 +0600 Subject: [PATCH] Fix Clippy --- src/requests/all/add_sticker_to_set.rs | 9 +++------ src/requests/all/create_new_sticker_set.rs | 12 ++++-------- src/requests/all/send_audio.rs | 8 +++----- src/requests/all/send_document.rs | 8 +++----- src/requests/all/send_photo.rs | 6 ++---- src/requests/all/send_sticker.rs | 6 ++---- src/requests/all/send_video.rs | 8 +++----- src/requests/all/send_video_note.rs | 8 +++----- src/requests/all/send_voice.rs | 6 ++---- 9 files changed, 25 insertions(+), 46 deletions(-) diff --git a/src/requests/all/add_sticker_to_set.rs b/src/requests/all/add_sticker_to_set.rs index e4545e69..5049ce21 100644 --- a/src/requests/all/add_sticker_to_set.rs +++ b/src/requests/all/add_sticker_to_set.rs @@ -66,15 +66,12 @@ impl<'a> AddStickerToSet<'a> { N: Into, E: Into, { - let name = name.into(); - let png_sticker = png_sticker.into(); - let emojis = emojis.into(); Self { bot, user_id, - name, + name: name.into(), png_sticker, - emojis, + emojis: emojis.into(), mask_position: None, } } @@ -93,7 +90,7 @@ impl<'a> AddStickerToSet<'a> { } pub fn png_sticker(mut self, val: InputFile) -> Self { - self.png_sticker = val.into(); + self.png_sticker = val; self } diff --git a/src/requests/all/create_new_sticker_set.rs b/src/requests/all/create_new_sticker_set.rs index 6bec89c0..1f05bc51 100644 --- a/src/requests/all/create_new_sticker_set.rs +++ b/src/requests/all/create_new_sticker_set.rs @@ -76,17 +76,13 @@ impl<'a> CreateNewStickerSet<'a> { T: Into, E: Into, { - let name = name.into(); - let title = title.into(); - let png_sticker = png_sticker.into(); - let emojis = emojis.into(); Self { bot, user_id, - name, - title, + name: name.into(), + title: title.into(), png_sticker, - emojis, + emojis: emojis.into(), contains_masks: None, mask_position: None, } @@ -114,7 +110,7 @@ impl<'a> CreateNewStickerSet<'a> { } pub fn png_sticker(mut self, val: InputFile) -> Self { - self.png_sticker = val.into(); + self.png_sticker = val; self } diff --git a/src/requests/all/send_audio.rs b/src/requests/all/send_audio.rs index 0753acbe..bee572c0 100644 --- a/src/requests/all/send_audio.rs +++ b/src/requests/all/send_audio.rs @@ -87,11 +87,9 @@ impl<'a> SendAudio<'a> { where C: Into, { - let chat_id = chat_id.into(); - let audio = audio.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), audio, caption: None, parse_mode: None, @@ -114,7 +112,7 @@ impl<'a> SendAudio<'a> { } pub fn audio(mut self, val: InputFile) -> Self { - self.audio = val.into(); + self.audio = val; self } @@ -153,7 +151,7 @@ impl<'a> SendAudio<'a> { } pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val.into()); + self.thumb = Some(val); self } diff --git a/src/requests/all/send_document.rs b/src/requests/all/send_document.rs index 5c613dc1..65e870f0 100644 --- a/src/requests/all/send_document.rs +++ b/src/requests/all/send_document.rs @@ -77,11 +77,9 @@ impl<'a> SendDocument<'a> { where C: Into, { - let chat_id = chat_id.into(); - let document = document.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), document, thumb: None, caption: None, @@ -101,12 +99,12 @@ impl<'a> SendDocument<'a> { } pub fn document(mut self, val: InputFile) -> Self { - self.document = val.into(); + self.document = val; self } pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val.into()); + self.thumb = Some(val); self } diff --git a/src/requests/all/send_photo.rs b/src/requests/all/send_photo.rs index d10ef1e8..9ddfd157 100644 --- a/src/requests/all/send_photo.rs +++ b/src/requests/all/send_photo.rs @@ -65,11 +65,9 @@ impl<'a> SendPhoto<'a> { where C: Into, { - let chat_id = chat_id.into(); - let photo = photo.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), photo, caption: None, parse_mode: None, @@ -88,7 +86,7 @@ impl<'a> SendPhoto<'a> { } pub fn photo(mut self, val: InputFile) -> Self { - self.photo = val.into(); + self.photo = val; self } diff --git a/src/requests/all/send_sticker.rs b/src/requests/all/send_sticker.rs index e187da2b..74b0f4f5 100644 --- a/src/requests/all/send_sticker.rs +++ b/src/requests/all/send_sticker.rs @@ -58,11 +58,9 @@ impl<'a> SendSticker<'a> { where C: Into, { - let chat_id = chat_id.into(); - let sticker = sticker.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), sticker, disable_notification: None, reply_to_message_id: None, @@ -79,7 +77,7 @@ impl<'a> SendSticker<'a> { } pub fn sticker(mut self, val: InputFile) -> Self { - self.sticker = val.into(); + self.sticker = val; self } diff --git a/src/requests/all/send_video.rs b/src/requests/all/send_video.rs index 6a7a85ae..e564e78f 100644 --- a/src/requests/all/send_video.rs +++ b/src/requests/all/send_video.rs @@ -90,11 +90,9 @@ impl<'a> SendVideo<'a> { where C: Into, { - let chat_id = chat_id.into(); - let video = video.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), video, duration: None, width: None, @@ -118,7 +116,7 @@ impl<'a> SendVideo<'a> { } pub fn video(mut self, val: InputFile) -> Self { - self.video = val.into(); + self.video = val; self } @@ -138,7 +136,7 @@ impl<'a> SendVideo<'a> { } pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val.into()); + self.thumb = Some(val); self } diff --git a/src/requests/all/send_video_note.rs b/src/requests/all/send_video_note.rs index 4b668cb8..62716d37 100644 --- a/src/requests/all/send_video_note.rs +++ b/src/requests/all/send_video_note.rs @@ -79,11 +79,9 @@ impl<'a> SendVideoNote<'a> { where C: Into, { - let chat_id = chat_id.into(); - let video_note = video_note.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), video_note, duration: None, length: None, @@ -103,7 +101,7 @@ impl<'a> SendVideoNote<'a> { } pub fn video_note(mut self, val: InputFile) -> Self { - self.video_note = val.into(); + self.video_note = val; self } @@ -118,7 +116,7 @@ impl<'a> SendVideoNote<'a> { } pub fn thumb(mut self, val: InputFile) -> Self { - self.thumb = Some(val.into()); + self.thumb = Some(val); self } diff --git a/src/requests/all/send_voice.rs b/src/requests/all/send_voice.rs index 2341ca71..5ea744a8 100644 --- a/src/requests/all/send_voice.rs +++ b/src/requests/all/send_voice.rs @@ -72,11 +72,9 @@ impl<'a> SendVoice<'a> { where C: Into, { - let chat_id = chat_id.into(); - let voice = voice.into(); Self { bot, - chat_id, + chat_id: chat_id.into(), voice, caption: None, parse_mode: None, @@ -96,7 +94,7 @@ impl<'a> SendVoice<'a> { } pub fn voice(mut self, val: InputFile) -> Self { - self.voice = val.into(); + self.voice = val; self }