From 29078668dd7be3388dae14b127f70bf396fabed7 Mon Sep 17 00:00:00 2001 From: jdidion Date: Thu, 5 Oct 2023 11:41:29 -0700 Subject: [PATCH] revert --- .github/workflows/test.yml | 8 +------- pest-test/src/diff.rs | 11 +---------- pest-test/src/model.rs | 14 +++----------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a95c99..3949ff9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,8 +5,7 @@ on: pull_request: types: [opened, reopened] -env: - TERM: xterm-256color +env: CLICOLOR_FORCE: true CARGO_TERM_COLOR: always @@ -23,11 +22,6 @@ jobs: - uses: actions-rs/cargo@v1 with: command: build - - run: - echo "$TERM" - echo "$NO_COLOR" - echo "$CLICOLOR" - echo "$CLICOLOR_FORCE" - uses: actions-rs/cargo@v1 with: command: test diff --git a/pest-test/src/diff.rs b/pest-test/src/diff.rs index ffd8515..e59145d 100644 --- a/pest-test/src/diff.rs +++ b/pest-test/src/diff.rs @@ -227,14 +227,9 @@ impl<'a> ExpressionDiffFormatterExt for ExpressionFormatter<'a> { expected_color: Option, actual_color: Option, ) -> FmtResult { - println!("B"); match diff { - ExpressionDiff::Equal(expression) => { - println!("Equal"); - self.fmt(expression)? - } + ExpressionDiff::Equal(expression) => self.fmt(expression)?, ExpressionDiff::NotEqual { expected, actual } => { - println!("NotEqual"); self.color = expected_color; self.fmt(expected)?; self.write_newline()?; @@ -243,19 +238,16 @@ impl<'a> ExpressionDiffFormatterExt for ExpressionFormatter<'a> { self.color = None; } ExpressionDiff::Missing(expression) => { - println!("Missing"); self.color = expected_color; self.fmt(expression)?; self.color = None; } ExpressionDiff::Extra(expression) => { - println!("Extra"); self.color = actual_color; self.fmt(expression)?; self.color = None; } ExpressionDiff::Partial { name, children } => { - println!("Partial"); self.write_indent()?; self.write_char('(')?; self.write_str(name)?; @@ -583,7 +575,6 @@ mod tests { let diff = ExpressionDiff::from_expressions(&expected_sexpr, &test_case.expression, false); let mut writer = String::new(); let mut formatter = ExpressionFormatter::from_defaults(&mut writer); - println!("A"); formatter .fmt_diff(&diff, Some(Color::Green), Some(Color::Red)) .ok(); diff --git a/pest-test/src/model.rs b/pest-test/src/model.rs index 48e6bb6..54ec1b1 100644 --- a/pest-test/src/model.rs +++ b/pest-test/src/model.rs @@ -201,16 +201,10 @@ impl<'a> ExpressionFormatter<'a> { } pub(crate) fn write_str(&mut self, s: &str) -> FmtResult { - println!("write_str {:?}", self.color); match self.color { - Some(color) => { - let c = s.color(color); - println!("{:?}", c); - let s = format!("{}", c); - let ss = s.escape_default().to_string(); - println!("write_str color {ss}"); - self.writer.write_str(s.as_ref()) - } + Some(color) => self + .writer + .write_str(format!("{}", s.color(color)).as_ref()), None => self.writer.write_str(s), } } @@ -225,7 +219,6 @@ impl<'a> ExpressionFormatter<'a> { buffering: false, }; string_formatter.fmt(expression)?; - println!("color {:?}", self.color); self.write_str(buf.as_ref())?; Ok(()) } @@ -271,7 +264,6 @@ impl<'a> ExpressionFormatter<'a> { } pub fn fmt(&mut self, expression: &Expression) -> FmtResult { - println!("Buffering {} color {:?}", self.buffering, self.color); if self.buffering { self.fmt_buffered(expression) } else {