diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2022-01-21 18:41:34 -0800 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2022-01-21 18:41:50 -0800 |
| commit | fc16b815cc204b3fe7d31b9918a8fa3c17a5eef3 (patch) | |
| tree | 452c361ece7b5ea6e7d04759e0805e575c9dcec2 | |
| parent | 17d29dcdce9b9e838635eb0adefd9b8b1588410b (diff) | |
| download | rust-fc16b815cc204b3fe7d31b9918a8fa3c17a5eef3.tar.gz rust-fc16b815cc204b3fe7d31b9918a8fa3c17a5eef3.zip | |
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.
| -rw-r--r-- | src/librustdoc/clean/types.rs | 20 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 993503005d7..0c0787c6b2f 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -429,7 +429,7 @@ impl Item { /// Convenience wrapper around [`Self::from_def_id_and_parts`] which converts /// `hir_id` to a [`DefId`] - pub fn from_hir_id_and_parts( + crate fn from_hir_id_and_parts( hir_id: hir::HirId, name: Option<Symbol>, 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) } - pub fn from_def_id_and_parts( + crate fn from_def_id_and_parts( def_id: DefId, name: Option<Symbol>, 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, name: Option<Symbol>, kind: ItemKind, @@ -984,26 +984,26 @@ crate fn collapse_doc_fragments(doc_strings: &[DocFragment]) -> String { #[derive(Clone, Debug, PartialEq, Eq, Hash)] crate struct ItemLink { /// The original link written in the markdown - pub(crate) link: String, + crate link: String, /// The link text displayed in the HTML. /// /// This may not be the same as `link` if there was a disambiguator /// in an intra-doc link (e.g. \[`fn@f`\]) - pub(crate) link_text: String, - pub(crate) did: DefId, + crate link_text: String, + crate did: DefId, /// The url fragment to append to the link - pub(crate) fragment: Option<UrlFragment>, + crate fragment: Option<UrlFragment>, } pub struct RenderedLink { /// The text the link was original written as. /// /// This could potentially include disambiguators and backticks. - pub(crate) original_text: String, + crate original_text: String, /// The text to display in the HTML - pub(crate) new_text: String, + crate new_text: String, /// 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]`, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 3b926e44403..d9f6a9d02ca 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -33,8 +33,8 @@ use crate::passes::{self, Condition::*}; crate use rustc_session::config::{DebuggingOptions, Input, Options}; crate struct ResolverCaches { - pub all_traits: Option<Vec<DefId>>, - pub all_trait_impls: Option<Vec<DefId>>, + crate all_traits: Option<Vec<DefId>>, + crate all_trait_impls: Option<Vec<DefId>>, } crate struct DocContext<'tcx> { diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 8badce8226f..c3edefc4698 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -175,7 +175,7 @@ crate struct 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()) } } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 7dbf00420de..e82ab122481 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -362,7 +362,7 @@ struct DiagnosticInfo<'a> { #[derive(Clone, Debug, Hash)] struct CachedLink { - pub res: (Res, Option<UrlFragment>), + res: (Res, Option<UrlFragment>), } struct LinkCollector<'a, 'tcx> { |
