Skip to content

Commit 341866a

Browse files
committed
rustdoc: IndexItem::{stability -> is_unstable}
1 parent 1140e90 commit 341866a

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/librustdoc/formats/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
586586
search_type,
587587
aliases,
588588
deprecation,
589-
stability: item.stability(tcx),
589+
is_unstable: item.stability(tcx).map(|x| x.is_unstable()).unwrap_or(false),
590590
};
591591
cache.search_index.push(index_item);
592592
}

src/librustdoc/html/render/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ use std::{fs, str};
5050
use askama::Template;
5151
use itertools::Either;
5252
use rustc_attr_data_structures::{
53-
ConstStability, DeprecatedSince, Deprecation, RustcVersion, Stability, StabilityLevel,
54-
StableSince,
53+
ConstStability, DeprecatedSince, Deprecation, RustcVersion, StabilityLevel, StableSince,
5554
};
5655
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
5756
use rustc_hir::Mutability;
@@ -141,12 +140,7 @@ pub(crate) struct IndexItem {
141140
pub(crate) search_type: Option<IndexItemFunctionType>,
142141
pub(crate) aliases: Box<[Symbol]>,
143142
pub(crate) deprecation: Option<Deprecation>,
144-
pub(crate) stability: Option<Stability>,
145-
}
146-
impl IndexItem {
147-
fn is_unstable(&self) -> bool {
148-
matches!(&self.stability, Some(Stability { level: StabilityLevel::Unstable { .. }, .. }))
149-
}
143+
pub(crate) is_unstable: bool,
150144
}
151145

152146
/// A type used for the search index.

src/librustdoc/html/render/search_index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub(crate) fn build_index(
9393
),
9494
aliases: item.attrs.get_doc_aliases(),
9595
deprecation: item.deprecation(tcx),
96-
stability: item.stability(tcx),
96+
is_unstable: item.stability(tcx).map(|x| x.is_unstable()).unwrap_or(false),
9797
});
9898
}
9999
}
@@ -700,7 +700,7 @@ pub(crate) fn build_index(
700700
// bitmasks always use 1-indexing for items, with 0 as the crate itself
701701
deprecated.push(u32::try_from(index + 1).unwrap());
702702
}
703-
if item.is_unstable() {
703+
if item.is_unstable {
704704
unstable.push(u32::try_from(index + 1).unwrap());
705705
}
706706
}

0 commit comments

Comments
 (0)