diff --git a/src-tauri/src/db/history.rs b/src-tauri/src/db/history.rs index 5ee32e6..3b0a4b2 100644 --- a/src-tauri/src/db/history.rs +++ b/src-tauri/src/db/history.rs @@ -1,23 +1,26 @@ use crate::utils::types::{ ContentType, HistoryItem }; use base64::{ engine::general_purpose::STANDARD, Engine }; -use rand::distributions::Alphanumeric; -use rand::{ thread_rng, Rng }; +use rand::{ rng, Rng }; +use rand::distr::Alphanumeric; use sqlx::{ Row, SqlitePool }; use std::fs; use tauri_plugin_aptabase::EventTracker; pub async fn initialize_history(pool: &SqlitePool) -> Result<(), Box> { - let id: String = thread_rng().sample_iter(&Alphanumeric).take(16).map(char::from).collect(); + let id: String = rng() + .sample_iter(&Alphanumeric) + .take(16) + .map(char::from) + .collect(); - sqlx - ::query( - "INSERT INTO history (id, source, content_type, content, timestamp) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)" - ) - .bind(id) - .bind("System") - .bind("text") - .bind("Welcome to your clipboard history!") - .execute(pool).await?; + sqlx::query( + "INSERT INTO history (id, source, content_type, content, timestamp) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)" + ) + .bind(id) + .bind("System") + .bind("text") + .bind("Welcome to your clipboard history!") + .execute(pool).await?; Ok(()) }