Remove unnecessary edition field on SharedContext

This commit is contained in:
Joshua Nelson 2021-04-22 19:38:20 -04:00
parent 640cc741e0
commit 423963c07b
4 changed files with 10 additions and 9 deletions

View File

@ -111,8 +111,6 @@ crate struct SharedContext<'tcx> {
crate static_root_path: Option<String>,
/// The fs handle we are working with.
crate fs: DocFS,
/// The default edition used to parse doctests.
crate edition: Edition,
pub(super) codes: ErrorCodes,
pub(super) playground: Option<markdown::Playground>,
all: RefCell<AllTypes>,
@ -141,6 +139,10 @@ impl SharedContext<'_> {
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
}
crate fn edition(&self) -> Edition {
self.tcx.sess.edition()
}
}
impl<'tcx> Context<'tcx> {
@ -434,7 +436,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
resource_suffix,
static_root_path,
fs: DocFS::new(sender),
edition: tcx.sess.edition(),
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
playground,
all: RefCell::new(AllTypes::new()),

View File

@ -530,7 +530,7 @@ fn render_markdown(
&links,
&mut ids,
cx.shared.codes,
cx.shared.edition,
cx.shared.edition(),
&cx.shared.playground
)
.into_string()
@ -660,7 +660,7 @@ fn short_item_info(
&note,
&mut ids,
error_codes,
cx.shared.edition,
cx.shared.edition(),
&cx.shared.playground,
);
message.push_str(&format!(": {}", html.into_string()));
@ -702,7 +702,7 @@ fn short_item_info(
&unstable_reason.as_str(),
&mut ids,
error_codes,
cx.shared.edition,
cx.shared.edition(),
&cx.shared.playground,
)
.into_string()
@ -1358,7 +1358,7 @@ fn render_impl(
&i.impl_item.links(cx),
&mut ids,
cx.shared.codes,
cx.shared.edition,
cx.shared.edition(),
&cx.shared.playground
)
.into_string()

View File

@ -425,7 +425,7 @@ pub(super) fn write_shared(
md_opts.output = cx.dst.clone();
md_opts.external_html = (*cx.shared).layout.external_html.clone();
crate::markdown::render(&index_page, md_opts, cx.shared.edition)
crate::markdown::render(&index_page, md_opts, cx.shared.edition())
.map_err(|e| Error::new(e, &index_page))?;
} else {
let dst = cx.dst.join("index.html");

View File

@ -129,7 +129,7 @@ impl SourceCollector<'_, 'tcx> {
&self.scx.layout,
&page,
"",
|buf: &mut _| print_src(buf, contents, self.scx.edition),
|buf: &mut _| print_src(buf, contents, self.scx.edition()),
&self.scx.style_files,
);
self.scx.fs.write(&cur, v.as_bytes())?;