diff --git a/README.md b/README.md index 9ca09c46..65cbeb87 100644 --- a/README.md +++ b/README.md @@ -160,12 +160,12 @@ async fn answer( bot.send_message(message.chat.id, Command::descriptions().to_string()).await? } Command::Username(username) => { - bot.send_message(message.chat.id, format!("Your username is @{}.", username)).await? + bot.send_message(message.chat.id, format!("Your username is @{username}.")).await? } Command::UsernameAndAge { username, age } => { bot.send_message( message.chat.id, - format!("Your username is @{} and age is {}.", username, age), + format!("Your username is @{username} and age is {age}."), ) .await? } @@ -265,7 +265,7 @@ async fn receive_age( bot: AutoSend, msg: Message, dialogue: MyDialogue, - (full_name,): (String,), // Available from `State::ReceiveAge`. + full_name: String, // Available from `State::ReceiveAge`. ) -> HandlerResult { match msg.text().map(|text| text.parse::()) { Some(Ok(age)) => { @@ -288,7 +288,7 @@ async fn receive_location( ) -> HandlerResult { match msg.text() { Some(location) => { - let message = format!("Full name: {}\nAge: {}\nLocation: {}", full_name, age, location); + let message = format!("Full name: {full_name}\nAge: {age}\nLocation: {location}"); bot.send_message(msg.chat.id, message).await?; dialogue.exit().await?; } diff --git a/examples/buttons.rs b/examples/buttons.rs index 395925da..f68b3b3a 100644 --- a/examples/buttons.rs +++ b/examples/buttons.rs @@ -109,7 +109,7 @@ async fn callback_handler( bot: AutoSend, ) -> Result<(), Box> { if let Some(version) = q.data { - let text = format!("You chose: {}", version); + let text = format!("You chose: {version}"); match q.message { Some(Message { id, chat, .. }) => { diff --git a/examples/db_remember.rs b/examples/db_remember.rs index 055946e0..2aba6dc4 100644 --- a/examples/db_remember.rs +++ b/examples/db_remember.rs @@ -71,7 +71,7 @@ async fn start(bot: AutoSend, msg: Message, dialogue: MyDialogue) -> Handle dialogue.update(State::GotNumber(n)).await?; bot.send_message( msg.chat.id, - format!("Remembered number {}. Now use /get or /reset.", n), + format!("Remembered number {n}. Now use /get or /reset."), ) .await?; } @@ -92,7 +92,7 @@ async fn got_number( ) -> HandlerResult { match cmd { Command::Get => { - bot.send_message(msg.chat.id, format!("Here is your number: {}.", num)).await?; + bot.send_message(msg.chat.id, format!("Here is your number: {num}.")).await?; } Command::Reset => { dialogue.reset().await?; diff --git a/examples/dialogue.rs b/examples/dialogue.rs index 0dd9cc49..f0c46a54 100644 --- a/examples/dialogue.rs +++ b/examples/dialogue.rs @@ -109,7 +109,7 @@ async fn receive_location( ) -> HandlerResult { match msg.text() { Some(location) => { - let message = format!("Full name: {}\nAge: {}\nLocation: {}", full_name, age, location); + let message = format!("Full name: {full_name}\nAge: {age}\nLocation: {location}"); bot.send_message(msg.chat.id, message).await?; dialogue.exit().await?; } diff --git a/examples/dispatching_features.rs b/examples/dispatching_features.rs index 575d8f0b..beda128c 100644 --- a/examples/dispatching_features.rs +++ b/examples/dispatching_features.rs @@ -142,7 +142,7 @@ async fn simple_commands_handler( if msg.from().unwrap().id == cfg.bot_maintainer { "Maintainer is you!".into() } else if let Some(username) = cfg.maintainer_username { - format!("Maintainer is @{}", username) + format!("Maintainer is @{username}") } else { format!("Maintainer ID is {}", cfg.bot_maintainer) } diff --git a/examples/heroku_ping_pong.rs b/examples/heroku_ping_pong.rs index 02db7f1a..197eb579 100644 --- a/examples/heroku_ping_pong.rs +++ b/examples/heroku_ping_pong.rs @@ -66,8 +66,8 @@ pub async fn webhook(bot: AutoSend) -> impl update_listeners::UpdateListene .expect("PORT value to be integer"); // Heroku host example .: "heroku-ping-pong-bot.herokuapp.com" let host = env::var("HOST").expect("have HOST env variable"); - let path = format!("bot{}", teloxide_token); - let url = Url::parse(&format!("https://{}/{}", host, path)).unwrap(); + let path = format!("bot{teloxide_token}"); + let url = Url::parse(&format!("https://{host}/{path}")).unwrap(); bot.set_webhook(url).await.expect("Cannot setup a webhook"); @@ -85,7 +85,7 @@ pub async fn webhook(bot: AutoSend) -> impl update_listeners::UpdateListene let (stop_token, stop_flag) = AsyncStopToken::new_pair(); - let addr = format!("0.0.0.0:{}", port).parse::().unwrap(); + let addr = format!("0.0.0.0:{port}").parse::().unwrap(); let server = warp::serve(server); let (_addr, fut) = server.bind_with_graceful_shutdown(addr, stop_flag); diff --git a/examples/shared_state.rs b/examples/shared_state.rs index 49b6b5f9..cdc65a13 100644 --- a/examples/shared_state.rs +++ b/examples/shared_state.rs @@ -17,7 +17,7 @@ async fn main() { let handler = Update::filter_message().branch(dptree::endpoint( |msg: Message, bot: AutoSend| async move { let previous = MESSAGES_TOTAL.fetch_add(1, Ordering::Relaxed); - bot.send_message(msg.chat.id, format!("I received {} messages in total.", previous)) + bot.send_message(msg.chat.id, format!("I received {previous} messages in total.")) .await?; respond(()) }, diff --git a/examples/simple_commands.rs b/examples/simple_commands.rs index f2ece92c..4734b980 100644 --- a/examples/simple_commands.rs +++ b/examples/simple_commands.rs @@ -33,12 +33,12 @@ async fn answer( bot.send_message(message.chat.id, Command::descriptions().to_string()).await? } Command::Username(username) => { - bot.send_message(message.chat.id, format!("Your username is @{}.", username)).await? + bot.send_message(message.chat.id, format!("Your username is @{username}.")).await? } Command::UsernameAndAge { username, age } => { bot.send_message( message.chat.id, - format!("Your username is @{} and age is {}.", username, age), + format!("Your username is @{username} and age is {age}."), ) .await? }