From 08fd1644d2a52d7e10aa648d5baee54034b715e9 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 3 Jul 2023 13:40:14 -0400 Subject: [PATCH] Unite bless environment variables under `RUSTC_BLESS` Currently, Clippy, Miri, Rustfmt, and rustc all use an environment variable to indicate that output should be blessed, but they use different variable names. In order to improve consistency, this patch applies the following changes: - Emit `RUSTC_BLESS` within `prepare_cargo_test` so it is always available - Change usage of `MIRI_BLESS` in the Miri subtree to use `RUSTC_BLESS` - Change usage of `BLESS` in the Clippy subtree to `RUSTC_BLESS` - Change usage of `BLESS` in the Rustfmt subtree to `RUSTC_BLESS` - Adjust the blessable test in `rustc_errors` to use this same convention - Update documentation where applicable Any tools that uses `RUSTC_BLESS` should check that it is set to any value other than `"0"`. --- src/test/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index 364aa225f68..37854ead28b 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -838,11 +838,9 @@ fn handle_result( // Ignore LF and CRLF difference for Windows. if !string_eq_ignore_newline_repr(&fmt_text, &text) { - if let Some(bless) = std::env::var_os("BLESS") { - if bless != "0" { - std::fs::write(file_name, fmt_text).unwrap(); - continue; - } + if std::env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0") { + std::fs::write(file_name, fmt_text).unwrap(); + continue; } let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE); assert!(