Skip to content

Commit 6970246

Browse files
committed
Remove crate visibility modifier in libs, tests
1 parent 49c82f3 commit 6970246

File tree

85 files changed

+1037
-1252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1037
-1252
lines changed

src/librustdoc/clean/auto_trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ struct RegionDeps<'tcx> {
2020
smaller: FxHashSet<RegionTarget<'tcx>>,
2121
}
2222

23-
crate struct AutoTraitFinder<'a, 'tcx> {
24-
crate cx: &'a mut core::DocContext<'tcx>,
23+
pub(crate) struct AutoTraitFinder<'a, 'tcx> {
24+
pub(crate) cx: &'a mut core::DocContext<'tcx>,
2525
}
2626

2727
impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
28-
crate fn new(cx: &'a mut core::DocContext<'tcx>) -> Self {
28+
pub(crate) fn new(cx: &'a mut core::DocContext<'tcx>) -> Self {
2929
AutoTraitFinder { cx }
3030
}
3131

@@ -130,7 +130,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
130130
})
131131
}
132132

133-
crate fn get_auto_trait_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
133+
pub(crate) fn get_auto_trait_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
134134
let tcx = self.cx.tcx;
135135
let param_env = tcx.param_env(item_def_id);
136136
let ty = tcx.type_of(item_def_id);

src/librustdoc/clean/blanket_impl.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ use rustc_span::DUMMY_SP;
88

99
use super::*;
1010

