diff --git a/framework/runner/src/cli.rs b/framework/runner/src/cli.rs index f1839429..1437d196 100644 --- a/framework/runner/src/cli.rs +++ b/framework/runner/src/cli.rs @@ -43,9 +43,15 @@ pub struct WindTunnelScenarioCli { fn parse_agent_behaviour(s: &str) -> anyhow::Result<(String, usize)> { let mut parts = s.split(':'); - let name = parts.next().map(|s| s.to_string()).ok_or(anyhow::anyhow!("No name specified for behaviour"))?; - - let count = parts.next().and_then(|s| s.parse::().ok()).unwrap_or(1); + let name = parts + .next() + .map(|s| s.to_string()) + .ok_or(anyhow::anyhow!("No name specified for behaviour"))?; + + let count = parts + .next() + .and_then(|s| s.parse::().ok()) + .unwrap_or(1); Ok((name, count)) } diff --git a/framework/runner/src/definition.rs b/framework/runner/src/definition.rs index f53c79a3..f0619181 100644 --- a/framework/runner/src/definition.rs +++ b/framework/runner/src/definition.rs @@ -192,7 +192,7 @@ impl ScenarioDefinitionBuilde let unknown_behaviours = requested_behaviours .difference(®istered_behaviours) .collect::>(); - if unknown_behaviours.len() > 0 { + if !unknown_behaviours.is_empty() { return Err(anyhow::anyhow!( "Unknown behaviours requested: {:?}", unknown_behaviours diff --git a/framework/runner/src/run.rs b/framework/runner/src/run.rs index 6560baa3..23b23737 100644 --- a/framework/runner/src/run.rs +++ b/framework/runner/src/run.rs @@ -36,7 +36,7 @@ pub fn run( } // After the setup has run, and if this is a time bounded scenario, then we need to take additional actions - if let Some(duration) = definition.duration_s.clone() { + if let Some(duration) = definition.duration_s { if !definition.no_progress { // If the scenario is time bounded then start the progress monitor to show the user how long is left start_progress( @@ -68,7 +68,10 @@ pub fn run( let runner_context = runner_context.clone(); let setup_agent_fn = definition.setup_agent_fn; - let agent_behaviour_fn = definition.agent_behaviour.get(&assigned_behaviours[agent_index]).cloned(); + let agent_behaviour_fn = definition + .agent_behaviour + .get(&assigned_behaviours[agent_index]) + .cloned(); let teardown_agent_fn = definition.teardown_agent_fn; // For us to check if the agent should shut down between behaviour cycles diff --git a/framework/runner/src/shutdown.rs b/framework/runner/src/shutdown.rs index 25eb8bd5..924cf128 100644 --- a/framework/runner/src/shutdown.rs +++ b/framework/runner/src/shutdown.rs @@ -1,10 +1,10 @@ use std::{borrow::BorrowMut, sync::Arc}; +use tokio::sync::Mutex; use tokio::{ signal, sync::broadcast::{Receiver, Sender}, }; -use tokio::sync::Mutex; #[derive(Debug, Clone)] pub(crate) struct ShutdownHandle {