Skip to content

Commit da26b51

Browse files
committed
Remove doc_value() and strip collapsed_ prefix
1 parent 7be69ba commit da26b51

File tree

11 files changed

+14
-26
lines changed

11 files changed

+14
-26
lines changed

src/librustdoc/clean/types.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,6 @@ impl Item {
411411
crate::passes::span_of_attrs(&self.attrs).unwrap_or_else(|| self.span(tcx).inner())
412412
}
413413

414-
/// Finds the `doc` attribute as a NameValue and returns the corresponding
415-
/// value found.
416-
crate fn doc_value(&self) -> Option<String> {
417-
self.attrs.doc_value()
418-
}
419-
420414
/// Convenience wrapper around [`Self::from_def_id_and_parts`] which converts
421415
/// `hir_id` to a [`DefId`]
422416
pub fn from_hir_id_and_parts(
@@ -468,8 +462,8 @@ impl Item {
468462

469463
/// Finds all `doc` attributes as NameValues and returns their corresponding values, joined
470464
/// with newlines.
471-
crate fn collapsed_doc_value(&self) -> Option<String> {
472-
self.attrs.collapsed_doc_value()
465+
crate fn doc_value(&self) -> Option<String> {
466+
self.attrs.doc_value()
473467
}
474468

475469
crate fn links(&self, cx: &Context<'_>) -> Vec<RenderedLink> {
@@ -1074,16 +1068,10 @@ impl Attributes {
10741068
Attributes { doc_strings, other_attrs }
10751069
}
10761070

1077-
/// Finds the `doc` attribute as a NameValue and returns the corresponding
1078-
/// value found.
1079-
crate fn doc_value(&self) -> Option<String> {
1080-
self.collapsed_doc_value()
1081-
}
1082-
10831071
/// Return the doc-comments on this item, grouped by the module they came from.
10841072
///
10851073
/// The module can be different if this is a re-export with added documentation.
1086-
crate fn collapsed_doc_value_by_module_level(&self) -> FxHashMap<Option<DefId>, String> {
1074+
crate fn doc_value_by_module_level(&self) -> FxHashMap<Option<DefId>, String> {
10871075
let mut ret = FxHashMap::default();
10881076

10891077
for new_frag in self.doc_strings.iter() {
@@ -1095,7 +1083,7 @@ impl Attributes {
10951083

10961084
/// Finds all `doc` attributes as NameValues and returns their corresponding values, joined
10971085
/// with newlines.
1098-
crate fn collapsed_doc_value(&self) -> Option<String> {
1086+
crate fn doc_value(&self) -> Option<String> {
10991087
if self.doc_strings.is_empty() { None } else { Some(self.doc_strings.iter().collect()) }
11001088
}
11011089

src/librustdoc/doctest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ impl<'a, 'hir, 'tcx> HirCollector<'a, 'hir, 'tcx> {
11391139
attrs.unindent_doc_comments();
11401140
// The collapse-docs pass won't combine sugared/raw doc attributes, or included files with
11411141
// anything else, this will combine them for us.
1142-
if let Some(doc) = attrs.collapsed_doc_value() {
1142+
if let Some(doc) = attrs.doc_value() {
11431143
// Use the outermost invocation, so that doctest names come from where the docs were written.
11441144
let span = ast_attrs
11451145
.span()

src/librustdoc/html/render/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl SharedContext<'_> {
145145
/// Returns the `collapsed_doc_value` of the given item if this is the main crate, otherwise
146146
/// returns the `doc_value`.
147147
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
148-
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
148+
if self.collapsed { item.doc_value() } else { item.doc_value() }
149149
}
150150

151151
crate fn edition(&self) -> Edition {

src/librustdoc/json/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl JsonRenderer<'_> {
3232
.flatten()
3333
.map(|clean::ItemLink { link, did, .. }| (link.clone(), from_item_id((*did).into())))
3434
.collect();
35-
let docs = item.attrs.collapsed_doc_value();
35+
let docs = item.attrs.doc_value();
3636
let attrs = item
3737
.attrs
3838
.other_attrs

src/librustdoc/passes/bare_urls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a, 'tcx> DocVisitor for BareUrlsLinter<'a, 'tcx> {
6666
return;
6767
}
6868
};
69-
let dox = item.attrs.collapsed_doc_value().unwrap_or_default();
69+
let dox = item.attrs.doc_value().unwrap_or_default();
7070
if !dox.is_empty() {
7171
let report_diag = |cx: &DocContext<'_>, msg: &str, url: &str, range: Range<usize>| {
7272
let sp = super::source_span_for_markdown_range(cx.tcx, &dox, &range, &item.attrs)

src/librustdoc/passes/calculate_doc_coverage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'a, 'b> DocVisitor for CoverageCalculator<'a, 'b> {
207207
let mut tests = Tests { found_tests: 0 };
208208

209209
find_testable_code(
210-
&i.attrs.collapsed_doc_value().unwrap_or_default(),
210+
&i.attrs.doc_value().unwrap_or_default(),
211211
&mut tests,
212212
ErrorCodes::No,
213213
false,

src/librustdoc/passes/check_code_block_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
144144

145145
impl<'a, 'tcx> DocVisitor for SyntaxChecker<'a, 'tcx> {
146146
fn visit_item(&mut self, item: &clean::Item) {
147-
if let Some(dox) = &item.attrs.collapsed_doc_value() {
147+
if let Some(dox) = &item.attrs.doc_value() {
148148
let sp = item.attr_span(self.cx.tcx);
149149
let extra = crate::html::markdown::ExtraInfo::new_did(
150150
self.cx.tcx,

src/librustdoc/passes/check_doc_test_visibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ crate fn check_doc_test_visibility(krate: Crate, cx: &mut DocContext<'_>) -> Cra
3333

3434
impl<'a, 'tcx> DocVisitor for DocTestVisibilityLinter<'a, 'tcx> {
3535
fn visit_item(&mut self, item: &Item) {
36-
let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new);
36+
let dox = item.attrs.doc_value().unwrap_or_else(String::new);
3737

3838
look_for_tests(self.cx, &dox, &item);
3939

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ impl<'a, 'tcx> DocVisitor for LinkCollector<'a, 'tcx> {
894894
// In the presence of re-exports, this is not the same as the module of the item.
895895
// Rather than merging all documentation into one, resolve it one attribute at a time
896896
// so we know which module it came from.
897-
for (parent_module, doc) in item.attrs.collapsed_doc_value_by_module_level() {
897+
for (parent_module, doc) in item.attrs.doc_value_by_module_level() {
898898
debug!("combined_docs={}", doc);
899899

900900
let (krate, parent_node) = if let Some(id) = parent_module {

src/librustdoc/passes/collect_intra_doc_links/early.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl IntraLinkCrateLoader {
3333

3434
// FIXME: this probably needs to consider inlining
3535
let attrs = crate::clean::Attributes::from_ast(attrs, None);
36-
for (parent_module, doc) in attrs.collapsed_doc_value_by_module_level() {
36+
for (parent_module, doc) in attrs.doc_value_by_module_level() {
3737
debug!(?doc);
3838
for link in markdown_links(doc.as_str()) {
3939
debug!(?link.link);

src/librustdoc/passes/html_tags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<'a, 'tcx> DocVisitor for InvalidHtmlTagsLinter<'a, 'tcx> {
175175
return;
176176
}
177177
};
178-
let dox = item.attrs.collapsed_doc_value().unwrap_or_default();
178+
let dox = item.attrs.doc_value().unwrap_or_default();
179179
if !dox.is_empty() {
180180
let report_diag = |msg: &str, range: &Range<usize>| {
181181
let sp = match super::source_span_for_markdown_range(tcx, &dox, range, &item.attrs)

0 commit comments

Comments
 (0)