Skip to content

Commit b492170

Browse files
Rename FormatRenderer::InfoType into ModuleData and rename FormatRenderer::make_child_renderer into save_module_data
1 parent e60a7a4 commit b492170

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/librustdoc/formats/renderer.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
2121
///
2222
/// For each module, we go through their items by calling for each item:
2323
///
24-
/// 1. make_child_renderer
24+
/// 1. save_module_data
2525
/// 2. item
2626
/// 3. set_back_info
2727
///
2828
/// However,the `item` method might update information in `self` (for example if the child is
2929
/// a module). To prevent it to impact the other children of the current module, we need to
3030
/// reset the information between each call to `item` by using `set_back_info`.
31-
type InfoType;
31+
type ModuleData;
3232

3333
/// Sets up any state required for the renderer. When this is called the cache has already been
3434
/// populated.
@@ -46,13 +46,13 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
4646
/// In short it goes like this:
4747
///
4848
/// ```ignore (not valid code)
49-
/// let reset_data = type.make_child_renderer();
49+
/// let reset_data = type.save_module_data();
5050
/// type.item(item)?;
5151
/// type.set_back_info(reset_data);
5252
/// ```
53-
fn make_child_renderer(&mut self) -> Self::InfoType;
53+
fn save_module_data(&mut self) -> Self::ModuleData;
5454
/// Used to reset current module's information.
55-
fn set_back_info(&mut self, info: Self::InfoType);
55+
fn set_back_info(&mut self, info: Self::ModuleData);
5656

5757
/// Renders a single non-module item. This means no recursive sub-item rendering is required.
5858
fn item(&mut self, item: clean::Item) -> Result<(), Error>;
@@ -89,7 +89,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
8989
unreachable!()
9090
};
9191
for it in module.items {
92-
let info = cx.make_child_renderer();
92+
let info = cx.save_module_data();
9393
run_format_inner(cx, it, prof)?;
9494
cx.set_back_info(info);
9595
}

src/librustdoc/html/render/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
454454
}
455455

456456
const RUN_ON_MODULE: bool = true;
457-
type InfoType = ContextInfo;
457+
type ModuleData = ContextInfo;
458458

459459
fn init(
460460
krate: clean::Crate,
@@ -594,14 +594,14 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
594594
Ok((cx, krate))
595595
}
596596

597-
fn make_child_renderer(&mut self) -> Self::InfoType {
597+
fn save_module_data(&mut self) -> Self::ModuleData {
598598
self.deref_id_map.borrow_mut().clear();
599599
self.id_map.borrow_mut().clear();
600600
self.types_with_notable_traits.borrow_mut().clear();
601601
self.info
602602
}
603603

604-
fn set_back_info(&mut self, info: Self::InfoType) {
604+
fn set_back_info(&mut self, info: Self::ModuleData) {
605605
self.info = info;
606606
}
607607

src/librustdoc/json/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
137137
}
138138

139139
const RUN_ON_MODULE: bool = false;
140-
type InfoType = ();
140+
type ModuleData = ();
141141

142142
fn init(
143143
krate: clean::Crate,
@@ -162,11 +162,11 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
162162
))
163163
}
164164

165-
fn make_child_renderer(&mut self) -> Self::InfoType {
166-
unreachable!("RUN_ON_MODULE = false should never call make_child_renderer")
165+
fn save_module_data(&mut self) -> Self::ModuleData {
166+
unreachable!("RUN_ON_MODULE = false should never call save_module_data")
167167
}
168168

169-
fn set_back_info(&mut self, _info: Self::InfoType) {
169+
fn set_back_info(&mut self, _info: Self::ModuleData) {
170170
unreachable!("RUN_ON_MODULE = false should never call set_back_info")
171171
}
172172

0 commit comments

Comments
 (0)