Skip to content

Commit 163b01a

Browse files
committed
Remove unused RenderInfo struct
1 parent 4d7a648 commit 163b01a

File tree

3 files changed

+6
-53
lines changed

3 files changed

+6
-53
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-9
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@ 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, TraitWithExtraInfo, MAX_DEF_IDX};
34-
use crate::config::{Options as RustdocOptions, RenderOptions};
35-
use crate::config::{OutputFormat, RenderInfo};
34+
use crate::config::{Options as RustdocOptions, OutputFormat, RenderOptions};
3635
use crate::formats::cache::Cache;
3736
use crate::passes::{self, Condition::*, ConditionalPass};
3837

3938
crate use rustc_session::config::{DebuggingOptions, Input, Options};
4039

41-
crate type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
42-
4340
crate struct DocContext<'tcx> {
4441
crate tcx: TyCtxt<'tcx>,
4542
/// Name resolver. Used for intra-doc links.
@@ -506,10 +503,6 @@ crate fn run_global_ctxt(
506503
.collect(),
507504
};
508505

509-
let mut renderinfo = RenderInfo::default();
510-
renderinfo.access_levels = access_levels;
511-
renderinfo.output_format = output_format;
512-
513506
let mut ctxt = DocContext {
514507
tcx,
515508
resolver,
@@ -529,7 +522,7 @@ crate fn run_global_ctxt(
529522
.filter(|trait_def_id| tcx.trait_is_auto(*trait_def_id))
530523
.collect(),
531524
module_trait_cache: RefCell::new(FxHashMap::default()),
532-
cache: Cache::new(renderinfo, render_options.document_private),
525+
cache: Cache::new(access_levels, render_options.document_private),
533526
inlined: FxHashSet::default(),
534527
output_format,
535528
render_options,

src/librustdoc/formats/cache.rs

+3-27
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_span::symbol::sym;
1111
use rustc_span::Symbol;
1212

1313
use crate::clean::{self, GetDefId};
14-
use crate::config::RenderInfo;
1514
use crate::fold::DocFolder;
1615
use crate::formats::item_type::ItemType;
1716
use crate::formats::Impl;
@@ -131,32 +130,8 @@ struct CacheBuilder<'a, 'tcx> {
131130
}
132131

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

162137
/// Populates the `Cache` with more data. The returned `Crate` will be missing some data that was
@@ -168,6 +143,7 @@ impl Cache {
168143
extern_html_root_urls: &BTreeMap<String, String>,
169144
dst: &Path,
170145
) -> clean::Crate {
146+
// Crawl the crate to build various caches used for the output
171147
self.crate_version = krate.version.take();
172148
debug!(?self.crate_version);
173149
self.traits = krate.external_traits.take();

0 commit comments

Comments
 (0)