Skip to content

Commit 436e531

Browse files
committed
refactor: tidy up
Signed-off-by: Stevan A <stevana@users.noreply.github.com>
1 parent bca44a6 commit 436e531

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

simulation/amaru-sim/src/simulator/simulate.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ pub fn simulate<Msg, F>(
290290
for test_number in 1..=config.number_of_tests {
291291
let entries: Vec<Reverse<Entry<Msg>>> = generator(&mut rng);
292292

293-
match run_test(config.number_of_nodes, &spawn, &property)(&entries) {
293+
let test = run_test(config.number_of_nodes, &spawn, &property);
294+
match test(&entries) {
294295
(history, Err(reason)) => {
295296
if config.disable_shrinking {
296297
let number_of_shrinks = 0;
@@ -304,11 +305,8 @@ pub fn simulate<Msg, F>(
304305
reason,
305306
);
306307
} else {
307-
let (shrunk_entries, (shrunk_history, result), number_of_shrinks) = shrink(
308-
run_test(config.number_of_nodes, &spawn, &property),
309-
entries,
310-
|result| result.1 == Err(reason.clone()),
311-
);
308+
let (shrunk_entries, (shrunk_history, result), number_of_shrinks) =
309+
shrink(test, entries, |result| result.1 == Err(reason.clone()));
312310
assert_eq!(Err(reason.clone()), result);
313311
display_failure(
314312
test_number,

simulation/amaru-sim/tests/simulation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ fn run_simulator() {
2424
.ok()
2525
.and_then(|v| v.parse::<u8>().ok())
2626
.or(Some(2)),
27-
disable_shrinking: std::env::var("AMARU_DISABLE_SHRINKING").map_or(false, |v| v == "1"),
27+
disable_shrinking: std::env::var("AMARU_DISABLE_SHRINKING").is_ok_and(|v| v == "1"),
2828
seed: std::env::var("AMARU_TEST_SEED")
2929
.ok()
3030
.and_then(|s| s.parse().ok()),
31-
persist_on_success: std::env::var("AMARU_PERSIST_ON_SUCCESS").map_or(false, |v| v == "1"),
31+
persist_on_success: std::env::var("AMARU_PERSIST_ON_SUCCESS").is_ok_and(|v| v == "1"),
3232
};
3333

3434
tracing_subscriber::fmt()

0 commit comments

Comments
 (0)