Remove unnecessary edition
field on SharedContext
This commit is contained in:
parent
640cc741e0
commit
423963c07b
@ -111,8 +111,6 @@ crate struct SharedContext<'tcx> {
|
|||||||
crate static_root_path: Option<String>,
|
crate static_root_path: Option<String>,
|
||||||
/// The fs handle we are working with.
|
/// The fs handle we are working with.
|
||||||
crate fs: DocFS,
|
crate fs: DocFS,
|
||||||
/// The default edition used to parse doctests.
|
|
||||||
crate edition: Edition,
|
|
||||||
pub(super) codes: ErrorCodes,
|
pub(super) codes: ErrorCodes,
|
||||||
pub(super) playground: Option<markdown::Playground>,
|
pub(super) playground: Option<markdown::Playground>,
|
||||||
all: RefCell<AllTypes>,
|
all: RefCell<AllTypes>,
|
||||||
@ -141,6 +139,10 @@ impl SharedContext<'_> {
|
|||||||
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
|
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() }
|
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crate fn edition(&self) -> Edition {
|
||||||
|
self.tcx.sess.edition()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Context<'tcx> {
|
impl<'tcx> Context<'tcx> {
|
||||||
@ -434,7 +436,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
|||||||
resource_suffix,
|
resource_suffix,
|
||||||
static_root_path,
|
static_root_path,
|
||||||
fs: DocFS::new(sender),
|
fs: DocFS::new(sender),
|
||||||
edition: tcx.sess.edition(),
|
|
||||||
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
|
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
|
||||||
playground,
|
playground,
|
||||||
all: RefCell::new(AllTypes::new()),
|
all: RefCell::new(AllTypes::new()),
|
||||||
|
@ -530,7 +530,7 @@ fn render_markdown(
|
|||||||
&links,
|
&links,
|
||||||
&mut ids,
|
&mut ids,
|
||||||
cx.shared.codes,
|
cx.shared.codes,
|
||||||
cx.shared.edition,
|
cx.shared.edition(),
|
||||||
&cx.shared.playground
|
&cx.shared.playground
|
||||||
)
|
)
|
||||||
.into_string()
|
.into_string()
|
||||||
@ -660,7 +660,7 @@ fn short_item_info(
|
|||||||
¬e,
|
¬e,
|
||||||
&mut ids,
|
&mut ids,
|
||||||
error_codes,
|
error_codes,
|
||||||
cx.shared.edition,
|
cx.shared.edition(),
|
||||||
&cx.shared.playground,
|
&cx.shared.playground,
|
||||||
);
|
);
|
||||||
message.push_str(&format!(": {}", html.into_string()));
|
message.push_str(&format!(": {}", html.into_string()));
|
||||||
@ -702,7 +702,7 @@ fn short_item_info(
|
|||||||
&unstable_reason.as_str(),
|
&unstable_reason.as_str(),
|
||||||
&mut ids,
|
&mut ids,
|
||||||
error_codes,
|
error_codes,
|
||||||
cx.shared.edition,
|
cx.shared.edition(),
|
||||||
&cx.shared.playground,
|
&cx.shared.playground,
|
||||||
)
|
)
|
||||||
.into_string()
|
.into_string()
|
||||||
@ -1358,7 +1358,7 @@ fn render_impl(
|
|||||||
&i.impl_item.links(cx),
|
&i.impl_item.links(cx),
|
||||||
&mut ids,
|
&mut ids,
|
||||||
cx.shared.codes,
|
cx.shared.codes,
|
||||||
cx.shared.edition,
|
cx.shared.edition(),
|
||||||
&cx.shared.playground
|
&cx.shared.playground
|
||||||
)
|
)
|
||||||
.into_string()
|
.into_string()
|
||||||
|
@ -425,7 +425,7 @@ pub(super) fn write_shared(
|
|||||||
md_opts.output = cx.dst.clone();
|
md_opts.output = cx.dst.clone();
|
||||||
md_opts.external_html = (*cx.shared).layout.external_html.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))?;
|
.map_err(|e| Error::new(e, &index_page))?;
|
||||||
} else {
|
} else {
|
||||||
let dst = cx.dst.join("index.html");
|
let dst = cx.dst.join("index.html");
|
||||||
|
@ -129,7 +129,7 @@ impl SourceCollector<'_, 'tcx> {
|
|||||||
&self.scx.layout,
|
&self.scx.layout,
|
||||||
&page,
|
&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.style_files,
|
||||||
);
|
);
|
||||||
self.scx.fs.write(&cur, v.as_bytes())?;
|
self.scx.fs.write(&cur, v.as_bytes())?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user