Force unwrap_xxx_or inside function body

Otherwise, it becomes the responsibility of the caller to force the result; which may be easily forgotten.
This commit is contained in:
KtorZ
2024-08-01 17:42:20 +02:00
committed by Kasey
parent a132a2e486
commit 021679b8ac
2 changed files with 21 additions and 32 deletions

View File

@@ -932,8 +932,12 @@ pub fn unknown_data_to_type(term: Term<Name>, field_type: &Type) -> Term<Name> {
)
.lambda("__list_data")
.apply(Term::unlist_data().apply(term)),
Some(UplcType::Bool) => Term::unwrap_bool_or(term, |result| result, &Term::Error.delay()),
Some(UplcType::Unit) => Term::unwrap_void_or(term, |result| result, &Term::Error.delay()),
Some(UplcType::Bool) => {
Term::unwrap_bool_or(term, |result| result.delay(), &Term::Error.delay())
}
Some(UplcType::Unit) => {
Term::unwrap_void_or(term, |result| result.delay(), &Term::Error.delay())
}
Some(UplcType::Data) | None => term,
}