Skip to content

Commit fc16b81

Browse files
committed
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.
1 parent 17d29dc commit fc16b81

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/librustdoc/clean/types.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl Item {
429429

430430
/// Convenience wrapper around [`Self::from_def_id_and_parts`] which converts
431431
/// `hir_id` to a [`DefId`]
432-
pub fn from_hir_id_and_parts(
432+
crate fn from_hir_id_and_parts(
433433
hir_id: hir::HirId,
434434
name: Option<Symbol>,
435435
kind: ItemKind,
@@ -438,7 +438,7 @@ impl Item {
438438
Item::from_def_id_and_parts(cx.tcx.hir().local_def_id(hir_id).to_def_id(), name, kind, cx)
439439
}
440440

441-
pub fn from_def_id_and_parts(
441+
crate fn from_def_id_and_parts(
442442
def_id: DefId,
443443
name: Option<Symbol>,
444444
kind: ItemKind,
@@ -456,7 +456,7 @@ impl Item {
456456
)
457457
}
458458

459-
pub fn from_def_id_and_attrs_and_parts(
459+
crate fn from_def_id_and_attrs_and_parts(
460460
def_id: DefId,
461461
name: Option<Symbol>,
462462
kind: ItemKind,
@@ -984,26 +984,26 @@ crate fn collapse_doc_fragments(doc_strings: &[DocFragment]) -> String {
984984
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
985985
crate struct ItemLink {
986986
/// The original link written in the markdown
987-
pub(crate) link: String,
987+
crate link: String,
988988
/// The link text displayed in the HTML.
989989
///
990990
/// This may not be the same as `link` if there was a disambiguator
991991
/// in an intra-doc link (e.g. \[`fn@f`\])
992-
pub(crate) link_text: String,
993-
pub(crate) did: DefId,
992+
crate link_text: String,
993+
crate did: DefId,
994994
/// The url fragment to append to the link
995-
pub(crate) fragment: Option<UrlFragment>,
995+
crate fragment: Option<UrlFragment>,
996996
}
997997

998998
pub struct RenderedLink {
999999
/// The text the link was original written as.
10001000
///
10011001
/// This could potentially include disambiguators and backticks.
1002-
pub(crate) original_text: String,
1002+
crate original_text: String,
10031003
/// The text to display in the HTML
1004-
pub(crate) new_text: String,
1004+
crate new_text: String,
10051005
/// The URL to put in the `href`
1006-
pub(crate) href: String,
1006+
crate href: String,
10071007
}
10081008

10091009
/// The attributes on an [`Item`], including attributes like `#[derive(...)]` and `#[inline]`,

src/librustdoc/core.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ use crate::passes::{self, Condition::*};
3333
crate use rustc_session::config::{DebuggingOptions, Input, Options};
3434

3535
crate struct ResolverCaches {
36-
pub all_traits: Option<Vec<DefId>>,
37-
pub all_trait_impls: Option<Vec<DefId>>,
36+
crate all_traits: Option<Vec<DefId>>,
37+
crate all_trait_impls: Option<Vec<DefId>>,
3838
}
3939

4040
crate struct DocContext<'tcx> {

src/librustdoc/html/render/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ crate struct StylePath {
175175
}
176176

177177
impl StylePath {
178-
pub fn basename(&self) -> Result<String, Error> {
178+
crate fn basename(&self) -> Result<String, Error> {
179179
Ok(try_none!(try_none!(self.path.file_stem(), &self.path).to_str(), &self.path).to_string())
180180
}
181181
}

src/librustdoc/passes/collect_intra_doc_links.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ struct DiagnosticInfo<'a> {
362362

363363
#[derive(Clone, Debug, Hash)]
364364
struct CachedLink {
365-
pub res: (Res, Option<UrlFragment>),
365+
res: (Res, Option<UrlFragment>),
366366
}
367367

368368
struct LinkCollector<'a, 'tcx> {

0 commit comments

Comments
 (0)