Make all rustdoc functions and structs crate-private
This gives warnings about dead code.
This commit is contained in:
parent
5fab31e5dd
commit
d6c16e4253
51 changed files with 927 additions and 927 deletions
|
@ -25,7 +25,7 @@
|
|||
//! These threads are not parallelized (they haven't been a bottleneck yet), and
|
||||
//! both occur before the crate is rendered.
|
||||
|
||||
pub mod cache;
|
||||
crate mod cache;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
@ -82,7 +82,7 @@ use crate::html::{highlight, layout, static_files};
|
|||
use cache::{build_index, ExternalLocation};
|
||||
|
||||
/// A pair of name and its optional document.
|
||||
pub type NameDoc = (String, Option<String>);
|
||||
crate type NameDoc = (String, Option<String>);
|
||||
|
||||
crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
|
||||
crate::html::format::display_fn(move |f| {
|
||||
|
@ -101,60 +101,60 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
|
|||
crate struct Context {
|
||||
/// Current hierarchy of components leading down to what's currently being
|
||||
/// rendered
|
||||
pub current: Vec<String>,
|
||||
crate current: Vec<String>,
|
||||
/// The current destination folder of where HTML artifacts should be placed.
|
||||
/// This changes as the context descends into the module hierarchy.
|
||||
pub dst: PathBuf,
|
||||
crate dst: PathBuf,
|
||||
/// A flag, which when `true`, will render pages which redirect to the
|
||||
/// real location of an item. This is used to allow external links to
|
||||
/// publicly reused items to redirect to the right location.
|
||||
pub render_redirect_pages: bool,
|
||||
crate render_redirect_pages: bool,
|
||||
/// The map used to ensure all generated 'id=' attributes are unique.
|
||||
id_map: Rc<RefCell<IdMap>>,
|
||||
pub shared: Arc<SharedContext>,
|
||||
crate shared: Arc<SharedContext>,
|
||||
all: Rc<RefCell<AllTypes>>,
|
||||
/// Storage for the errors produced while generating documentation so they
|
||||
/// can be printed together at the end.
|
||||
pub errors: Rc<Receiver<String>>,
|
||||
crate errors: Rc<Receiver<String>>,
|
||||
}
|
||||
|
||||
crate struct SharedContext {
|
||||
/// The path to the crate root source minus the file name.
|
||||
/// Used for simplifying paths to the highlighted source code files.
|
||||
pub src_root: PathBuf,
|
||||
crate src_root: PathBuf,
|
||||
/// This describes the layout of each page, and is not modified after
|
||||
/// creation of the context (contains info like the favicon and added html).
|
||||
pub layout: layout::Layout,
|
||||
crate layout: layout::Layout,
|
||||
/// This flag indicates whether `[src]` links should be generated or not. If
|
||||
/// the source files are present in the html rendering, then this will be
|
||||
/// `true`.
|
||||
pub include_sources: bool,
|
||||
crate include_sources: bool,
|
||||
/// The local file sources we've emitted and their respective url-paths.
|
||||
pub local_sources: FxHashMap<PathBuf, String>,
|
||||
crate local_sources: FxHashMap<PathBuf, String>,
|
||||
/// Whether the collapsed pass ran
|
||||
pub collapsed: bool,
|
||||
crate collapsed: bool,
|
||||
/// The base-URL of the issue tracker for when an item has been tagged with
|
||||
/// an issue number.
|
||||
pub issue_tracker_base_url: Option<String>,
|
||||
crate issue_tracker_base_url: Option<String>,
|
||||
/// The directories that have already been created in this doc run. Used to reduce the number
|
||||
/// of spurious `create_dir_all` calls.
|
||||
pub created_dirs: RefCell<FxHashSet<PathBuf>>,
|
||||
crate created_dirs: RefCell<FxHashSet<PathBuf>>,
|
||||
/// This flag indicates whether listings of modules (in the side bar and documentation itself)
|
||||
/// should be ordered alphabetically or in order of appearance (in the source code).
|
||||
pub sort_modules_alphabetically: bool,
|
||||
crate sort_modules_alphabetically: bool,
|
||||
/// Additional CSS files to be added to the generated docs.
|
||||
pub style_files: Vec<StylePath>,
|
||||
crate style_files: Vec<StylePath>,
|
||||
/// Suffix to be added on resource files (if suffix is "-v2" then "light.css" becomes
|
||||
/// "light-v2.css").
|
||||
pub resource_suffix: String,
|
||||
crate resource_suffix: String,
|
||||
/// Optional path string to be used to load static files on output pages. If not set, uses
|
||||
/// combinations of `../` to reach the documentation root.
|
||||
pub static_root_path: Option<String>,
|
||||
crate static_root_path: Option<String>,
|
||||
/// The fs handle we are working with.
|
||||
pub fs: DocFS,
|
||||
crate fs: DocFS,
|
||||
/// The default edition used to parse doctests.
|
||||
pub edition: Edition,
|
||||
pub codes: ErrorCodes,
|
||||
crate edition: Edition,
|
||||
crate codes: ErrorCodes,
|
||||
playground: Option<markdown::Playground>,
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ impl SharedContext {
|
|||
|
||||
/// Based on whether the `collapse-docs` pass was run, return either the `doc_value` or the
|
||||
/// `collapsed_doc_value` of the given item.
|
||||
pub fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<Cow<'a, str>> {
|
||||
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<Cow<'a, str>> {
|
||||
if self.collapsed {
|
||||
item.collapsed_doc_value().map(|s| s.into())
|
||||
} else {
|
||||
|
@ -201,14 +201,14 @@ impl SharedContext {
|
|||
/// Struct representing one entry in the JS search index. These are all emitted
|
||||
/// by hand to a large JS file at the end of cache-creation.
|
||||
#[derive(Debug)]
|
||||
pub struct IndexItem {
|
||||
pub ty: ItemType,
|
||||
pub name: String,
|
||||
pub path: String,
|
||||
pub desc: String,
|
||||
pub parent: Option<DefId>,
|
||||
pub parent_idx: Option<usize>,
|
||||
pub search_type: Option<IndexItemFunctionType>,
|
||||
crate struct IndexItem {
|
||||
crate ty: ItemType,
|
||||
crate name: String,
|
||||
crate path: String,
|
||||
crate desc: String,
|
||||
crate parent: Option<DefId>,
|
||||
crate parent_idx: Option<usize>,
|
||||
crate search_type: Option<IndexItemFunctionType>,
|
||||
}
|
||||
|
||||
impl Serialize for IndexItem {
|
||||
|
@ -282,7 +282,7 @@ impl Serialize for Generic {
|
|||
|
||||
/// Full type of functions/methods in the search index.
|
||||
#[derive(Debug)]
|
||||
pub struct IndexItemFunctionType {
|
||||
crate struct IndexItemFunctionType {
|
||||
inputs: Vec<TypeWithKind>,
|
||||
output: Option<Vec<TypeWithKind>>,
|
||||
}
|
||||
|
@ -340,16 +340,16 @@ impl Serialize for TypeWithKind {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct StylePath {
|
||||
crate struct StylePath {
|
||||
/// The path to the theme
|
||||
pub path: PathBuf,
|
||||
crate path: PathBuf,
|
||||
/// What the `disabled` attribute should be set to in the HTML tag
|
||||
pub disabled: bool,
|
||||
crate disabled: bool,
|
||||
}
|
||||
|
||||
thread_local!(pub static CURRENT_DEPTH: Cell<usize> = Cell::new(0));
|
||||
thread_local!(crate static CURRENT_DEPTH: Cell<usize> = Cell::new(0));
|
||||
|
||||
pub fn initial_ids() -> Vec<String> {
|
||||
crate fn initial_ids() -> Vec<String> {
|
||||
[
|
||||
"main",
|
||||
"search",
|
||||
|
@ -1701,7 +1701,7 @@ fn print_item(cx: &Context, item: &clean::Item, buf: &mut Buffer, cache: &Cache)
|
|||
|
||||
// Write `src` tag
|
||||
//
|
||||
// When this item is part of a `pub use` in a downstream crate, the
|
||||
// When this item is part of a `crate use` in a downstream crate, the
|
||||
// [src] link in the downstream documentation will actually come back to
|
||||
// this page, and this link will be auto-clicked. The `id` attribute is
|
||||
// used to find the link to auto-click.
|
||||
|
@ -1994,7 +1994,7 @@ fn document_non_exhaustive(w: &mut Buffer, item: &clean::Item) {
|
|||
}
|
||||
|
||||
/// Compare two strings treating multi-digit numbers as single units (i.e. natural sort order).
|
||||
pub fn compare_names(mut lhs: &str, mut rhs: &str) -> Ordering {
|
||||
crate fn compare_names(mut lhs: &str, mut rhs: &str) -> Ordering {
|
||||
/// Takes a non-numeric and a numeric part from the given &str.
|
||||
fn take_parts<'a>(s: &mut &'a str) -> (&'a str, &'a str) {
|
||||
let i = s.find(|c: char| c.is_ascii_digit());
|
||||
|
@ -2081,14 +2081,14 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
|
|||
// This call is to remove re-export duplicates in cases such as:
|
||||
//
|
||||
// ```
|
||||
// pub mod foo {
|
||||
// pub mod bar {
|
||||
// pub trait Double { fn foo(); }
|
||||
// crate mod foo {
|
||||
// crate mod bar {
|
||||
// crate trait Double { fn foo(); }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// pub use foo::bar::*;
|
||||
// pub use foo::*;
|
||||
// crate use foo::bar::*;
|
||||
// crate use foo::*;
|
||||
// ```
|
||||
//
|
||||
// `Double` will appear twice in the generated docs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue