fix debug impl

This commit is contained in:
Folkert 2022-01-23 15:44:42 +01:00
parent b42cc3d625
commit fbf3ba77e9

View file

@ -523,15 +523,24 @@ impl std::fmt::Debug for SetElement<'_> {
} }
impl std::fmt::Debug for LambdaSet<'_> { impl std::fmt::Debug for LambdaSet<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
struct Helper<'a> {
set: &'a [(Symbol, &'a [Layout<'a>])],
}
impl std::fmt::Debug for Helper<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let entries = self.set.iter().map(|x| SetElement { let entries = self.set.iter().map(|x| SetElement {
symbol: x.0, symbol: x.0,
layout: x.1, layout: x.1,
}); });
let set = f.debug_list().entries(entries).finish();
f.debug_list().entries(entries).finish()
}
}
f.debug_struct("LambdaSet") f.debug_struct("LambdaSet")
.field("set", &set) .field("set", &Helper { set: self.set })
.field("representation", &self.representation) .field("representation", &self.representation)
.finish() .finish()
} }