Rollup merge of #121783 - nnethercote:emitter-cleanups, r=oli-obk

Emitter cleanups

Some cleanups I made when reading emitter code. In particular, `HumanEmitter` and `JsonEmitter` have gone from three constructors to one.

r? `@oli-obk`
This commit is contained in:
Guillaume Gomez 2024-02-29 17:08:38 +01:00 committed by GitHub
commit 14b72519c9

View File

@ -45,7 +45,7 @@ fn check_code_sample(code: String, edition: Edition, ignore: bool) -> (bool, Vec
let fallback_bundle =
rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
let emitter = HumanEmitter::new(Box::new(io::sink()), fallback_bundle);
let dcx = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings();
let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings();
#[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_dcx
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sess = ParseSess::with_dcx(dcx, sm);