Remove unnecessary diag parameter to after_krate

This commit is contained in:
Joshua Nelson
2021-04-22 19:32:24 -04:00
parent f435f7185b
commit 68db5869e3
4 changed files with 10 additions and 16 deletions

View File

@@ -656,14 +656,14 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
krate: clean::Crate,
renderopts: config::RenderOptions,
cache: formats::cache::Cache,
diag: &rustc_errors::Handler,
edition: rustc_span::edition::Edition,
tcx: TyCtxt<'tcx>,
) -> MainResult {
match formats::run_format::<T>(krate, renderopts, cache, &diag, edition, tcx) {
match formats::run_format::<T>(krate, renderopts, cache, edition, tcx) {
Ok(_) => Ok(()),
Err(e) => {
let mut msg = diag.struct_err(&format!("couldn't generate documentation: {}", e.error));
let mut msg =
tcx.sess.struct_err(&format!("couldn't generate documentation: {}", e.error));
let file = e.file.display().to_string();
if file.is_empty() {
msg.emit()
@@ -692,7 +692,7 @@ fn main_options(options: config::Options) -> MainResult {
// need to move these items separately because we lose them by the time the closure is called,
// but we can't create the Handler ahead of time because it's not Send
let diag_opts = (options.error_format, options.edition, options.debugging_opts.clone());
let edition = options.edition;
let show_coverage = options.show_coverage;
let run_check = options.run_check;
@@ -758,15 +758,12 @@ fn main_options(options: config::Options) -> MainResult {
}
info!("going to format");
let (error_format, edition, debugging_options) = diag_opts;
let diag = core::new_handler(error_format, None, &debugging_options);
match output_format {
config::OutputFormat::Html => sess.time("render_html", || {
run_renderer::<html::render::Context<'_>>(
krate,
render_opts,
cache,
&diag,
edition,
tcx,
)
@@ -776,7 +773,6 @@ fn main_options(options: config::Options) -> MainResult {
krate,
render_opts,
cache,
&diag,
edition,
tcx,
)