chore: refactor deprecated fn call

This commit is contained in:
counterweight 2025-07-25 10:01:23 +02:00
parent e5d9eca47f
commit bc02946bd5
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -3,7 +3,7 @@ use fake::Fake;
use rand::seq::IndexedRandom; use rand::seq::IndexedRandom;
use sqlx::PgPool; use sqlx::PgPool;
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
use rand::thread_rng; use rand::rng;
pub async fn generate_data(pool: &PgPool) -> Result<(), sqlx::Error> { pub async fn generate_data(pool: &PgPool) -> Result<(), sqlx::Error> {
let pizza_types = vec!["Margherita", "Pepperoni", "Hawaiian", "Veggie", "BBQ Chicken"]; let pizza_types = vec!["Margherita", "Pepperoni", "Hawaiian", "Veggie", "BBQ Chicken"];
@ -31,7 +31,7 @@ pub async fn generate_data(pool: &PgPool) -> Result<(), sqlx::Error> {
.await?; .await?;
if let Some((customer_id,)) = customer_opt { if let Some((customer_id,)) = customer_opt {
let mut rng = thread_rng(); let mut rng = rng();
if let Some(pizza_type) = pizza_types.choose(&mut rng) { if let Some(pizza_type) = pizza_types.choose(&mut rng) {
let quantity = 1; let quantity = 1;