Remove some arguments that are always the same

This commit is contained in:
Oli Scherer 2023-07-25 09:58:29 +00:00
parent ff8fe76c0e
commit 8d60f7573d
2 changed files with 7 additions and 27 deletions

View File

@ -549,21 +549,17 @@ impl Drop for HandlerInner {
impl Handler {
pub fn with_tty_emitter(
color_config: ColorConfig,
can_emit_warnings: bool,
treat_err_as_bug: Option<NonZeroUsize>,
sm: Option<Lrc<SourceMap>>,
fluent_bundle: Option<Lrc<FluentBundle>>,
fallback_bundle: LazyFallbackBundle,
ice_file: Option<PathBuf>,
) -> Self {
Self::with_tty_emitter_and_flags(
color_config,
ColorConfig::Auto,
sm,
fluent_bundle,
None,
fallback_bundle,
HandlerFlags { can_emit_warnings, treat_err_as_bug, ..Default::default() },
ice_file,
HandlerFlags { can_emit_warnings, treat_err_as_bug: None, ..Default::default() },
None,
)
}

View File

@ -9,7 +9,7 @@ use crate::lint::{
use rustc_ast::node_id::NodeId;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_data_structures::sync::{AppendOnlyVec, AtomicBool, Lock, Lrc};
use rustc_errors::{emitter::SilentEmitter, ColorConfig, Handler};
use rustc_errors::{emitter::SilentEmitter, Handler};
use rustc_errors::{
fallback_fluent_bundle, Diagnostic, DiagnosticBuilder, DiagnosticId, DiagnosticMessage,
EmissionGuarantee, ErrorGuaranteed, IntoDiagnostic, MultiSpan, Noted, StashKey,
@ -224,15 +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(
ColorConfig::Auto,
true,
None,
Some(sm.clone()),
None,
fallback_bundle,
None,
);
let handler = Handler::with_tty_emitter(true, Some(sm.clone()), fallback_bundle);
ParseSess::with_span_handler(handler, sm)
}
@ -262,15 +254,7 @@ 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(
ColorConfig::Auto,
false,
None,
None,
None,
fallback_bundle,
None,
);
let fatal_handler = Handler::with_tty_emitter(false, None, fallback_bundle);
let handler = Handler::with_emitter(
false,
None,