Skip to content

Commit 5f759a9

Browse files
authored
Rollup merge of rust-lang#142650 - camsteffen:refactor-translator, r=petrochenkov
Refactor Translator My main motivation was to simplify the usage of `SilentEmitter` for users like rustfmt. A few refactoring opportunities arose along the way. * Replace `Translate` trait with `Translator` struct * Replace `Emitter: Translate` with `Emitter::translator` * Split `SilentEmitter` into `FatalOnlyEmitter` and `SilentEmitter`
2 parents 42614bf + ade2682 commit 5f759a9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clippy_lints/src/doc/needless_doctest_main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ pub fn check(
4242
let mut test_attr_spans = vec![];
4343
let filename = FileName::anon_source_code(&code);
4444

45-
let fallback_bundle =
46-
rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
47-
let emitter = HumanEmitter::new(Box::new(io::sink()), fallback_bundle);
45+
let translator = rustc_driver::default_translator();
46+
let emitter = HumanEmitter::new(Box::new(io::sink()), translator);
4847
let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings();
4948
#[expect(clippy::arc_with_non_send_sync)] // `Arc` is expected by with_dcx
5049
let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));

0 commit comments

Comments
 (0)