Added inline to the functions that can be considered utilities
This commit is contained in:
parent
02d090dd6a
commit
a271b72038
@ -21,6 +21,7 @@ fn filter(q: CallbackQuery) -> bool {
|
||||
}
|
||||
|
||||
/// Gets a handler for deleting the message
|
||||
#[inline]
|
||||
pub fn get_handler() -> Handler<'static, DependencyMap, crate::Result<()>, DpHandlerDescription> {
|
||||
dptree::filter(filter).endpoint(run)
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ fn check_generated_password(password: &[u8]) -> bool {
|
||||
}
|
||||
|
||||
/// Continuously generates the password until it passes the checks
|
||||
#[inline]
|
||||
fn generete_passwords() -> ArrayVec<ArrayString<34>, 10> {
|
||||
let mut passwords = ArrayVec::new_const();
|
||||
while !passwords.is_full() {
|
||||
|
@ -37,6 +37,7 @@ async fn notify_about_no_master_pass(
|
||||
}
|
||||
|
||||
/// Gets a handler that filters out the messages of users that don't have a master password set
|
||||
#[inline]
|
||||
pub fn get_handler() -> Handler<'static, DependencyMap, crate::Result<()>, DpHandlerDescription> {
|
||||
dptree::filter_map_async(master_pass_exists).endpoint(notify_about_no_master_pass)
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use sea_orm::prelude::*;
|
||||
use teloxide::{adaptors::Throttle, prelude::*};
|
||||
|
||||
/// A generic state handler. It checks for "/cancel" messages and runs the provided validation function
|
||||
#[inline]
|
||||
pub async fn generic<F>(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -23,6 +23,7 @@ where
|
||||
}
|
||||
|
||||
/// Deletes the message ignoring the errors
|
||||
#[inline]
|
||||
pub async fn delete_message(bot: Throttle<Bot>, msg: Message) {
|
||||
let _ = bot.delete_message(msg.chat.id, msg.id).await;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user