Skip to content

Commit

Permalink
Clippy and format to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Mar 5, 2024
1 parent 8adeddc commit 1e1a469
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
12 changes: 9 additions & 3 deletions framework/runner/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<usize>().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::<usize>().ok())
.unwrap_or(1);

Ok((name, count))
}
2 changes: 1 addition & 1 deletion framework/runner/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl<RV: UserValuesConstraint, V: UserValuesConstraint> ScenarioDefinitionBuilde
let unknown_behaviours = requested_behaviours
.difference(&registered_behaviours)
.collect::<Vec<&String>>();
if unknown_behaviours.len() > 0 {
if !unknown_behaviours.is_empty() {
return Err(anyhow::anyhow!(
"Unknown behaviours requested: {:?}",
unknown_behaviours
Expand Down
7 changes: 5 additions & 2 deletions framework/runner/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn run<RV: UserValuesConstraint, V: UserValuesConstraint>(
}

// 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(
Expand Down Expand Up @@ -68,7 +68,10 @@ pub fn run<RV: UserValuesConstraint, V: UserValuesConstraint>(
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
Expand Down
2 changes: 1 addition & 1 deletion framework/runner/src/shutdown.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 1e1a469

Please sign in to comment.