Simplify `InlineKeyboardButton` construction
@@ -115,13 +115,13 @@ async fn receive_full_name(
) -> HandlerResult {
match msg.text().map(ToOwned::to_owned) {
Some(full_name) => {
- let products = InlineKeyboardMarkup::default().append_row(
- vec!["Apple", "Banana", "Orange", "Potato"].into_iter().map(|product| {
+ let products = ["Apple", "Banana", "Orange", "Potato"].map(|product| {
InlineKeyboardButton::callback(product.to_owned(), product.to_owned())
- }),
- );
+ });
- bot.send_message(msg.chat.id, "Select a product:").reply_markup(products).await?;
+ bot.send_message(msg.chat.id, "Select a product:")
+ .reply_markup(InlineKeyboardMarkup::new([products]))
+ .await?;
dialogue.update(State::ReceiveProductChoice { full_name }).await?;
}
None => {
