From 66e7a4edecade4eb6f5970256ed5debeaf71af49 Mon Sep 17 00:00:00 2001 From: alpaylan Date: Tue, 17 Dec 2024 18:30:55 -0500 Subject: [PATCH] fix formatting --- simulator/generation.rs | 7 +++++-- simulator/generation/plan.rs | 4 +++- simulator/main.rs | 9 +++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/simulator/generation.rs b/simulator/generation.rs index 26f42f6d6..15b5845ec 100644 --- a/simulator/generation.rs +++ b/simulator/generation.rs @@ -1,8 +1,8 @@ use anarchist_readable_name_generator_lib::readable_name_custom; use rand::Rng; -pub mod query; pub mod plan; +pub mod query; pub mod table; pub trait Arbitrary { @@ -13,7 +13,10 @@ pub trait ArbitraryFrom { fn arbitrary_from(rng: &mut R, t: &T) -> Self; } -pub(crate) fn frequency<'a, T, R: rand::Rng>(choices: Vec<(usize, Box T + 'a>)>, rng: &mut R) -> T { +pub(crate) fn frequency<'a, T, R: rand::Rng>( + choices: Vec<(usize, Box T + 'a>)>, + rng: &mut R, +) -> T { let total = choices.iter().map(|(weight, _)| weight).sum::(); let mut choice = rng.gen_range(0..total); diff --git a/simulator/generation/plan.rs b/simulator/generation/plan.rs index 6e5e6d951..d7c309b93 100644 --- a/simulator/generation/plan.rs +++ b/simulator/generation/plan.rs @@ -28,7 +28,9 @@ impl Display for InteractionPlan { for interaction in &self.plan { match interaction { Interaction::Query(query) => write!(f, "{};\n", query)?, - Interaction::Assertion(assertion) => write!(f, "-- ASSERT: {};\n", assertion.message)?, + Interaction::Assertion(assertion) => { + write!(f, "-- ASSERT: {};\n", assertion.message)? + } } } diff --git a/simulator/main.rs b/simulator/main.rs index c7ddc9bce..0f745e7e8 100644 --- a/simulator/main.rs +++ b/simulator/main.rs @@ -146,15 +146,16 @@ fn main() { env.connections[connection_index] = SimConnection::Connected(env.db.connect()); } } - - } - env.io.print_stats(); } -fn process_connection(conn: &mut Rc, interaction: &Interaction, stack: &mut Vec) -> Result<()> { +fn process_connection( + conn: &mut Rc, + interaction: &Interaction, + stack: &mut Vec, +) -> Result<()> { match interaction { generation::plan::Interaction::Query(_) => { log::debug!("{}", interaction);