mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-23 07:09:34 +01:00
Merge imports by default (rustfmt.toml)
This commit is contained in:
parent
852b89be88
commit
ceaf36b101
46 changed files with 92 additions and 87 deletions
|
@ -1,4 +1,5 @@
|
|||
format_code_in_doc_comments = true
|
||||
wrap_comments = true
|
||||
format_strings = true
|
||||
max_width = 80
|
||||
max_width = 80
|
||||
merge_imports = true
|
|
@ -1,17 +1,14 @@
|
|||
use crate::bot::Bot;
|
||||
use crate::requests::{
|
||||
AnswerCallbackQuery, DeleteChatStickerSet, GetChatMember,
|
||||
GetChatMembersCount, SendAnimation, SendDocument, SendVideo,
|
||||
SetChatStickerSet,
|
||||
};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
requests::{
|
||||
AnswerPreCheckoutQuery, AnswerShippingQuery, EditMessageLiveLocation,
|
||||
ForwardMessage, GetFile, GetMe, GetUpdates, KickChatMember,
|
||||
PinChatMessage, PromoteChatMember, RestrictChatMember, SendAudio,
|
||||
SendChatAction, SendContact, SendLocation, SendMediaGroup, SendMessage,
|
||||
SendPhoto, SendPoll, SendVenue, SendVideoNote, SendVoice,
|
||||
SetChatDescription, StopMessageLiveLocation, UnbanChatMember,
|
||||
AnswerCallbackQuery, AnswerPreCheckoutQuery, AnswerShippingQuery,
|
||||
DeleteChatStickerSet, EditMessageLiveLocation, ForwardMessage,
|
||||
GetChatMember, GetChatMembersCount, GetFile, GetMe, GetUpdates,
|
||||
KickChatMember, PinChatMessage, PromoteChatMember, RestrictChatMember,
|
||||
SendAnimation, SendAudio, SendChatAction, SendContact, SendDocument,
|
||||
SendLocation, SendMediaGroup, SendMessage, SendPhoto, SendPoll,
|
||||
SendVenue, SendVideo, SendVideoNote, SendVoice, SetChatDescription,
|
||||
SetChatStickerSet, StopMessageLiveLocation, UnbanChatMember,
|
||||
UnpinChatMessage,
|
||||
},
|
||||
types::{ChatAction, ChatId, ChatPermissions, InputFile, InputMedia},
|
||||
|
|
|
@ -3,10 +3,9 @@ use tokio::io::AsyncWrite;
|
|||
#[cfg(feature = "unstable-stream")]
|
||||
use ::{bytes::Bytes, tokio::stream::Stream};
|
||||
|
||||
use crate::bot::Bot;
|
||||
#[cfg(feature = "unstable-stream")]
|
||||
use crate::network::download_file_stream;
|
||||
use crate::{network::download_file, DownloadError};
|
||||
use crate::{bot::Bot, network::download_file, DownloadError};
|
||||
|
||||
impl Bot {
|
||||
/// Download file from telegram into `destination`.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
use futures::FutureExt;
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use std::fmt::Debug;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::{fmt::Debug, future::Future, pin::Pin};
|
||||
|
||||
// TODO: shouldn't it be trait?
|
||||
pub enum ErrorPolicy<'a, E> {
|
||||
|
|
|
@ -267,8 +267,10 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::convert::Infallible;
|
||||
use std::sync::atomic::{AtomicI32, Ordering};
|
||||
use std::{
|
||||
convert::Infallible,
|
||||
sync::atomic::{AtomicI32, Ordering},
|
||||
};
|
||||
|
||||
use futures::Stream;
|
||||
|
||||
|
@ -352,8 +354,7 @@ mod tests {
|
|||
|
||||
fn one_message_updater(
|
||||
) -> StreamUpdater<impl Stream<Item = Result<Update, Infallible>>> {
|
||||
use futures::future::ready;
|
||||
use futures::stream;
|
||||
use futures::{future::ready, stream};
|
||||
|
||||
StreamUpdater::new(stream::once(ready(Ok(message_update()))))
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ use futures::{stream, Stream, StreamExt};
|
|||
|
||||
use pin_project::pin_project;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{types::Update, RequestError};
|
||||
use crate::{bot::Bot, types::Update, RequestError};
|
||||
|
||||
// Currently just a placeholder, but I'll add here some methods
|
||||
/// Updater is stream of updates.
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::bot::Bot;
|
||||
use crate::network;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
use crate::types::True;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::True,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
/// Use this method to send answers to callback queries sent from inline
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::True,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ShippingOption, True},
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::bot::Bot;
|
||||
use crate::network;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
use crate::types::{ChatId, True};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
/// Use this method to delete a group sticker set from a supergroup. The bot
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message, ReplyMarkup},
|
||||
|
|
|
@ -2,10 +2,9 @@ use std::path::PathBuf;
|
|||
|
||||
use reqwest::multipart::Form;
|
||||
|
||||
use crate::types::InputFile;
|
||||
use crate::{
|
||||
requests::utils,
|
||||
types::{ChatId, InputMedia, ParseMode},
|
||||
types::{ChatId, InputFile, InputMedia, ParseMode},
|
||||
};
|
||||
|
||||
/// This is a convenient struct that builds `reqwest::multipart::Form`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{Chat, ChatId},
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::bot::Bot;
|
||||
use crate::network;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
use crate::types::{ChatId, ChatMember};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, ChatMember},
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
/// Use this method to get information about a member of a chat. Returns a
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{Chat, ChatId},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::File,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::User,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::Update,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::UserProfilePhotos,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, ChatPermissions, True},
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::network;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup},
|
||||
};
|
||||
|
||||
///Use this method to send animation files (GIF or H.264/MPEG-4 AVC video
|
||||
/// without sound). On success, the sent Message is returned. Bots can currently
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatAction, ChatId, True},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup},
|
||||
|
|
|
@ -2,8 +2,8 @@ use serde::Serialize;
|
|||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network::request_multipart,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
types::{ChatId, InputFile, InputMedia, Message},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message, ParseMode, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{form_builder::FormBuilder, Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, Message, ReplyMarkup},
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::network;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup},
|
||||
};
|
||||
|
||||
///Use this method to send video files, Telegram clients support mp4 videos
|
||||
/// (other formats may be sent as Document). On success, the sent Message is
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup},
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::bot::Bot;
|
||||
use crate::network;
|
||||
use crate::requests::{Request, ResponseResult};
|
||||
use crate::types::{ChatId, True};
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
/// Use this method to set a new group sticker set for a supergroup. The bot
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, InlineKeyboardMarkup, Message},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::ChatId,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::bot::Bot;
|
||||
use crate::{
|
||||
bot::Bot,
|
||||
network,
|
||||
requests::{Request, ResponseResult},
|
||||
types::{ChatId, True},
|
||||
|
|
|
@ -49,9 +49,8 @@ pub enum InlineQueryResult {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::types::inline_keyboard_markup::InlineKeyboardMarkup;
|
||||
use crate::types::parse_mode::ParseMode;
|
||||
use crate::types::{
|
||||
inline_keyboard_markup::InlineKeyboardMarkup, parse_mode::ParseMode,
|
||||
InlineQueryResult, InlineQueryResultCachedAudio, InputMessageContent,
|
||||
};
|
||||
|
||||
|
|
|
@ -190,7 +190,6 @@ pub enum MediaKind {
|
|||
mod getters {
|
||||
use std::ops::Deref;
|
||||
|
||||
use crate::types::message::MessageKind::{Pinned, SupergroupChatCreated};
|
||||
use crate::types::{
|
||||
self,
|
||||
message::{
|
||||
|
@ -203,7 +202,7 @@ mod getters {
|
|||
ChannelChatCreated, Common, ConnectedWebsite, DeleteChatPhoto,
|
||||
GroupChatCreated, Invoice, LeftChatMember, Migrate,
|
||||
NewChatMembers, NewChatPhoto, NewChatTitle, PassportData,
|
||||
SuccessfulPayment,
|
||||
Pinned, SuccessfulPayment, SupergroupChatCreated,
|
||||
},
|
||||
},
|
||||
Chat, ForwardedFrom, Message, MessageEntity, PhotoSize, Sender, True,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use serde::de::{self, Deserialize, Deserializer, Visitor};
|
||||
use serde::ser::{Serialize, Serializer};
|
||||
use serde::{
|
||||
de::{self, Deserialize, Deserializer, Visitor},
|
||||
ser::{Serialize, Serializer},
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
||||
pub struct True;
|
||||
|
|
Loading…
Add table
Reference in a new issue