diff --git a/src/callbacks/alter.rs b/src/callbacks/alter.rs index 1fe4272..6180a43 100644 --- a/src/callbacks/alter.rs +++ b/src/callbacks/alter.rs @@ -76,6 +76,7 @@ async fn get_master_pass( handler!(get_field(name:String, field:AlterableField, field_value:String), "Send the master password", State::GetMasterPass, get_master_pass); +#[inline] pub async fn alter( bot: Throttle, q: CallbackQuery, diff --git a/src/callbacks/decrypt.rs b/src/callbacks/decrypt.rs index 5ae0cdf..b5cc5d5 100644 --- a/src/callbacks/decrypt.rs +++ b/src/callbacks/decrypt.rs @@ -39,6 +39,7 @@ async fn get_master_pass( Ok(()) } +#[inline] pub async fn decrypt( bot: Throttle, q: CallbackQuery, diff --git a/src/callbacks/delete.rs b/src/callbacks/delete.rs index 9b1d160..dc6ef19 100644 --- a/src/callbacks/delete.rs +++ b/src/callbacks/delete.rs @@ -26,6 +26,7 @@ async fn get_master_pass( Ok(()) } +#[inline] pub async fn delete( bot: Throttle, q: CallbackQuery, diff --git a/src/callbacks/delete_message.rs b/src/callbacks/delete_message.rs index cbfd235..771b343 100644 --- a/src/callbacks/delete_message.rs +++ b/src/callbacks/delete_message.rs @@ -1,6 +1,7 @@ use crate::prelude::*; /// Deletes the message from the callback +#[inline] pub async fn delete_message(bot: Throttle, q: CallbackQuery) -> crate::Result<()> { if let Some(msg) = q.message { if bot.delete_message(msg.chat.id, msg.id).await.is_err() { diff --git a/src/callbacks/get.rs b/src/callbacks/get.rs index ccba97d..b3f91ea 100644 --- a/src/callbacks/get.rs +++ b/src/callbacks/get.rs @@ -1,6 +1,7 @@ use crate::prelude::*; use teloxide::types::ParseMode; +#[inline] pub async fn get( bot: Throttle, q: CallbackQuery, diff --git a/src/callbacks/get_menu.rs b/src/callbacks/get_menu.rs index 6c74297..c57d14e 100644 --- a/src/callbacks/get_menu.rs +++ b/src/callbacks/get_menu.rs @@ -1,5 +1,6 @@ use crate::prelude::*; +#[inline] pub async fn get_menu( bot: Throttle, q: CallbackQuery, diff --git a/src/commands/add_account.rs b/src/commands/add_account.rs index d258ad5..29ffa5d 100644 --- a/src/commands/add_account.rs +++ b/src/commands/add_account.rs @@ -3,6 +3,7 @@ use tokio::task::spawn_blocking; /// Gets the name of the master password, encryptes the account and adds it to the DB #[allow(clippy::too_many_arguments)] +#[inline] async fn get_master_pass( bot: Throttle, msg: Message, diff --git a/src/commands/cancel.rs b/src/commands/cancel.rs index 40afe72..c42a988 100644 --- a/src/commands/cancel.rs +++ b/src/commands/cancel.rs @@ -1,6 +1,7 @@ use crate::prelude::*; /// Handles /cancel command when there's no active state +#[inline] pub async fn cancel(bot: Throttle, msg: Message) -> crate::Result<()> { bot.send_message(msg.chat.id, "Nothing to cancel") .reply_markup(deletion_markup()) diff --git a/src/commands/delete.rs b/src/commands/delete.rs index 2c80c36..49cf0a2 100644 --- a/src/commands/delete.rs +++ b/src/commands/delete.rs @@ -1,5 +1,6 @@ use crate::prelude::*; +#[inline] pub async fn delete(bot: Throttle, msg: Message, db: DatabaseConnection) -> crate::Result<()> { let user_id = msg.from().ok_or(NoUserInfo)?.id.0; diff --git a/src/commands/delete_all.rs b/src/commands/delete_all.rs index 3ec159a..493003e 100644 --- a/src/commands/delete_all.rs +++ b/src/commands/delete_all.rs @@ -5,6 +5,7 @@ use tokio::try_join; /// Gets the master password, deletes the accounts and the master password from DB. /// Although it doesn't use the master password, we get it to be sure that it's the user who used that command +#[inline] async fn get_master_pass( bot: Throttle, msg: Message, diff --git a/src/commands/export.rs b/src/commands/export.rs index 1adb39d..49c8c1b 100644 --- a/src/commands/export.rs +++ b/src/commands/export.rs @@ -18,6 +18,7 @@ async fn decrypt_account( } /// Gets the master password, decryptes the account and sends the json file to the user +#[inline] async fn get_master_pass( bot: Throttle, msg: Message, diff --git a/src/commands/gen_password.rs b/src/commands/gen_password.rs index 4cb75e8..c045268 100644 --- a/src/commands/gen_password.rs +++ b/src/commands/gen_password.rs @@ -14,6 +14,7 @@ const BUFFER_LENGTH: usize = MESSAGE_HEADER.len() + (PASSWORD_LENGTH + PASSWORD_PADDING_LENGTH) * AMOUNT_OF_PASSWORDS; /// Handles /gen_password command by generating 10 copyable passwords and sending them to the user +#[inline] pub async fn gen_password(bot: Throttle, msg: Message) -> crate::Result<()> { let mut message: ArrayString = MESSAGE_HEADER.try_into().unwrap(); let passwords: PasswordArray = spawn_blocking(generate_passwords).await?; diff --git a/src/commands/get_account.rs b/src/commands/get_account.rs index aef0be9..1071d94 100644 --- a/src/commands/get_account.rs +++ b/src/commands/get_account.rs @@ -1,5 +1,6 @@ use crate::prelude::*; +#[inline] pub async fn get_account( bot: Throttle, msg: Message, diff --git a/src/commands/get_accounts.rs b/src/commands/get_accounts.rs index 673395f..ed899be 100644 --- a/src/commands/get_accounts.rs +++ b/src/commands/get_accounts.rs @@ -4,6 +4,7 @@ use std::fmt::Write; use teloxide::types::ParseMode; /// Handles /get_accounts command by sending the list of copyable account names to the user +#[inline] pub async fn get_accounts( bot: Throttle, msg: Message, diff --git a/src/commands/help.rs b/src/commands/help.rs index 895ff21..539e1bd 100644 --- a/src/commands/help.rs +++ b/src/commands/help.rs @@ -2,6 +2,7 @@ use crate::prelude::*; use teloxide::utils::command::BotCommands; /// Handles the help command by sending the passwords descryptions +#[inline] pub async fn help(bot: Throttle, msg: Message) -> crate::Result<()> { bot.send_message(msg.chat.id, Command::descriptions().to_string()) .reply_markup(deletion_markup()) diff --git a/src/commands/import.rs b/src/commands/import.rs index d55f2ec..b57288b 100644 --- a/src/commands/import.rs +++ b/src/commands/import.rs @@ -26,6 +26,7 @@ async fn encrypt_account( } /// Gets the master password, encryptes and adds the accounts to the DB +#[inline] async fn get_master_pass( bot: Throttle, msg: Message, diff --git a/src/commands/menu.rs b/src/commands/menu.rs index da10904..82e3113 100644 --- a/src/commands/menu.rs +++ b/src/commands/menu.rs @@ -1,6 +1,7 @@ use crate::prelude::*; use tokio::task::spawn_blocking; +#[inline] pub async fn menu(bot: Throttle, msg: Message, db: DatabaseConnection) -> crate::Result<()> { let user_id = msg.from().ok_or(NoUserInfo)?.id.0; diff --git a/src/commands/set_master_pass.rs b/src/commands/set_master_pass.rs index d344f73..d8150ab 100644 --- a/src/commands/set_master_pass.rs +++ b/src/commands/set_master_pass.rs @@ -3,6 +3,7 @@ use cryptography::hashing::HashedBytes; use sea_orm::ActiveValue::Set; use tokio::task::spawn_blocking; +#[inline] async fn get_master_pass2( bot: Throttle, msg: Message, @@ -66,6 +67,7 @@ async fn get_master_pass( } /// Handles /set_master_pass command +#[inline] pub async fn set_master_pass( bot: Throttle, msg: Message, diff --git a/src/commands/start.rs b/src/commands/start.rs index eb3fe02..ca46a47 100644 --- a/src/commands/start.rs +++ b/src/commands/start.rs @@ -1,6 +1,7 @@ use crate::prelude::*; /// Handles /start command by sending the greeting message +#[inline] pub async fn start(bot: Throttle, msg: Message) -> crate::Result<()> { bot.send_message( msg.chat.id, diff --git a/src/default.rs b/src/default.rs index 8d7d1cf..07cfa0e 100644 --- a/src/default.rs +++ b/src/default.rs @@ -1,6 +1,7 @@ use crate::prelude::*; /// Handles the messages which weren't matched by any commands or states +#[inline] pub async fn default(bot: Throttle, msg: Message) -> crate::Result<()> { bot.send_message( msg.chat.id, diff --git a/src/master_password_check.rs b/src/master_password_check.rs index eeba778..e9db77b 100644 --- a/src/master_password_check.rs +++ b/src/master_password_check.rs @@ -8,6 +8,7 @@ use teloxide::{dispatching::DpHandlerDescription, dptree::Handler}; /// /// Returns None if account exists, Some(None) if there's an account and Some(Some(String)) if an error occures. /// The String represents the error that occured +#[inline] async fn master_pass_exists( msg: Message, db: DatabaseConnection, @@ -23,6 +24,7 @@ async fn master_pass_exists( } } +#[inline] async fn notify_about_no_master_pass( bot: Throttle, result: Option>,