diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index bd4704e8b28ed..992be651dbe08 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2907,7 +2907,7 @@ fn clean_extern_crate<'tcx>( None => false, } }) - && !cx.is_json(); + && !cx.is_json_output(); let krate_owner_def_id = krate.owner_id.def_id; if please_inline { @@ -3000,7 +3000,7 @@ fn clean_use_statement_inner<'tcx>( // forcefully don't inline if this is not public or if the // #[doc(no_inline)] attribute is present. // Don't inline doc(hidden) imports so they can be stripped at a later stage. - let mut denied = cx.is_json() + let mut denied = cx.is_json_output() || !(visibility.is_public() || (cx.render_options.document_private && is_visible_from_parent_mod)) || pub_underscore diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 274b61ae1d3c0..7ba3cfb66bd23 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -124,8 +124,8 @@ impl<'tcx> DocContext<'tcx> { /// Returns `true` if the JSON output format is enabled for generating the crate content. /// - /// If another option like `--show-coverage` is enabled, it will return false. - pub(crate) fn is_json(&self) -> bool { + /// If another option like `--show-coverage` is enabled, it will return `false`. + pub(crate) fn is_json_output(&self) -> bool { self.output_format.is_json() && !self.show_coverage } } diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index 2998289fd273a..4ef5f7f20a917 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -23,7 +23,7 @@ pub(crate) const STRIP_HIDDEN: Pass = Pass { /// Strip items marked `#[doc(hidden)]` pub(crate) fn strip_hidden(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate { let mut retained = ItemIdSet::default(); - let is_json_output = cx.is_json(); + let is_json_output = cx.is_json_output(); // strip all #[doc(hidden)] items let krate = { diff --git a/src/librustdoc/passes/strip_priv_imports.rs b/src/librustdoc/passes/strip_priv_imports.rs index 20659d5e8c69c..b9b2431f06f2b 100644 --- a/src/librustdoc/passes/strip_priv_imports.rs +++ b/src/librustdoc/passes/strip_priv_imports.rs @@ -13,7 +13,7 @@ pub(crate) const STRIP_PRIV_IMPORTS: Pass = Pass { }; pub(crate) fn strip_priv_imports(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate { - let is_json_output = cx.is_json(); + let is_json_output = cx.is_json_output(); ImportStripper { tcx: cx.tcx, is_json_output, diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs index 916c2f0657e47..1bd8a7838ec08 100644 --- a/src/librustdoc/passes/strip_private.rs +++ b/src/librustdoc/passes/strip_private.rs @@ -18,7 +18,7 @@ pub(crate) const STRIP_PRIVATE: Pass = Pass { pub(crate) fn strip_private(mut krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate { // This stripper collects all *retained* nodes. let mut retained = ItemIdSet::default(); - let is_json_output = cx.is_json(); + let is_json_output = cx.is_json_output(); // strip all private items { diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 00f5251596b60..31c33fbf49737 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -235,7 +235,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { return false; } - if self.cx.is_json() { + if self.cx.is_json_output() { return false; }