1
Fork 0

rustdoc: Make some pub items crate-private

They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.
This commit is contained in:
Noah Lev 2022-01-21 18:41:34 -08:00
parent 17d29dcdce
commit fc16b815cc
4 changed files with 14 additions and 14 deletions

View file

@ -429,7 +429,7 @@ impl Item {
/// Convenience wrapper around [`Self::from_def_id_and_parts`] which converts /// Convenience wrapper around [`Self::from_def_id_and_parts`] which converts
/// `hir_id` to a [`DefId`] /// `hir_id` to a [`DefId`]
pub fn from_hir_id_and_parts( crate fn from_hir_id_and_parts(
hir_id: hir::HirId, hir_id: hir::HirId,
name: Option<Symbol>, name: Option<Symbol>,
kind: ItemKind, kind: ItemKind,
@ -438,7 +438,7 @@ impl Item {
Item::from_def_id_and_parts(cx.tcx.hir().local_def_id(hir_id).to_def_id(), name, kind, cx) Item::from_def_id_and_parts(cx.tcx.hir().local_def_id(hir_id).to_def_id(), name, kind, cx)
} }
pub fn from_def_id_and_parts( crate fn from_def_id_and_parts(
def_id: DefId, def_id: DefId,
name: Option<Symbol>, name: Option<Symbol>,
kind: ItemKind, kind: ItemKind,
@ -456,7 +456,7 @@ impl Item {
) )
} }
pub fn from_def_id_and_attrs_and_parts( crate fn from_def_id_and_attrs_and_parts(
def_id: DefId, def_id: DefId,
name: Option<Symbol>, name: Option<Symbol>,
kind: ItemKind, kind: ItemKind,
@ -984,26 +984,26 @@ crate fn collapse_doc_fragments(doc_strings: &[DocFragment]) -> String {
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
crate struct ItemLink { crate struct ItemLink {
/// The original link written in the markdown /// The original link written in the markdown
pub(crate) link: String, crate link: String,
/// The link text displayed in the HTML. /// The link text displayed in the HTML.
/// ///
/// This may not be the same as `link` if there was a disambiguator /// This may not be the same as `link` if there was a disambiguator
/// in an intra-doc link (e.g. \[`fn@f`\]) /// in an intra-doc link (e.g. \[`fn@f`\])
pub(crate) link_text: String, crate link_text: String,
pub(crate) did: DefId, crate did: DefId,
/// The url fragment to append to the link /// The url fragment to append to the link
pub(crate) fragment: Option<UrlFragment>, crate fragment: Option<UrlFragment>,
} }
pub struct RenderedLink { pub struct RenderedLink {
/// The text the link was original written as. /// The text the link was original written as.
/// ///
/// This could potentially include disambiguators and backticks. /// This could potentially include disambiguators and backticks.
pub(crate) original_text: String, crate original_text: String,
/// The text to display in the HTML /// The text to display in the HTML
pub(crate) new_text: String, crate new_text: String,
/// The URL to put in the `href` /// The URL to put in the `href`
pub(crate) href: String, crate href: String,
} }
/// The attributes on an [`Item`], including attributes like `#[derive(...)]` and `#[inline]`, /// The attributes on an [`Item`], including attributes like `#[derive(...)]` and `#[inline]`,

View file

@ -33,8 +33,8 @@ use crate::passes::{self, Condition::*};
crate use rustc_session::config::{DebuggingOptions, Input, Options}; crate use rustc_session::config::{DebuggingOptions, Input, Options};
crate struct ResolverCaches { crate struct ResolverCaches {
pub all_traits: Option<Vec<DefId>>, crate all_traits: Option<Vec<DefId>>,
pub all_trait_impls: Option<Vec<DefId>>, crate all_trait_impls: Option<Vec<DefId>>,
} }
crate struct DocContext<'tcx> { crate struct DocContext<'tcx> {

View file

@ -175,7 +175,7 @@ crate struct StylePath {
} }
impl StylePath { impl StylePath {
pub fn basename(&self) -> Result<String, Error> { crate fn basename(&self) -> Result<String, Error> {
Ok(try_none!(try_none!(self.path.file_stem(), &self.path).to_str(), &self.path).to_string()) Ok(try_none!(try_none!(self.path.file_stem(), &self.path).to_str(), &self.path).to_string())
} }
} }

View file

@ -362,7 +362,7 @@ struct DiagnosticInfo<'a> {
#[derive(Clone, Debug, Hash)] #[derive(Clone, Debug, Hash)]
struct CachedLink { struct CachedLink {
pub res: (Res, Option<UrlFragment>), res: (Res, Option<UrlFragment>),
} }
struct LinkCollector<'a, 'tcx> { struct LinkCollector<'a, 'tcx> {