about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-31 02:20:47 +0000
committerbors <bors@rust-lang.org>2020-07-31 02:20:47 +0000
commitffa80f01d800528b2cfbe5b5a8a218d20c7d8e95 (patch)
tree9591e793ce50b32689ab69a3b868ee84fb5b090d /src/librustdoc
parentc058a8b8dc5dea0ed9b33e14da9e317e2749fcd7 (diff)
parentc17eb566c20bb4c98a1e74f7f0461483ff175310 (diff)
downloadrust-ffa80f01d800528b2cfbe5b5a8a218d20c7d8e95.tar.gz
rust-ffa80f01d800528b2cfbe5b5a8a218d20c7d8e95.zip
Auto merge of #74926 - Manishearth:rename-lint, r=jyn514
Rename intra_doc_link_resolution_failure

It should be plural to follow the conventions in https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/core.rs2
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs66
2 files changed, 31 insertions, 37 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 2c2ebc9291b..cbd0ca0de64 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -315,7 +315,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
     let cpath = Some(input.clone());
     let input = Input::File(input);
 
-    let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
+    let intra_link_resolution_failure_name = lint::builtin::BROKEN_INTRA_DOC_LINKS.name;
     let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
     let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name;
     let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name;
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 418238181e9..bf7a43236e0 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -867,46 +867,40 @@ fn report_diagnostic(
     let attrs = &item.attrs;
     let sp = span_of_attrs(attrs).unwrap_or(item.source.span());
 
-    cx.tcx.struct_span_lint_hir(
-        lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE,
-        hir_id,
-        sp,
-        |lint| {
-            let mut diag = lint.build(msg);
-
-            let span = link_range
-                .as_ref()
-                .and_then(|range| super::source_span_for_markdown_range(cx, dox, range, attrs));
-
-            if let Some(link_range) = link_range {
-                if let Some(sp) = span {
-                    diag.set_span(sp);
-                } else {
-                    // blah blah blah\nblah\nblah [blah] blah blah\nblah blah
-                    //                       ^     ~~~~
-                    //                       |     link_range
-                    //                       last_new_line_offset
-                    let last_new_line_offset =
-                        dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
-                    let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
-
-                    // Print the line containing the `link_range` and manually mark it with '^'s.
-                    diag.note(&format!(
-                        "the link appears in this line:\n\n{line}\n\
+    cx.tcx.struct_span_lint_hir(lint::builtin::BROKEN_INTRA_DOC_LINKS, hir_id, sp, |lint| {
+        let mut diag = lint.build(msg);
+
+        let span = link_range
+            .as_ref()
+            .and_then(|range| super::source_span_for_markdown_range(cx, dox, range, attrs));
+
+        if let Some(link_range) = link_range {
+            if let Some(sp) = span {
+                diag.set_span(sp);
+            } else {
+                // blah blah blah\nblah\nblah [blah] blah blah\nblah blah
+                //                       ^     ~~~~
+                //                       |     link_range
+                //                       last_new_line_offset
+                let last_new_line_offset = dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
+                let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
+
+                // Print the line containing the `link_range` and manually mark it with '^'s.
+                diag.note(&format!(
+                    "the link appears in this line:\n\n{line}\n\
                          {indicator: <before$}{indicator:^<found$}",
-                        line = line,
-                        indicator = "",
-                        before = link_range.start - last_new_line_offset,
-                        found = link_range.len(),
-                    ));
-                }
+                    line = line,
+                    indicator = "",
+                    before = link_range.start - last_new_line_offset,
+                    found = link_range.len(),
+                ));
             }
+        }
 
-            decorate(&mut diag, span);
+        decorate(&mut diag, span);
 
-            diag.emit();
-        },
-    );
+        diag.emit();
+    });
 }
 
 fn resolution_failure(