clean up minor warnings

This commit is contained in:
Kasey White 2022-12-13 22:16:39 -05:00 committed by KtorZ
parent b6962ba9d3
commit 6635a918b5
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 7 additions and 11 deletions

View File

@ -164,11 +164,11 @@ fn fmt_eval(eval_info: &EvalInfo, max_mem: i32, max_cpu: i32) -> String {
output
.as_ref()
.map(|x| format!("{}", x))
.unwrap_or("Error.".to_string()),
.unwrap_or_else(|| "Error.".to_string()),
)
}
fn find_max_execution_units(xs: &Vec<EvalInfo>) -> (i32, i32) {
fn find_max_execution_units(xs: &[EvalInfo]) -> (i32, i32) {
let (max_mem, max_cpu) = xs.iter().fold(
(0, 0),
|(max_mem, max_cpu), EvalInfo { spent_budget, .. }| {

View File

@ -1540,7 +1540,7 @@ impl<'a> CodeGenerator<'a> {
Type::Tuple { .. } => todo!(),
};
if data_type_key.defined_type == "Bool" {
if constructor.tipo.is_bool() {
arg_stack
.push(Term::Constant(UplcConstant::Bool(constr_name == "True")));
} else {

View File

@ -146,10 +146,8 @@ where
self.write_build_outputs(programs, uplc_dump)?;
}
CodeGenMode::Test(match_tests) => {
let tests = self.scripts_gen(&checked_modules, |def| match def {
Definition::Test(..) => true,
_ => false,
})?;
let tests =
self.scripts_gen(&checked_modules, |def| matches!(def, Definition::Test(..)))?;
if !tests.is_empty() {
self.event_listener.handle_event(Event::RunningTests);
}
@ -158,10 +156,8 @@ where
.handle_event(Event::FinishedTests { tests: results });
}
CodeGenMode::Eval(func_name) => {
let scripts = self.scripts_gen(&checked_modules, |def| match def {
Definition::Fn(..) => true,
_ => false,
})?;
let scripts =
self.scripts_gen(&checked_modules, |def| matches!(def, Definition::Fn(..)))?;
let results = self.eval_scripts(scripts, Some(func_name));
self.event_listener
.handle_event(Event::EvaluatingFunction { results });