Skip to content

Commit 23ca02d

Browse files
committed
Remove unused RenderInfo struct
1 parent 3c785be commit 23ca02d

File tree

3 files changed

+6
-52
lines changed

3 files changed

+6
-52
lines changed

src/librustdoc/config.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use std::ffi::OsStr;
44
use std::fmt;
55
use std::path::PathBuf;
66

7-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
8-
use rustc_hir::def_id::DefId;
9-
use rustc_middle::middle::privacy::AccessLevels;
7+
use rustc_data_structures::fx::FxHashMap;
108
use rustc_session::config::{self, parse_crate_types_from_list, parse_externs, CrateType};
119
use rustc_session::config::{
1210
build_codegen_options, build_debugging_options, get_cmd_lint_options, host_triple,
@@ -268,20 +266,6 @@ crate struct RenderOptions {
268266
crate unstable_features: rustc_feature::UnstableFeatures,
269267
}
270268

271-
/// Temporary storage for data obtained during `RustdocVisitor::clean()`.
272-
/// Later on moved into `cache`.
273-
#[derive(Default, Clone)]
274-
crate struct RenderInfo {
275-
crate inlined: FxHashSet<DefId>,
276-
crate external_paths: crate::core::ExternalPaths,
277-
crate exact_paths: FxHashMap<DefId, Vec<String>>,
278-
crate access_levels: AccessLevels<DefId>,
279-
crate deref_trait_did: Option<DefId>,
280-
crate deref_mut_trait_did: Option<DefId>,
281-
crate owned_box_did: Option<DefId>,
282-
crate output_format: OutputFormat,
283-
}
284-
285269
impl Options {
286270
/// Parses the given command-line for options. If an error message or other early-return has
287271
/// been printed, returns `Err` with the exit code.

src/librustdoc/core.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ use std::{cell::RefCell, collections::hash_map::Entry};
3131
use crate::clean;
3232
use crate::clean::inline::build_external_trait;
3333
use crate::clean::{AttributesExt, MAX_DEF_IDX};
34+
use crate::config::OutputFormat;
3435
use crate::config::{Options as RustdocOptions, RenderOptions};
35-
use crate::config::{OutputFormat, RenderInfo};
3636
use crate::formats::cache::Cache;
3737
use crate::passes::{self, Condition::*, ConditionalPass};
3838

3939
crate use rustc_session::config::{DebuggingOptions, Input, Options};
4040

41-
crate type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
42-
4341
crate struct DocContext<'tcx> {
4442
crate tcx: TyCtxt<'tcx>,
4543
crate resolver: Rc<RefCell<interface::BoxedResolver>>,
@@ -501,10 +499,6 @@ crate fn run_global_ctxt(
501499
.collect(),
502500
};
503501

504-
let mut renderinfo = RenderInfo::default();
505-
renderinfo.access_levels = access_levels;
506-
renderinfo.output_format = output_format;
507-
508502
let mut ctxt = DocContext {
509503
tcx,
510504
resolver,
@@ -524,7 +518,7 @@ crate fn run_global_ctxt(
524518
.filter(|trait_def_id| tcx.trait_is_auto(*trait_def_id))
525519
.collect(),
526520
module_trait_cache: RefCell::new(FxHashMap::default()),
527-
cache: Cache::new(renderinfo, render_options.document_private),
521+
cache: Cache::new(access_levels, render_options.document_private),
528522
inlined: RefCell::new(FxHashSet::default()),
529523
output_format,
530524
render_options,

src/librustdoc/formats/cache.rs

+3-27
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rustc_span::source_map::FileName;
1010
use rustc_span::Symbol;
1111

1212
use crate::clean::{self, GetDefId};
13-
use crate::config::RenderInfo;
1413
use crate::fold::DocFolder;
1514
use crate::formats::item_type::ItemType;
1615
use crate::formats::Impl;
@@ -130,32 +129,8 @@ struct CacheBuilder<'a, 'tcx> {
130129
}
131130

132131
impl Cache {
133-
crate fn new(render_info: RenderInfo, document_private: bool) -> Self {
134-
// Crawl the crate to build various caches used for the output
135-
let RenderInfo {
136-
inlined: _,
137-
external_paths,
138-
exact_paths,
139-
access_levels,
140-
deref_trait_did,
141-
deref_mut_trait_did,
142-
owned_box_did,
143-
..
144-
} = render_info;
145-
146-
let external_paths =
147-
external_paths.into_iter().map(|(k, (v, t))| (k, (v, ItemType::from(t)))).collect();
148-
149-
Cache {
150-
external_paths,
151-
exact_paths,
152-
access_levels,
153-
document_private,
154-
deref_trait_did,
155-
deref_mut_trait_did,
156-
owned_box_did,
157-
..Cache::default()
158-
}
132+
crate fn new(access_levels: AccessLevels<DefId>, document_private: bool) -> Self {
133+
Cache { access_levels, document_private, ..Cache::default() }
159134
}
160135

161136
crate fn populate(
@@ -165,6 +140,7 @@ impl Cache {
165140
extern_html_root_urls: &BTreeMap<String, String>,
166141
dst: &Path,
167142
) -> clean::Crate {
143+
// Crawl the crate to build various caches used for the output
168144
self.crate_version = krate.version.take();
169145
debug!(?self.crate_version);
170146
self.traits = krate.external_traits.take();

0 commit comments

Comments
 (0)