1
Fork 0

Use a builder instead of boolean/option arguments

This commit is contained in:
Oli Scherer 2023-07-25 10:27:34 +00:00
parent cf9f53c837
commit 2b444672e1
12 changed files with 45 additions and 56 deletions

View file

@ -224,7 +224,7 @@ impl ParseSess {
pub fn new(locale_resources: Vec<&'static str>, file_path_mapping: FilePathMapping) -> Self {
let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
let sm = Lrc::new(SourceMap::new(file_path_mapping));
let handler = Handler::with_tty_emitter(true, Some(sm.clone()), fallback_bundle);
let handler = Handler::with_tty_emitter(Some(sm.clone()), fallback_bundle);
ParseSess::with_span_handler(handler, sm)
}
@ -254,13 +254,9 @@ impl ParseSess {
pub fn with_silent_emitter(fatal_note: Option<String>) -> Self {
let fallback_bundle = fallback_fluent_bundle(Vec::new(), false);
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let fatal_handler = Handler::with_tty_emitter(false, None, fallback_bundle);
let handler = Handler::with_emitter(
false,
None,
Box::new(SilentEmitter { fatal_handler, fatal_note }),
None,
);
let fatal_handler = Handler::with_tty_emitter(None, fallback_bundle).disable_warnings();
let handler = Handler::with_emitter(Box::new(SilentEmitter { fatal_handler, fatal_note }))
.disable_warnings();
ParseSess::with_span_handler(handler, sm)
}