Skip to content

Commit d01712d

Browse files
committed
Don't carry the information about erasing entries in every message
1 parent 788ba87 commit d01712d

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/status_emitter.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ impl JoinOnDrop {
190190

191191
#[derive(Debug)]
192192
enum PopStyle {
193-
Erase,
194193
Abort,
195194
Replace(String),
196195
}
@@ -232,7 +231,6 @@ impl Text {
232231
impl ProgressHandler {
233232
fn pop(&mut self, msg: String, new_leftover_msg: PopStyle, parent: String) {
234233
let new_msg = match new_leftover_msg {
235-
PopStyle::Erase => None,
236234
PopStyle::Abort => {
237235
self.aborted = true;
238236
None
@@ -251,25 +249,24 @@ impl Text {
251249
*done = true;
252250
let spinner = spinner.clone();
253251

254-
let print = new_msg.is_some();
255-
256252
if let Some(new_msg) = new_msg {
257253
spinner.finish_with_message(new_msg);
258254
} else {
259-
spinner.finish();
255+
spinner.finish_and_clear();
256+
return;
260257
}
261258
let parent = children[""].0.clone();
262259
if children.values().all(|&(_, done)| done) {
263260
self.bars.remove(&parent);
264-
if print {
261+
if self.progress.is_hidden() {
265262
self.bars
266263
.println(format!("{} {}", parent.prefix(), parent.message()))
267264
.unwrap();
268265
}
269266
for (msg, (child, _)) in children.iter() {
270267
if !msg.is_empty() {
271268
self.bars.remove(child);
272-
if print {
269+
if self.progress.is_hidden() {
273270
self.bars
274271
.println(format!(
275272
" {} {}",
@@ -403,10 +400,6 @@ impl Text {
403400
Self::start_thread(OutputVerbosity::Progress)
404401
}
405402

406-
fn is_quiet_output(&self) -> bool {
407-
matches!(self.progress, OutputVerbosity::Progress)
408-
}
409-
410403
fn is_full_output(&self) -> bool {
411404
matches!(self.progress, OutputVerbosity::Full)
412405
}
@@ -433,8 +426,6 @@ impl TestStatus for TextTest {
433426
fn done(&self, result: &TestResult, aborted: bool) {
434427
let new_leftover_msg = if aborted {
435428
PopStyle::Abort
436-
} else if self.text.is_quiet_output() {
437-
PopStyle::Erase
438429
} else {
439430
let result = match result {
440431
Ok(TestOk::Ok) => "ok".green(),

0 commit comments

Comments
 (0)