Skip to content

Commit 640cc74

Browse files
committed
Remove unnecessary edition parameter to renderer
1 parent 68db586 commit 640cc74

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

src/librustdoc/formats/renderer.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_middle::ty::TyCtxt;
2-
use rustc_span::{edition::Edition, Symbol};
2+
use rustc_span::Symbol;
33

44
use crate::clean;
55
use crate::config::RenderOptions;
@@ -23,7 +23,6 @@ crate trait FormatRenderer<'tcx>: Sized {
2323
fn init(
2424
krate: clean::Crate,
2525
options: RenderOptions,
26-
edition: Edition,
2726
cache: Cache,
2827
tcx: TyCtxt<'tcx>,
2928
) -> Result<(Self, clean::Crate), Error>;
@@ -51,15 +50,14 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
5150
krate: clean::Crate,
5251
options: RenderOptions,
5352
cache: Cache,
54-
edition: Edition,
5553
tcx: TyCtxt<'tcx>,
5654
) -> Result<(), Error> {
5755
let prof = &tcx.sess.prof;
5856

5957
let emit_crate = options.should_emit_crate();
6058
let (mut format_renderer, krate) = prof
6159
.extra_verbose_generic_activity("create_renderer", T::descr())
62-
.run(|| T::init(krate, options, edition, cache, tcx))?;
60+
.run(|| T::init(krate, options, cache, tcx))?;
6361

6462
if !emit_crate {
6563
return Ok(());

src/librustdoc/html/render/context.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
346346
fn init(
347347
mut krate: clean::Crate,
348348
options: RenderOptions,
349-
edition: Edition,
350349
mut cache: Cache,
351350
tcx: TyCtxt<'tcx>,
352351
) -> Result<(Self, clean::Crate), Error> {
@@ -435,7 +434,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
435434
resource_suffix,
436435
static_root_path,
437436
fs: DocFS::new(sender),
438-
edition,
437+
edition: tcx.sess.edition(),
439438
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
440439
playground,
441440
all: RefCell::new(AllTypes::new()),

src/librustdoc/json/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::rc::Rc;
1414
use rustc_data_structures::fx::FxHashMap;
1515
use rustc_middle::ty::TyCtxt;
1616
use rustc_session::Session;
17-
use rustc_span::edition::Edition;
1817

1918
use rustdoc_json_types as types;
2019

@@ -134,7 +133,6 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
134133
fn init(
135134
krate: clean::Crate,
136135
options: RenderOptions,
137-
_edition: Edition,
138136
cache: Cache,
139137
tcx: TyCtxt<'tcx>,
140138
) -> Result<(Self, clean::Crate), Error> {

src/librustdoc/lib.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,9 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>(
656656
krate: clean::Crate,
657657
renderopts: config::RenderOptions,
658658
cache: formats::cache::Cache,
659-
edition: rustc_span::edition::Edition,
660659
tcx: TyCtxt<'tcx>,
661660
) -> MainResult {
662-
match formats::run_format::<T>(krate, renderopts, cache, edition, tcx) {
661+
match formats::run_format::<T>(krate, renderopts, cache, tcx) {
663662
Ok(_) => Ok(()),
664663
Err(e) => {
665664
let mut msg =
@@ -692,7 +691,6 @@ fn main_options(options: config::Options) -> MainResult {
692691

693692
// need to move these items separately because we lose them by the time the closure is called,
694693
// but we can't create the Handler ahead of time because it's not Send
695-
let edition = options.edition;
696694
let show_coverage = options.show_coverage;
697695
let run_check = options.run_check;
698696

@@ -760,22 +758,10 @@ fn main_options(options: config::Options) -> MainResult {
760758
info!("going to format");
761759
match output_format {
762760
config::OutputFormat::Html => sess.time("render_html", || {
763-
run_renderer::<html::render::Context<'_>>(
764-
krate,
765-
render_opts,
766-
cache,
767-
edition,
768-
tcx,
769-
)
761+
run_renderer::<html::render::Context<'_>>(krate, render_opts, cache, tcx)
770762
}),
771763
config::OutputFormat::Json => sess.time("render_json", || {
772-
run_renderer::<json::JsonRenderer<'_>>(
773-
krate,
774-
render_opts,
775-
cache,
776-
edition,
777-
tcx,
778-
)
764+
run_renderer::<json::JsonRenderer<'_>>(krate, render_opts, cache, tcx)
779765
}),
780766
}
781767
})

0 commit comments

Comments
 (0)