From 21b164a4162cfc1d1422e09c17d494ed57c0be46 Mon Sep 17 00:00:00 2001 From: Akshett Rai Jindal Date: Sat, 24 Aug 2024 13:14:38 +0530 Subject: [PATCH] Change some Option fields to bool in `KeyboardButtonRequestUsers` --- .../types/keyboard_button_request_users.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/teloxide-core/src/types/keyboard_button_request_users.rs b/crates/teloxide-core/src/types/keyboard_button_request_users.rs index ffad3e1f..8c38b831 100644 --- a/crates/teloxide-core/src/types/keyboard_button_request_users.rs +++ b/crates/teloxide-core/src/types/keyboard_button_request_users.rs @@ -32,16 +32,16 @@ pub struct KeyboardButtonRequestUsers { pub max_quantity: u8, /// Pass `true` to request the users' first and last names - #[serde(default, skip_serializing_if = "Option::is_none")] - pub request_name: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub request_name: bool, /// Pass `true` to request the users' username - #[serde(default, skip_serializing_if = "Option::is_none")] - pub request_username: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub request_username: bool, /// Pass `true` to request the users' photos - #[serde(default, skip_serializing_if = "Option::is_none")] - pub request_photo: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub request_photo: bool, } impl KeyboardButtonRequestUsers { @@ -52,9 +52,9 @@ impl KeyboardButtonRequestUsers { user_is_bot: None, user_is_premium: None, max_quantity: 1, - request_name: None, - request_username: None, - request_photo: None, + request_name: false, + request_username: false, + request_photo: false, } } @@ -84,21 +84,21 @@ impl KeyboardButtonRequestUsers { /// Setter for `request_name` field #[must_use] pub fn request_name(mut self) -> Self { - self.request_name = Some(true); + self.request_name = true; self } /// Setter for `request_username` field #[must_use] pub fn request_username(mut self) -> Self { - self.request_username = Some(true); + self.request_username = true; self } /// Setter for `request_photo` field #[must_use] pub fn request_photo(mut self) -> Self { - self.request_photo = Some(true); + self.request_photo = true; self } }