From 094bf63f027d4d67e8a6c4416d48b94c40427ba0 Mon Sep 17 00:00:00 2001 From: Sharif Haason Date: Sat, 8 Oct 2022 22:45:32 -0400 Subject: [PATCH] Eliminate unnecessary call to `active` --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3119b7c..8242600 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -494,6 +494,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> { let mut is_flushed = false; let old_active = self.squeezer.active(); self.squeezer.process(b, self.idx); + let new_active = self.squeezer.active(); // the header should be the first thing printed if self.idx == 0 { @@ -501,7 +502,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> { } // flush the rest of the line buffer before continuing to write - if old_active && !self.squeezer.active() { + if old_active && !new_active { self.writer.write_all( self.border_style .outer_sep() @@ -520,7 +521,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> { is_flushed = true; } - if !self.squeezer.active() || self.squeezer.action() == SqueezeAction::Print { + if !new_active || self.squeezer.action() == SqueezeAction::Print { // print the left border and position panel if there's a new line self.line_buf.push(b); if self.idx % (8 * self.panels as u64) == 0 && !is_flushed {