Bless the target file instead of the source file

This commit is contained in:
Wim Looman 2024-02-09 12:27:33 +01:00 committed by Yacin Tmimi
parent ead0fc9529
commit 8486837d55

View File

@ -835,7 +835,7 @@ fn handle_result(
// Ignore LF and CRLF difference for Windows. // Ignore LF and CRLF difference for Windows.
if !string_eq_ignore_newline_repr(&fmt_text, &text) { if !string_eq_ignore_newline_repr(&fmt_text, &text) {
if std::env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0") { if std::env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0") {
std::fs::write(file_name, fmt_text).unwrap(); std::fs::write(target, fmt_text).unwrap();
continue; continue;
} }
let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE); let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE);