Skip to content

Commit 7330285

Browse files
committed
Simplify Debug
1 parent a1f85a3 commit 7330285

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

color/src/flags.rs

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,8 @@ impl Flags {
114114
impl core::fmt::Debug for Flags {
115115
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
116116
f.debug_struct("Flags")
117-
.field(
118-
"data",
119-
&format_args!(
120-
"{:#018b}",
121-
((self.missing.0 as u16) << 8) + (self.name as u16)
122-
),
123-
)
124-
.field(
125-
"missing",
126-
&[
127-
self.missing.contains(0),
128-
self.missing.contains(1),
129-
self.missing.contains(2),
130-
self.missing.contains(3),
131-
],
132-
)
117+
.field("missing", &self.missing)
118+
.field("name", &self.name)
133119
.field("named", &self.named())
134120
.field("color_name", &self.color_name())
135121
.finish()
@@ -189,17 +175,8 @@ impl core::ops::Not for Missing {
189175

190176
impl core::fmt::Debug for Missing {
191177
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
192-
f.debug_struct("Missing")
193-
.field("data", &format_args!("{:#010b}", self.0))
194-
.field(
195-
"missing",
196-
&[
197-
self.contains(0),
198-
self.contains(1),
199-
self.contains(2),
200-
self.contains(3),
201-
],
202-
)
178+
f.debug_tuple("Missing")
179+
.field(&format_args!("{:#010b}", self.0))
203180
.finish()
204181
}
205182
}

0 commit comments

Comments
 (0)