use crate::core::DocContext;
mod stripper;
-crate use stripper::*;
+pub(crate) use stripper::*;
mod bare_urls;
-crate use self::bare_urls::CHECK_BARE_URLS;
+pub(crate) use self::bare_urls::CHECK_BARE_URLS;
mod strip_hidden;
-crate use self::strip_hidden::STRIP_HIDDEN;
+pub(crate) use self::strip_hidden::STRIP_HIDDEN;
mod strip_private;
-crate use self::strip_private::STRIP_PRIVATE;
+pub(crate) use self::strip_private::STRIP_PRIVATE;
mod strip_priv_imports;
-crate use self::strip_priv_imports::STRIP_PRIV_IMPORTS;
+pub(crate) use self::strip_priv_imports::STRIP_PRIV_IMPORTS;
mod propagate_doc_cfg;
-crate use self::propagate_doc_cfg::PROPAGATE_DOC_CFG;
+pub(crate) use self::propagate_doc_cfg::PROPAGATE_DOC_CFG;
-crate mod collect_intra_doc_links;
-crate use self::collect_intra_doc_links::COLLECT_INTRA_DOC_LINKS;
+pub(crate) mod collect_intra_doc_links;
+pub(crate) use self::collect_intra_doc_links::COLLECT_INTRA_DOC_LINKS;
mod check_doc_test_visibility;
-crate use self::check_doc_test_visibility::CHECK_DOC_TEST_VISIBILITY;
+pub(crate) use self::check_doc_test_visibility::CHECK_DOC_TEST_VISIBILITY;
mod collect_trait_impls;
-crate use self::collect_trait_impls::COLLECT_TRAIT_IMPLS;
+pub(crate) use self::collect_trait_impls::COLLECT_TRAIT_IMPLS;
mod check_code_block_syntax;
-crate use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX;
+pub(crate) use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX;
mod calculate_doc_coverage;
-crate use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE;
+pub(crate) use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE;
mod html_tags;
-crate use self::html_tags::CHECK_INVALID_HTML_TAGS;
+pub(crate) use self::html_tags::CHECK_INVALID_HTML_TAGS;
/// A single pass over the cleaned documentation.
///
/// Runs in the compiler context, so it has access to types and traits and the like.
#[derive(Copy, Clone)]
-crate struct Pass {
- crate name: &'static str,
- crate run: fn(clean::Crate, &mut DocContext<'_>) -> clean::Crate,
- crate description: &'static str,
+pub(crate) struct Pass {
+ pub(crate) name: &'static str,
+ pub(crate) run: fn(clean::Crate, &mut DocContext<'_>) -> clean::Crate,
+ pub(crate) description: &'static str,
}
/// In a list of passes, a pass that may or may not need to be run depending on options.
#[derive(Copy, Clone)]
-crate struct ConditionalPass {
- crate pass: Pass,
- crate condition: Condition,
+pub(crate) struct ConditionalPass {
+ pub(crate) pass: Pass,
+ pub(crate) condition: Condition,
}
/// How to decide whether to run a conditional pass.
#[derive(Copy, Clone)]
-crate enum Condition {
+pub(crate) enum Condition {
Always,
/// When `--document-private-items` is passed.
WhenDocumentPrivate,
}
/// The full list of passes.
-crate const PASSES: &[Pass] = &[
+pub(crate) const PASSES: &[Pass] = &[
CHECK_DOC_TEST_VISIBILITY,
STRIP_HIDDEN,
STRIP_PRIVATE,
];
/// The list of passes run by default.
-crate const DEFAULT_PASSES: &[ConditionalPass] = &[
+pub(crate) const DEFAULT_PASSES: &[ConditionalPass] = &[
ConditionalPass::always(COLLECT_TRAIT_IMPLS),
ConditionalPass::always(CHECK_DOC_TEST_VISIBILITY),
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
];
/// The list of default passes run when `--doc-coverage` is passed to rustdoc.
-crate const COVERAGE_PASSES: &[ConditionalPass] = &[
+pub(crate) const COVERAGE_PASSES: &[ConditionalPass] = &[
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate),
ConditionalPass::always(CALCULATE_DOC_COVERAGE),
];
impl ConditionalPass {
- crate const fn always(pass: Pass) -> Self {
+ pub(crate) const fn always(pass: Pass) -> Self {
Self::new(pass, Always)
}
- crate const fn new(pass: Pass, condition: Condition) -> Self {
+ pub(crate) const fn new(pass: Pass, condition: Condition) -> Self {
ConditionalPass { pass, condition }
}
}
/// Returns the given default set of passes.
-crate fn defaults(show_coverage: bool) -> &'static [ConditionalPass] {
+pub(crate) fn defaults(show_coverage: bool) -> &'static [ConditionalPass] {
if show_coverage { COVERAGE_PASSES } else { DEFAULT_PASSES }
}
/// Returns a span encompassing all the given attributes.
-crate fn span_of_attrs(attrs: &clean::Attributes) -> Option<Span> {
+pub(crate) fn span_of_attrs(attrs: &clean::Attributes) -> Option<Span> {
if attrs.doc_strings.is_empty() {
return None;
}
/// This method will return `None` if we cannot construct a span from the source map or if the
/// attributes are not all sugared doc comments. It's difficult to calculate the correct span in
/// that case due to escaping and other source features.
-crate fn source_span_for_markdown_range(
+pub(crate) fn source_span_for_markdown_range(
tcx: TyCtxt<'_>,
markdown: &str,
md_range: &Range<usize>,