Remove unnecessary item_name parameter to mod_item_in
This commit is contained in:
parent
7f6d540440
commit
edb60a9243
3 changed files with 9 additions and 11 deletions
|
@ -34,7 +34,7 @@ crate trait FormatRenderer<'tcx>: Sized {
|
||||||
fn item(&mut self, item: clean::Item) -> Result<(), Error>;
|
fn item(&mut self, item: clean::Item) -> Result<(), Error>;
|
||||||
|
|
||||||
/// Renders a module (should not handle recursing into children).
|
/// Renders a module (should not handle recursing into children).
|
||||||
fn mod_item_in(&mut self, item: &clean::Item, item_name: &str) -> Result<(), Error>;
|
fn mod_item_in(&mut self, item: &clean::Item) -> Result<(), Error>;
|
||||||
|
|
||||||
/// Runs after recursively rendering all sub-items of a module.
|
/// Runs after recursively rendering all sub-items of a module.
|
||||||
fn mod_item_out(&mut self) -> Result<(), Error> {
|
fn mod_item_out(&mut self) -> Result<(), Error> {
|
||||||
|
@ -73,13 +73,10 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
|
||||||
if item.is_mod() && T::RUN_ON_MODULE {
|
if item.is_mod() && T::RUN_ON_MODULE {
|
||||||
// modules are special because they add a namespace. We also need to
|
// modules are special because they add a namespace. We also need to
|
||||||
// recurse into the items of the module as well.
|
// recurse into the items of the module as well.
|
||||||
let name = item.name.as_ref().unwrap().to_string();
|
let _timer =
|
||||||
if name.is_empty() {
|
prof.generic_activity_with_arg("render_mod_item", item.name.unwrap().to_string());
|
||||||
panic!("Unexpected module with empty name");
|
|
||||||
}
|
|
||||||
let _timer = prof.generic_activity_with_arg("render_mod_item", name.as_str());
|
|
||||||
|
|
||||||
cx.mod_item_in(&item, &name)?;
|
cx.mod_item_in(&item)?;
|
||||||
let module = match *item.kind {
|
let module = match *item.kind {
|
||||||
clean::StrippedItem(box clean::ModuleItem(m)) | clean::ModuleItem(m) => m,
|
clean::StrippedItem(box clean::ModuleItem(m)) | clean::ModuleItem(m) => m,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
|
@ -578,7 +578,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mod_item_in(&mut self, item: &clean::Item, item_name: &str) -> Result<(), Error> {
|
fn mod_item_in(&mut self, item: &clean::Item) -> Result<(), Error> {
|
||||||
// Stripped modules survive the rustdoc passes (i.e., `strip-private`)
|
// Stripped modules survive the rustdoc passes (i.e., `strip-private`)
|
||||||
// if they contain impls for public types. These modules can also
|
// if they contain impls for public types. These modules can also
|
||||||
// contain items such as publicly re-exported structures.
|
// contain items such as publicly re-exported structures.
|
||||||
|
@ -590,8 +590,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||||
self.render_redirect_pages = item.is_stripped();
|
self.render_redirect_pages = item.is_stripped();
|
||||||
}
|
}
|
||||||
let scx = &self.shared;
|
let scx = &self.shared;
|
||||||
self.dst.push(item_name);
|
let item_name = item.name.as_ref().unwrap().to_string();
|
||||||
self.current.push(item_name.to_owned());
|
self.dst.push(&item_name);
|
||||||
|
self.current.push(item_name);
|
||||||
|
|
||||||
info!("Recursing into {}", self.dst.display());
|
info!("Recursing into {}", self.dst.display());
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mod_item_in(&mut self, item: &clean::Item, _module_name: &str) -> Result<(), Error> {
|
fn mod_item_in(&mut self, item: &clean::Item) -> Result<(), Error> {
|
||||||
use clean::types::ItemKind::*;
|
use clean::types::ItemKind::*;
|
||||||
if let ModuleItem(m) = &*item.kind {
|
if let ModuleItem(m) = &*item.kind {
|
||||||
for item in &m.items {
|
for item in &m.items {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue