From 7332ab0a1cfa60b55d4d473fbc86c20574c6e956 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 29 Sep 2023 10:51:59 -0500 Subject: [PATCH] refactor(report): Don't bother stripping ANSI escape codes `cargo report` calls `Shell::print_ansi_stdout`. Previously, it didn't always strip the colors when needed (e.g. `Write` is used). Now it does, so don't need to special case this when generating the report. --- src/cargo/core/compiler/future_incompat.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/cargo/core/compiler/future_incompat.rs b/src/cargo/core/compiler/future_incompat.rs index e94e42c390c4..5d43848af492 100644 --- a/src/cargo/core/compiler/future_incompat.rs +++ b/src/cargo/core/compiler/future_incompat.rs @@ -224,6 +224,7 @@ impl OnDiskReports { self.reports.last().map(|r| r.id).unwrap() } + /// Returns an ANSI-styled report pub fn get_report( &self, id: u32, @@ -269,11 +270,6 @@ impl OnDiskReports { let shell = config.shell(); - let to_display = if shell.err_supports_color() && shell.out_supports_color() { - to_display - } else { - anstream::adapter::strip_str(&to_display).to_string() - }; Ok(to_display) } }