Rename DocContext::is_json into DocContext::is_json_output

This commit is contained in:
Guillaume Gomez 2024-11-04 17:15:28 +01:00
parent 0eff07ee4e
commit 5dfbc0383d
6 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -124,8 +124,8 @@ pub(crate) fn as_local_hir_id(tcx: TyCtxt<'_>, item_id: ItemId) -> Option<HirId>
/// 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
}
}

View File

@ -23,7 +23,7 @@
/// 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 = {

View File

@ -13,7 +13,7 @@
};
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,

View File

@ -18,7 +18,7 @@
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
{

View File

@ -235,7 +235,7 @@ fn maybe_inline_local(
return false;
}
if self.cx.is_json() {
if self.cx.is_json_output() {
return false;
}