Skip to content

Commit 00b9003

Browse files
authored
Merge pull request #180 from shesek/202011-sortedmulti-display
Fix Display/Debug For SortedMultiVec
2 parents a87fd40 + 254f900 commit 00b9003

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/descriptor/mod.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,21 +1615,17 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> policy::Liftable<Pk> for SortedMulti
16151615

16161616
impl<Pk: MiniscriptKey, Ctx: ScriptContext> fmt::Debug for SortedMultiVec<Pk, Ctx> {
16171617
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1618-
let mut pks = vec![];
1619-
for pk in &self.pks {
1620-
pks.push(pk.to_string());
1621-
}
1622-
write!(f, "sortedmulti({:?},{:?})", self.k, pks.join(","))
1618+
fmt::Display::fmt(self, f)
16231619
}
16241620
}
16251621

16261622
impl<Pk: MiniscriptKey, Ctx: ScriptContext> fmt::Display for SortedMultiVec<Pk, Ctx> {
16271623
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1628-
let mut pks = vec![];
1629-
for pk in &self.pks {
1630-
pks.push(pk.to_string());
1624+
write!(f, "sortedmulti({}", self.k)?;
1625+
for k in &self.pks {
1626+
write!(f, ",{}", k)?;
16311627
}
1632-
write!(f, "sortedmulti({:?},{:?})", self.k, pks.join(","))
1628+
f.write_str(")")
16331629
}
16341630
}
16351631

0 commit comments

Comments
 (0)