Skip to content

Commit 0f5bdd3

Browse files
committed
fix(style): use a less convoluted test
1 parent 7fb048f commit 0f5bdd3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/grid.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,11 @@ impl FusedIterator for EdgesIterator<'_> {}
698698

699699
impl fmt::Debug for Grid {
700700
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
701-
let (present, absent) = [('#', '.'), ('▓', '░')][usize::from(f.alternate())];
701+
let (present, absent) = if f.alternate() {
702+
('▓', '░')
703+
} else {
704+
('#', '.')
705+
};
702706
let lines: Vec<_> = if f.sign_minus() {
703707
(0..self.height).rev().collect()
704708
} else {
@@ -710,7 +714,11 @@ impl fmt::Debug for Grid {
710714
write!(
711715
f,
712716
"{}",
713-
[absent, present][usize::from(self.has_vertex((x, y)))]
717+
if self.has_vertex((x, y)) {
718+
present
719+
} else {
720+
absent
721+
}
714722
)?;
715723
}
716724
if y != last {

0 commit comments

Comments
 (0)