Skip to content

Commit 2b801dc

Browse files
committed
Move ExternalLocation to clean::types
It was previously defined in `render::search_index` but wasn't used at all there. `clean::types` seems like a better fit since that's where `ExternalCrate` is defined.
1 parent e19593f commit 2b801dc

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/librustdoc/clean/types.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ use crate::clean::Clean;
3838
use crate::core::DocContext;
3939
use crate::formats::cache::Cache;
4040
use crate::formats::item_type::ItemType;
41-
use crate::html::render::search_index::ExternalLocation;
4241
use crate::html::render::Context;
4342

4443
crate use self::FnRetTy::*;
@@ -337,6 +336,16 @@ impl ExternalCrate {
337336
}
338337
}
339338

339+
/// Indicates where an external crate can be found.
340+
crate enum ExternalLocation {
341+
/// Remote URL root of the external crate
342+
Remote(String),
343+
/// This external crate can be found in the local doc/ folder
344+
Local,
345+
/// The external crate could not be found.
346+
Unknown,
347+
}
348+
340349
/// Anything with a source location and set of attributes and, optionally, a
341350
/// name. That is, anything that can be documented. This doesn't correspond
342351
/// directly to the AST's concept of an item; it's a strict superset.

src/librustdoc/formats/cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use rustc_middle::middle::privacy::AccessLevels;
66
use rustc_middle::ty::TyCtxt;
77
use rustc_span::symbol::sym;
88

9-
use crate::clean::{self, ExternalCrate, ItemId, PrimitiveType};
9+
use crate::clean::{self, types::ExternalLocation, ExternalCrate, ItemId, PrimitiveType};
1010
use crate::core::DocContext;
1111
use crate::fold::DocFolder;
1212
use crate::formats::item_type::ItemType;
1313
use crate::formats::Impl;
1414
use crate::html::markdown::short_markdown_summary;
15-
use crate::html::render::search_index::{get_index_search_type, ExternalLocation};
15+
use crate::html::render::search_index::get_index_search_type;
1616
use crate::html::render::IndexItem;
1717

1818
/// This cache is used to store information about the [`clean::Crate`] being

src/librustdoc/html/format.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ use rustc_middle::ty::TyCtxt;
2121
use rustc_span::def_id::CRATE_DEF_INDEX;
2222
use rustc_target::spec::abi::Abi;
2323

24-
use crate::clean::{self, utils::find_nearest_parent_module, ExternalCrate, ItemId, PrimitiveType};
24+
use crate::clean::{
25+
self, types::ExternalLocation, utils::find_nearest_parent_module, ExternalCrate, ItemId,
26+
PrimitiveType,
27+
};
2528
use crate::formats::item_type::ItemType;
2629
use crate::html::escape::Escape;
27-
use crate::html::render::search_index::ExternalLocation;
2830
use crate::html::render::Context;
2931

3032
use super::url_parts_builder::UrlPartsBuilder;

src/librustdoc/html/render/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ use rustc_span::source_map::FileName;
1414
use rustc_span::symbol::sym;
1515

1616
use super::print_item::{full_path, item_path, print_item};
17-
use super::search_index::{build_index, ExternalLocation};
17+
use super::search_index::build_index;
1818
use super::templates;
1919
use super::write_shared::write_shared;
2020
use super::{
2121
collect_spans_and_sources, print_sidebar, settings, AllTypes, LinkFromSrc, NameDoc, StylePath,
2222
BASIC_KEYWORDS,
2323
};
2424

25-
use crate::clean::{self, ExternalCrate};
25+
use crate::clean::{self, types::ExternalLocation, ExternalCrate};
2626
use crate::config::RenderOptions;
2727
use crate::docfs::{DocFS, PathError};
2828
use crate::error::Error;

src/librustdoc/html/render/search_index.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ use crate::formats::item_type::ItemType;
1313
use crate::html::markdown::short_markdown_summary;
1414
use crate::html::render::{IndexItem, IndexItemFunctionType, RenderType, TypeWithKind};
1515

16-
/// Indicates where an external crate can be found.
17-
crate enum ExternalLocation {
18-
/// Remote URL root of the external crate
19-
Remote(String),
20-
/// This external crate can be found in the local doc/ folder
21-
Local,
22-
/// The external crate could not be found.
23-
Unknown,
24-
}
25-
2616
/// Builds the search index from the collected metadata
2717
crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<'tcx>) -> String {
2818
let mut defid_to_pathid = FxHashMap::default();

src/librustdoc/json/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ use rustc_session::Session;
1919
use rustdoc_json_types as types;
2020

2121
use crate::clean;
22-
use crate::clean::ExternalCrate;
22+
use crate::clean::types::{ExternalCrate, ExternalLocation};
2323
use crate::config::RenderOptions;
2424
use crate::error::Error;
2525
use crate::formats::cache::Cache;
2626
use crate::formats::FormatRenderer;
27-
use crate::html::render::search_index::ExternalLocation;
2827
use crate::json::conversions::{from_item_id, IntoWithTcx};
2928

3029
#[derive(Clone)]

0 commit comments

Comments
 (0)