Merge pull request #981 from Zagzuz/must-use-adaptors

Add `#[must_use]` to bot adaptors
This commit is contained in:
Waffle Maybe 2023-12-08 20:03:54 +00:00 committed by GitHub
commit 23f2e829e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ use crate::adaptors::throttle::{Limits, Throttle};
pub trait RequesterExt: Requester { pub trait RequesterExt: Requester {
/// Add `get_me` caching ability, see [`CacheMe`] for more. /// Add `get_me` caching ability, see [`CacheMe`] for more.
#[cfg(feature = "cache_me")] #[cfg(feature = "cache_me")]
#[must_use]
fn cache_me(self) -> CacheMe<Self> fn cache_me(self) -> CacheMe<Self>
where where
Self: Sized, Self: Sized,
@ -29,6 +30,7 @@ pub trait RequesterExt: Requester {
/// Send requests automatically, see [`AutoSend`] for more. /// Send requests automatically, see [`AutoSend`] for more.
#[cfg(feature = "auto_send")] #[cfg(feature = "auto_send")]
#[must_use]
#[deprecated( #[deprecated(
since = "0.8.0", since = "0.8.0",
note = "`AutoSend` is no longer required to `.await` requests and is now noop" note = "`AutoSend` is no longer required to `.await` requests and is now noop"
@ -43,6 +45,7 @@ pub trait RequesterExt: Requester {
/// Erase requester type. /// Erase requester type.
#[cfg(feature = "erased")] #[cfg(feature = "erased")]
#[must_use]
fn erase<'a>(self) -> ErasedRequester<'a, Self::Err> fn erase<'a>(self) -> ErasedRequester<'a, Self::Err>
where where
Self: 'a, Self: 'a,
@ -53,6 +56,7 @@ pub trait RequesterExt: Requester {
/// Trace requests, see [`Trace`] for more. /// Trace requests, see [`Trace`] for more.
#[cfg(feature = "trace_adaptor")] #[cfg(feature = "trace_adaptor")]
#[must_use]
fn trace(self, settings: Settings) -> Trace<Self> fn trace(self, settings: Settings) -> Trace<Self>
where where
Self: Sized, Self: Sized,
@ -64,6 +68,7 @@ pub trait RequesterExt: Requester {
/// ///
/// Note: this spawns the worker, just as [`Throttle::new_spawn`]. /// Note: this spawns the worker, just as [`Throttle::new_spawn`].
#[cfg(feature = "throttle")] #[cfg(feature = "throttle")]
#[must_use]
fn throttle(self, limits: Limits) -> Throttle<Self> fn throttle(self, limits: Limits) -> Throttle<Self>
where where
Self: Sized + Clone + Send + Sync + 'static, Self: Sized + Clone + Send + Sync + 'static,
@ -101,6 +106,7 @@ pub trait RequesterExt: Requester {
/// crate::requests::Requester::edit_message_caption /// crate::requests::Requester::edit_message_caption
/// [`edit_message_caption_inline`]: /// [`edit_message_caption_inline`]:
/// crate::requests::Requester::edit_message_caption_inline /// crate::requests::Requester::edit_message_caption_inline
#[must_use]
fn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self> fn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self>
where where
Self: Sized, Self: Sized,