From fba2bb0b860b1ae989ab90546bd6d80ddaaab4b5 Mon Sep 17 00:00:00 2001 From: StNicolay Date: Sun, 11 Jun 2023 15:58:41 +0300 Subject: [PATCH] Minor cleanup --- src/commands/export.rs | 7 ++----- src/models.rs | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/commands/export.rs b/src/commands/export.rs index c5dad72..bb23345 100644 --- a/src/commands/export.rs +++ b/src/commands/export.rs @@ -8,7 +8,6 @@ use entity::prelude::*; use futures::TryStreamExt; use parking_lot::Mutex; use sea_orm::DatabaseConnection; -use serde_json::to_vec_pretty; use std::sync::Arc; use teloxide::{adaptors::Throttle, prelude::*, types::InputFile}; use tokio::task::spawn_blocking; @@ -52,7 +51,7 @@ async fn get_master_pass( accounts.sort_unstable_by(|this, other| this.name.cmp(&other.name)); - let json = to_vec_pretty(&User { accounts })?; + let json = serde_json::to_vec_pretty(&User { accounts })?; let file = InputFile::memory(json).file_name("accounts.json"); bot.send_document(msg.chat.id, file) @@ -69,9 +68,7 @@ pub async fn export(bot: Throttle, msg: Message, dialogue: MainDialogue) -> .await?; dialogue .update(State::GetMasterPass(Handler::new( - move |bot, msg, db, dialogue, master_pass| { - get_master_pass(bot, msg, db, dialogue, master_pass) - }, + get_master_pass, previous, ))) .await?; diff --git a/src/models.rs b/src/models.rs index 0940c66..f5739de 100644 --- a/src/models.rs +++ b/src/models.rs @@ -52,6 +52,7 @@ impl DecryptedAccount { } #[derive(Serialize, Deserialize)] +#[repr(transparent)] pub struct User { pub accounts: Vec, }