Make x test src/tools/rustfmt --bless format rustfmt with the freshly built in-tree version

This commit is contained in:
Oli Scherer 2023-07-26 08:22:52 +00:00
parent a3dfd82559
commit c0ee8f5fea
2 changed files with 13 additions and 9 deletions

View File

@ -152,15 +152,13 @@ fn default_handler(
TerminalUrl::No, TerminalUrl::No,
)) ))
}; };
Handler::with_emitter( Handler::with_emitter(Box::new(SilentOnIgnoredFilesEmitter {
Box::new(SilentOnIgnoredFilesEmitter { has_non_ignorable_parser_errors: false,
has_non_ignorable_parser_errors: false, source_map,
source_map, emitter,
emitter, ignore_path_set,
ignore_path_set, can_reset,
can_reset, }))
}),
)
} }
impl ParseSess { impl ParseSess {

View File

@ -838,6 +838,12 @@ 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 let Some(bless) = std::env::var_os("BLESS") {
if bless != "0" {
std::fs::write(file_name, fmt_text).unwrap();
continue;
}
}
let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE); let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE);
assert!( assert!(
!diff.is_empty(), !diff.is_empty(),