Skip to content

Commit a8a913d

Browse files
committed
rustdoc: Rename Item::attributes param to is_json
This makes it clearer what it's actually used for, and makes it easier to think about modifying `Item::attributes`.
1 parent 2ff2815 commit a8a913d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/librustdoc/clean/types.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -756,12 +756,7 @@ impl Item {
756756
Some(tcx.visibility(def_id))
757757
}
758758

759-
pub(crate) fn attributes(
760-
&self,
761-
tcx: TyCtxt<'_>,
762-
cache: &Cache,
763-
keep_as_is: bool,
764-
) -> Vec<String> {
759+
pub(crate) fn attributes(&self, tcx: TyCtxt<'_>, cache: &Cache, is_json: bool) -> Vec<String> {
765760
const ALLOWED_ATTRIBUTES: &[Symbol] =
766761
&[sym::export_name, sym::link_section, sym::no_mangle, sym::non_exhaustive];
767762

@@ -772,7 +767,7 @@ impl Item {
772767
.other_attrs
773768
.iter()
774769
.filter_map(|attr| {
775-
if keep_as_is {
770+
if is_json {
776771
Some(rustc_hir_pretty::attribute_to_string(&tcx, attr))
777772
} else if ALLOWED_ATTRIBUTES.contains(&attr.name_or_empty()) {
778773
Some(
@@ -786,7 +781,8 @@ impl Item {
786781
}
787782
})
788783
.collect();
789-
if !keep_as_is
784+
785+
if !is_json
790786
&& let Some(def_id) = self.def_id()
791787
&& let ItemType::Struct | ItemType::Enum | ItemType::Union = self.type_()
792788
{

0 commit comments

Comments
 (0)