diff --git a/crates/aiken-lang/src/ast/well_known.rs b/crates/aiken-lang/src/ast/well_known.rs index 58a4ebe69..c0990d2dc 100644 --- a/crates/aiken-lang/src/ast/well_known.rs +++ b/crates/aiken-lang/src/ast/well_known.rs @@ -260,7 +260,7 @@ impl Type { .into(), } .into(), - } + }, } .into(), ), diff --git a/crates/aiken-lang/src/builtins.rs b/crates/aiken-lang/src/builtins.rs index a88870405..ae636d657 100644 --- a/crates/aiken-lang/src/builtins.rs +++ b/crates/aiken-lang/src/builtins.rs @@ -506,7 +506,7 @@ pub fn prelude(id_gen: &IdGenerator) -> TypeInfo { tipo: Type::sampler(sampler_generic), module: "".to_string(), public: true, - } + }, ); prelude diff --git a/crates/aiken-lang/src/test_framework.rs b/crates/aiken-lang/src/test_framework.rs index 77d1bdf0b..668a61d9c 100644 --- a/crates/aiken-lang/src/test_framework.rs +++ b/crates/aiken-lang/src/test_framework.rs @@ -49,7 +49,7 @@ use vec1::{vec1, Vec1}; pub enum Test { UnitTest(UnitTest), PropertyTest(PropertyTest), - Benchmark(Benchmark) + Benchmark(Benchmark), } unsafe impl Send for Test {} @@ -383,9 +383,7 @@ impl PropertyTest { value, choices: next_prng.choices(), cache: Cache::new(move |choices| { - match Prng::from_choices(choices) - .sample(&self.fuzzer.program) - { + match Prng::from_choices(choices).sample(&self.fuzzer.program) { Err(..) => Status::Invalid, Ok(None) => Status::Invalid, Ok(Some((_, value))) => { @@ -468,7 +466,10 @@ impl Benchmark { let mut prng = Prng::from_seed(seed); while n > iteration { - let fuzzer = self.sampler.program.apply_data(Data::integer(num_bigint::BigInt::from(iteration as i64))); + let fuzzer = self + .sampler + .program + .apply_data(Data::integer(num_bigint::BigInt::from(iteration as i64))); match prng.sample(&fuzzer) { Ok(Some((new_prng, value))) => { prng = new_prng; @@ -529,14 +530,8 @@ impl Benchmark { /// #[derive(Debug)] pub enum Prng { - Seeded { - choices: Vec, - uplc: PlutusData, - }, - Replayed { - choices: Vec, - uplc: PlutusData, - }, + Seeded { choices: Vec, uplc: PlutusData }, + Replayed { choices: Vec, uplc: PlutusData }, } impl Prng { @@ -607,9 +602,7 @@ impl Prng { fuzzer: &Program, // iteration: usize, ) -> Result, FuzzerError> { - let program = Program::::try_from( - fuzzer - .apply_data(self.uplc())).unwrap(); + let program = Program::::try_from(fuzzer.apply_data(self.uplc())).unwrap(); let mut result = program.eval(ExBudget::max()); result .result() @@ -630,9 +623,7 @@ impl Prng { /// made during shrinking aren't breaking underlying invariants (if only, because we run out of /// values to replay). In such case, the replayed sequence is simply invalid and the fuzzer /// aborted altogether with 'None'. - pub fn from_result( - result: Term, - ) -> Option<(Self, PlutusData)> { + pub fn from_result(result: Term) -> Option<(Self, PlutusData)> { /// Interpret the given 'PlutusData' as one of two Prng constructors. fn as_prng(cst: &PlutusData) -> Prng { if let PlutusData::Constr(Constr { tag, fields, .. }) = cst { diff --git a/crates/aiken-lang/src/tipo/infer.rs b/crates/aiken-lang/src/tipo/infer.rs index adc2e37ea..d901e1362 100644 --- a/crates/aiken-lang/src/tipo/infer.rs +++ b/crates/aiken-lang/src/tipo/infer.rs @@ -365,7 +365,7 @@ fn infer_definition( &arg.via.location(), ) { Ok(result) => Ok(result), - Err(err) => Err(err) + Err(err) => Err(err), }?; // Ensure that the annotation, if any, matches the type inferred from the @@ -501,7 +501,7 @@ fn infer_definition( &arg.via.location(), ) { Ok(result) => Ok(result), - Err(err) => Err(err) + Err(err) => Err(err), }?; // Ensure that the annotation, if any, matches the type inferred from the @@ -930,11 +930,13 @@ fn infer_sampler( ret, args, alias: _, - } => if args.len() == 1 && args[0].is_int() { - infer_fuzzer(environment, expected_inner_type, ret, &Span::empty()) - } else { - Err(could_not_unify()) - }, + } => { + if args.len() == 1 && args[0].is_int() { + infer_fuzzer(environment, expected_inner_type, ret, &Span::empty()) + } else { + Err(could_not_unify()) + } + } Type::Var { tipo, alias } => match &*tipo.deref().borrow() { TypeVar::Link { tipo } => infer_sampler( diff --git a/crates/aiken-project/src/lib.rs b/crates/aiken-project/src/lib.rs index 204e7509a..5a3dc2d30 100644 --- a/crates/aiken-project/src/lib.rs +++ b/crates/aiken-project/src/lib.rs @@ -474,7 +474,8 @@ where output, } => { // todo - collect benchmarks - let tests = self.collect_benchmarks(false, match_tests, exact_match, options.tracing)?; + let tests = + self.collect_benchmarks(false, match_tests, exact_match, options.tracing)?; if !tests.is_empty() { self.event_listener.handle_event(Event::RunningBenchmarks); @@ -1215,7 +1216,7 @@ where Test::PropertyTest(property_test) => { property_test.run(seed, property_max_success, plutus_version) } - Test::Benchmark(_) => unreachable!("Benchmarks cannot be run in PBT.") + Test::Benchmark(_) => unreachable!("Benchmarks cannot be run in PBT."), }) .collect::), PlutusData>>>() .into_iter() @@ -1237,7 +1238,9 @@ where tests .into_par_iter() .flat_map(|test| match test { - Test::UnitTest(_) | Test::PropertyTest(_) => unreachable!("Tests cannot be ran during benchmarking."), + Test::UnitTest(_) | Test::PropertyTest(_) => { + unreachable!("Tests cannot be ran during benchmarking.") + } Test::Benchmark(benchmark) => benchmark .benchmark(seed, property_max_success, plutus_version) .into_iter()