Skip to content

Commit 334b40e

Browse files
committed
Remove unused RenderInfo struct
1 parent 991ef9a commit 334b40e

File tree

3 files changed

+6
-52
lines changed

3 files changed

+6
-52
lines changed

Diff for: 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.

Diff for: src/librustdoc/core.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ use std::{
3333

3434
use crate::clean;
3535
use crate::clean::{AttributesExt, MAX_DEF_IDX};
36+
use crate::config::OutputFormat;
3637
use crate::config::{Options as RustdocOptions, RenderOptions};
37-
use crate::config::{OutputFormat, RenderInfo};
3838
use crate::formats::cache::Cache;
3939
use crate::passes::{self, Condition::*, ConditionalPass};
4040

4141
crate use rustc_session::config::{DebuggingOptions, Input, Options};
4242

43-
crate type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
44-
4543
crate struct DocContext<'tcx> {
4644
crate tcx: TyCtxt<'tcx>,
4745
crate resolver: Rc<RefCell<interface::BoxedResolver>>,
@@ -506,10 +504,6 @@ crate fn run_global_ctxt(
506504
.collect(),
507505
};
508506

509-
let mut renderinfo = RenderInfo::default();
510-
renderinfo.access_levels = access_levels;
511-
renderinfo.output_format = output_format;
512-
513507
let mut ctxt = DocContext {
514508
tcx,
515509
resolver,
@@ -529,7 +523,7 @@ crate fn run_global_ctxt(
529523
.filter(|trait_def_id| tcx.trait_is_auto(*trait_def_id))
530524
.collect(),
531525
module_trait_cache: RefCell::new(FxHashMap::default()),
532-
cache: RefCell::new(Cache::new(renderinfo, render_options.document_private)),
526+
cache: RefCell::new(Cache::new(access_levels, render_options.document_private)),
533527
inlined: RefCell::new(FxHashSet::default()),
534528
output_format,
535529
render_options,

Diff for: 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)