11-
crate struct BlanketImplFinder<'a, 'tcx> {
12-
crate cx: &'a mut core::DocContext<'tcx>,
11+
pub(crate) struct BlanketImplFinder<'a, 'tcx> {
12+
pub(crate) cx: &'a mut core::DocContext<'tcx>,
1313
}
1414

1515
impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
16-
crate fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
16+
pub(crate) fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
1717
let param_env = self.cx.tcx.param_env(item_def_id);
1818
let ty = self.cx.tcx.bound_type_of(item_def_id);
1919

src/librustdoc/clean/cfg.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::html::escape::Escape;
2121
mod tests;
2222

2323
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
24-
crate enum Cfg {
24+
pub(crate) enum Cfg {
2525
/// Accepts all configurations.
2626
True,
2727
/// Denies all configurations.
@@ -37,9 +37,9 @@ crate enum Cfg {
3737
}
3838

3939
#[derive(PartialEq, Debug)]
40-
crate struct InvalidCfgError {
41-
crate msg: &'static str,
42-
crate span: Span,
40+
pub(crate) struct InvalidCfgError {
41+
pub(crate) msg: &'static str,
42+
pub(crate) span: Span,
4343
}
4444

4545
impl Cfg {
@@ -56,7 +56,7 @@ impl Cfg {
5656
}
5757
}
5858

59-
crate fn parse_without(
59+
pub(crate) fn parse_without(
6060
cfg: &MetaItem,
6161
exclude: &FxHashSet<Cfg>,
6262
) -> Result<Option<Cfg>, InvalidCfgError> {
@@ -117,15 +117,15 @@ impl Cfg {
117117
///
118118
/// If the content is not properly formatted, it will return an error indicating what and where
119119
/// the error is.
120-
crate fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> {
120+
pub(crate) fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> {
121121
Self::parse_without(cfg, &FxHashSet::default()).map(|ret| ret.unwrap())
122122
}
123123

124124
/// Checks whether the given configuration can be matched in the current session.
125125
///
126126
/// Equivalent to `attr::cfg_matches`.
127127
// FIXME: Actually make use of `features`.
128-
crate fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool {
128+
pub(crate) fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool {
129129
match *self {
130130
Cfg::False => false,
131131
Cfg::True => true,

src/librustdoc/clean/inline.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Attrs<'hir> = &'hir [ast::Attribute];
3838
/// and `Some` of a vector of items if it was successfully expanded.
3939
///
4040
/// `parent_module` refers to the parent of the *re-export*, not the original item.
41-
crate fn try_inline(
41+
pub(crate) fn try_inline(
4242
cx: &mut DocContext<'_>,
4343
parent_module: DefId,
4444
import_def_id: Option<DefId>,
@@ -134,7 +134,7 @@ crate fn try_inline(
134134
Some(ret)
135135
}
136136

137-
crate fn try_inline_glob(
137+
pub(crate) fn try_inline_glob(
138138
cx: &mut DocContext<'_>,
139139
res: Res,
140140
visited: &mut FxHashSet<DefId>,
@@ -154,15 +154,15 @@ crate fn try_inline_glob(
154154
}
155155
}
156156

157-
crate fn load_attrs<'hir>(cx: &DocContext<'hir>, did: DefId) -> Attrs<'hir> {
157+
pub(crate) fn load_attrs<'hir>(cx: &DocContext<'hir>, did: DefId) -> Attrs<'hir> {
158158
cx.tcx.get_attrs_unchecked(did)
159159
}
160160

161161
/// Record an external fully qualified name in the external_paths cache.
162162
///
163163
/// These names are used later on by HTML rendering to generate things like
164164
/// source links back to the original item.
165-
crate fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType) {
165+
pub(crate) fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType) {
166166
let crate_name = cx.tcx.crate_name(did.krate);
167167

168168
let relative =
@@ -190,7 +190,7 @@ crate fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType)
190190
}
191191
}
192192

193-
crate fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean::Trait {
193+
pub(crate) fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean::Trait {
194194
let trait_items = cx
195195
.tcx
196196
.associated_items(did)
@@ -274,7 +274,7 @@ fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> clean::Typedef {
274274
}
275275

276276
/// Builds all inherent implementations of an ADT (struct/union/enum) or Trait item/path/reexport.
277-
crate fn build_impls(
277+
pub(crate) fn build_impls(
278278
cx: &mut DocContext<'_>,
279279
parent_module: Option<DefId>,
280280
did: DefId,
@@ -318,7 +318,7 @@ fn merge_attrs(
318318
}
319319

320320
/// Inline an `impl`, inherent or of a trait. The `did` must be for an `impl`.
321-
crate fn build_impl(
321+
pub(crate) fn build_impl(
322322
cx: &mut DocContext<'_>,
323323
parent_module: Option<DefId>,
324324
did: DefId,
@@ -565,7 +565,7 @@ fn build_module(
565565
clean::Module { items, span }
566566
}
567567

568-
crate fn print_inlined_const(tcx: TyCtxt<'_>, did: DefId) -> String {
568+
pub(crate) fn print_inlined_const(tcx: TyCtxt<'_>, did: DefId) -> String {
569569
if let Some(did) = did.as_local() {
570570
let hir_id = tcx.hir().local_def_id_to_hir_id(did);
571571
rustc_hir_pretty::id_to_string(&tcx.hir(), hir_id)
@@ -670,7 +670,7 @@ fn separate_supertrait_bounds(
670670
(g, ty_bounds)
671671
}
672672

673-
crate fn record_extern_trait(cx: &mut DocContext<'_>, did: DefId) {
673+
pub(crate) fn record_extern_trait(cx: &mut DocContext<'_>, did: DefId) {
674674
if did.is_local() {
675675
return;
676676
}

src/librustdoc/clean/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
44
mod auto_trait;
55
mod blanket_impl;
6-
crate mod cfg;
7-
crate mod inline;
6+
pub(crate) mod cfg;
7+
pub(crate) mod inline;
88
mod render_macro_matchers;
99
mod simplify;
10-
crate mod types;
11-
crate mod utils;
10+
pub(crate) mod types;
11+
pub(crate) mod utils;
1212

1313
use rustc_ast as ast;
1414
use rustc_attr as attr;
@@ -41,10 +41,10 @@ use crate::visit_ast::Module as DocModule;
4141

4242
use utils::*;
4343

44-
crate use self::types::*;
45-
crate use self::utils::{get_auto_trait_and_blanket_impls, krate, register_res};
44+
pub(crate) use self::types::*;
45+
pub(crate) use self::utils::{get_auto_trait_and_blanket_impls, krate, register_res};
4646

47-
crate trait Clean<T> {
47+
pub(crate) trait Clean<T> {
4848
fn clean(&self, cx: &mut DocContext<'_>) -> T;
4949
}
5050

src/librustdoc/clean/simplify.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::clean::GenericArgs as PP;
2121
use crate::clean::WherePredicate as WP;
2222
use crate::core::DocContext;
2323

24-
crate fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
24+
pub(crate) fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
2525
// First, partition the where clause into its separate components.
2626
//
2727
// We use `FxIndexMap` so that the insertion order is preserved to prevent messing up to
@@ -79,7 +79,7 @@ crate fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
7979
clauses
8080
}
8181

82-
crate fn merge_bounds(
82+
pub(crate) fn merge_bounds(
8383
cx: &clean::DocContext<'_>,
8484
bounds: &mut Vec<clean::GenericBound>,
8585
trait_did: DefId,

0 commit comments

Comments
 (0)