Remove unnecessary edition parameter to renderer

This commit is contained in:
Joshua Nelson 2021-04-22 19:35:20 -04:00
parent 68db5869e3
commit 640cc741e0
4 changed files with 6 additions and 25 deletions

View File

@ -1,5 +1,5 @@
use rustc_middle::ty::TyCtxt;
use rustc_span::{edition::Edition, Symbol};
use rustc_span::Symbol;
use crate::clean;
use crate::config::RenderOptions;
@ -23,7 +23,6 @@ crate trait FormatRenderer<'tcx>: Sized {
fn init(
krate: clean::Crate,
options: RenderOptions,
edition: Edition,
cache: Cache,
tcx: TyCtxt<'tcx>,
) -> Result<(Self, clean::Crate), Error>;
@ -51,7 +50,6 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
krate: clean::Crate,
options: RenderOptions,
cache: Cache,
edition: Edition,
tcx: TyCtxt<'tcx>,
) -> Result<(), Error> {
let prof = &tcx.sess.prof;
@ -59,7 +57,7 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
let emit_crate = options.should_emit_crate();
let (mut format_renderer, krate) = prof
.extra_verbose_generic_activity("create_renderer", T::descr())
.run(|| T::init(krate, options, edition, cache, tcx))?;
.run(|| T::init(krate, options, cache, tcx))?;
if !emit_crate {
return Ok(());

View File

@ -346,7 +346,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
fn init(
mut krate: clean::Crate,
options: RenderOptions,
edition: Edition,
mut cache: Cache,
tcx: TyCtxt<'tcx>,
) -> Result<(Self, clean::Crate), Error> {
@ -435,7 +434,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
resource_suffix,
static_root_path,
fs: DocFS::new(sender),
edition,
edition: tcx.sess.edition(),
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
playground,
all: RefCell::new(AllTypes::new()),

View File

@ -14,7 +14,6 @@ use std::rc::Rc;
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustc_span::edition::Edition;
use rustdoc_json_types as types;
@ -134,7 +133,6 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
fn init(
krate: clean::Crate,
options: RenderOptions,
_edition: Edition,
cache: Cache,
tcx: TyCtxt<'tcx>,
) -> Result<(Self, clean::Crate), Error> {

View File

@ -656,10 +656,9 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
krate: clean::Crate,
renderopts: config::RenderOptions,
cache: formats::cache::Cache,
edition: rustc_span::edition::Edition,
tcx: TyCtxt<'tcx>,
) -> MainResult {
match formats::run_format::<T>(krate, renderopts, cache, edition, tcx) {
match formats::run_format::<T>(krate, renderopts, cache, tcx) {
Ok(_) => Ok(()),
Err(e) => {
let mut msg =
@ -692,7 +691,6 @@ 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 edition = options.edition;
let show_coverage = options.show_coverage;
let run_check = options.run_check;
@ -760,22 +758,10 @@ fn main_options(options: config::Options) -> MainResult {
info!("going to format");
match output_format {
config::OutputFormat::Html => sess.time("render_html", || {
run_renderer::<html::render::Context<'_>>(
krate,
render_opts,
cache,
edition,
tcx,
)
run_renderer::<html::render::Context<'_>>(krate, render_opts, cache, tcx)
}),
config::OutputFormat::Json => sess.time("render_json", || {
run_renderer::<json::JsonRenderer<'_>>(
krate,
render_opts,
cache,
edition,
tcx,
)
run_renderer::<json::JsonRenderer<'_>>(krate, render_opts, cache, tcx)
}),
}
})