Make more functions #[must_use]

This commit is contained in:
Hirrolot 2022-11-17 14:54:40 +06:00
parent 7cd36d9c40
commit 762ab2f5e3
5 changed files with 12 additions and 0 deletions

View file

@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `StatefulListener::new_with_hints`
- `CommandDescriptions::new`
- `respond`
- The following functions were made `#[must_use]`:
- `DispatcherBuilder::{enable_ctrlc_handler, distribution_function}`
## 0.11.1 - 2022-10-31

View file

@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The methods `ChatMember::{can_pin_messages, can_invite_users, can_change_info}` now take into account the permissions of `Restricted` chat member kind ([#764][pr764])
- The method `ChatMemberKind::is_present` now takes into account the value of `Restricted::is_member` field ([#764][pr764])
- The following functions were made `#[must_use]`:
- `MaskPoint::{new, point}`
- `StickerKind::{premium_animation, mask_position, custom_emoji_id}`
### Added

View file

@ -35,10 +35,12 @@ pub enum MaskPoint {
}
impl MaskPosition {
#[must_use]
pub const fn new(point: MaskPoint, x_shift: f64, y_shift: f64, scale: f64) -> Self {
Self { point, x_shift, y_shift, scale }
}
#[must_use]
pub const fn point(mut self, val: MaskPoint) -> Self {
self.point = val;
self

View file

@ -200,6 +200,7 @@ impl StickerKind {
}
/// Getter for [`StickerKind::Regular::premium_animation`].
#[must_use]
pub fn premium_animation(&self) -> Option<&FileMeta> {
if let Self::Regular { premium_animation } = self {
premium_animation.as_ref()
@ -209,6 +210,7 @@ impl StickerKind {
}
/// Getter for [`StickerKind::Mask::mask_position`].
#[must_use]
pub fn mask_position(&self) -> Option<MaskPosition> {
if let Self::Mask { mask_position } = self {
Some(*mask_position)
@ -218,6 +220,7 @@ impl StickerKind {
}
/// Getter for [`StickerKind::CustomEmoji::custom_emoji_id`].
#[must_use]
pub fn custom_emoji_id(&self) -> Option<&str> {
if let Self::CustomEmoji { custom_emoji_id } = self {
Some(custom_emoji_id)

View file

@ -86,6 +86,7 @@ where
///
/// [`shutdown`]: ShutdownToken::shutdown
#[cfg(feature = "ctrlc_handler")]
#[must_use]
pub fn enable_ctrlc_handler(self) -> Self {
Self { ctrlc_handler: true, ..self }
}
@ -100,6 +101,7 @@ where
/// Specifies the distribution function that decides how updates are grouped
/// before execution.
#[must_use]
pub fn distribution_function<K>(
self,
f: fn(&Update) -> Option<K>,