@@ -867,46 +867,40 @@ fn report_diagnostic(
867
867
let attrs = & item. attrs ;
868
868
let sp = span_of_attrs ( attrs) . unwrap_or ( item. source . span ( ) ) ;
869
869
870
- cx. tcx . struct_span_lint_hir (
871
- lint:: builtin:: INTRA_DOC_LINK_RESOLUTION_FAILURE ,
872
- hir_id,
873
- sp,
874
- |lint| {
875
- let mut diag = lint. build ( msg) ;
876
-
877
- let span = link_range
878
- . as_ref ( )
879
- . and_then ( |range| super :: source_span_for_markdown_range ( cx, dox, range, attrs) ) ;
880
-
881
- if let Some ( link_range) = link_range {
882
- if let Some ( sp) = span {
883
- diag. set_span ( sp) ;
884
- } else {
885
- // blah blah blah\nblah\nblah [blah] blah blah\nblah blah
886
- // ^ ~~~~
887
- // | link_range
888
- // last_new_line_offset
889
- let last_new_line_offset =
890
- dox[ ..link_range. start ] . rfind ( '\n' ) . map_or ( 0 , |n| n + 1 ) ;
891
- let line = dox[ last_new_line_offset..] . lines ( ) . next ( ) . unwrap_or ( "" ) ;
892
-
893
- // Print the line containing the `link_range` and manually mark it with '^'s.
894
- diag. note ( & format ! (
895
- "the link appears in this line:\n \n {line}\n \
870
+ cx. tcx . struct_span_lint_hir ( lint:: builtin:: BROKEN_INTRA_DOC_LINKS , hir_id, sp, |lint| {
871
+ let mut diag = lint. build ( msg) ;
872
+
873
+ let span = link_range
874
+ . as_ref ( )
875
+ . and_then ( |range| super :: source_span_for_markdown_range ( cx, dox, range, attrs) ) ;
876
+
877
+ if let Some ( link_range) = link_range {
878
+ if let Some ( sp) = span {
879
+ diag. set_span ( sp) ;
880
+ } else {
881
+ // blah blah blah\nblah\nblah [blah] blah blah\nblah blah
882
+ // ^ ~~~~
883
+ // | link_range
884
+ // last_new_line_offset
885
+ let last_new_line_offset = dox[ ..link_range. start ] . rfind ( '\n' ) . map_or ( 0 , |n| n + 1 ) ;
886
+ let line = dox[ last_new_line_offset..] . lines ( ) . next ( ) . unwrap_or ( "" ) ;
887
+
888
+ // Print the line containing the `link_range` and manually mark it with '^'s.
889
+ diag. note ( & format ! (
890
+ "the link appears in this line:\n \n {line}\n \
896
891
{indicator: <before$}{indicator:^<found$}",
897
- line = line,
898
- indicator = "" ,
899
- before = link_range. start - last_new_line_offset,
900
- found = link_range. len( ) ,
901
- ) ) ;
902
- }
892
+ line = line,
893
+ indicator = "" ,
894
+ before = link_range. start - last_new_line_offset,
895
+ found = link_range. len( ) ,
896
+ ) ) ;
903
897
}
898
+ }
904
899
905
- decorate ( & mut diag, span) ;
900
+ decorate ( & mut diag, span) ;
906
901
907
- diag. emit ( ) ;
908
- } ,
909
- ) ;
902
+ diag. emit ( ) ;
903
+ } ) ;
910
904
}
911
905
912
906
fn resolution_failure (
0 commit comments