feat: on fmt if label and name are the same only print one

This commit is contained in:
rvcas 2022-12-21 19:12:19 -05:00 committed by Lucas
parent 4c4e454ea3
commit 7867793bcd
2 changed files with 10 additions and 5 deletions

View File

@ -1585,10 +1585,14 @@ impl<'a> Documentable<'a> for &'a ArgName {
ArgName::Named { name, .. } | ArgName::Discard { name, .. } => name.to_doc(), ArgName::Named { name, .. } | ArgName::Discard { name, .. } => name.to_doc(),
ArgName::LabeledDiscard { label, name, .. } ArgName::LabeledDiscard { label, name, .. }
| ArgName::NamedLabeled { label, name, .. } => { | ArgName::NamedLabeled { label, name, .. } => {
if label == name {
name.to_doc()
} else {
docvec![label, " ", name] docvec![label, " ", name]
} }
} }
} }
}
} }
fn pub_(public: bool) -> Document<'static> { fn pub_(public: bool) -> Document<'static> {

View File

@ -14,6 +14,7 @@ pub type Redeemer {
pub fn spend(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool { pub fn spend(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool {
let must_say_hello = string.from_bytearray(redeemer.msg) == "Hello, World!" let must_say_hello = string.from_bytearray(redeemer.msg) == "Hello, World!"
let must_be_signed = let must_be_signed =
context.transaction.extra_signatories context.transaction.extra_signatories
|> list.any(fn(vk) { vk == datum.owner }) |> list.any(fn(vk) { vk == datum.owner })