From 673269602da91fa805efcb8be97df1a4b321a3d4 Mon Sep 17 00:00:00 2001 From: p0lunin Date: Sat, 22 Feb 2020 23:02:31 +0200 Subject: [PATCH] fmt --- src/utils/command.rs | 8 +++----- teloxide-macros/src/lib.rs | 9 ++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/utils/command.rs b/src/utils/command.rs index 37bf1af2..6f2d9821 100644 --- a/src/utils/command.rs +++ b/src/utils/command.rs @@ -15,7 +15,8 @@ //! Ban, //! } //! -//! let (command, args) = AdminCommand::parse("/ban 3 hours", "bot_name").unwrap(); +//! let (command, args) = +//! AdminCommand::parse("/ban 3 hours", "bot_name").unwrap(); //! assert_eq!(command, AdminCommand::Ban); //! assert_eq!(args, vec!["3", "hours"]); //! ``` @@ -207,10 +208,7 @@ mod tests { DefaultCommands::Start, DefaultCommands::parse("!start", "").unwrap().0 ); - assert_eq!( - DefaultCommands::descriptions(), - "!start - desc\n/help\n" - ); + assert_eq!(DefaultCommands::descriptions(), "!start - desc\n/help\n"); } #[test] diff --git a/teloxide-macros/src/lib.rs b/teloxide-macros/src/lib.rs index 3a977411..1c2f6c62 100644 --- a/teloxide-macros/src/lib.rs +++ b/teloxide-macros/src/lib.rs @@ -82,9 +82,12 @@ pub fn derive_telegram_command_enum(tokens: TokenStream) -> TokenStream { .zip(variant_name) .map(|(prefix, command)| prefix.to_string() + command.as_str()); let variant_str2 = variant_str1.clone(); - let variant_description = variant_infos - .iter() - .map(|info| info.description.as_deref().map(|e| format!(" - {}", e)).unwrap_or(String::new())); + let variant_description = variant_infos.iter().map(|info| { + info.description + .as_deref() + .map(|e| format!(" - {}", e)) + .unwrap_or(String::new()) + }); let ident = &input.ident;