@@ -117,29 +117,33 @@ pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item, hir_id: HirId, dox: &
117117 . map ( |span| ( span, true ) )
118118 . unwrap_or_else ( || ( item. attr_span ( tcx) , false ) ) ;
119119
120- tcx . node_span_lint ( crate :: lint :: UNPORTABLE_MARKDOWN , hir_id , ref_span , |lint| {
121- lint . primary_message ( "unportable markdown" ) ;
122- if precise {
120+ if precise {
121+ tcx . node_span_lint ( crate :: lint :: BROKEN_FOOTNOTE , hir_id , ref_span , |lint| {
122+ lint . primary_message ( "no footnote definition matching this footnote" ) ;
123123 lint. span_suggestion (
124124 ref_span. shrink_to_lo ( ) ,
125125 "if it should not be a footnote, escape it" ,
126126 "\\ " ,
127127 Applicability :: MaybeIncorrect ,
128128 ) ;
129- }
130- if dox. as_bytes ( ) . get ( span. end ) == Some ( & b'[' ) {
131- lint. help ( "confusing footnote reference and link" ) ;
132- if precise {
133- lint. span_suggestion (
134- ref_span. shrink_to_hi ( ) ,
135- "if the footnote is intended, add a space" ,
136- " " ,
137- Applicability :: MaybeIncorrect ,
138- ) ;
139- } else {
140- lint. help ( "there should be a space between the link and the footnote" ) ;
129+ } ) ;
130+ } else {
131+ tcx. node_span_lint ( crate :: lint:: UNPORTABLE_MARKDOWN , hir_id, ref_span, |lint| {
132+ lint. primary_message ( "unportable markdown" ) ;
133+ if dox. as_bytes ( ) . get ( span. end ) == Some ( & b'[' ) {
134+ lint. help ( "confusing footnote reference and link" ) ;
135+ if precise {
136+ lint. span_suggestion (
137+ ref_span. shrink_to_hi ( ) ,
138+ "if the footnote is intended, add a space" ,
139+ " " ,
140+ Applicability :: MaybeIncorrect ,
141+ ) ;
142+ } else {
143+ lint. help ( "there should be a space between the link and the footnote" ) ;
144+ }
141145 }
142- }
143- } ) ;
146+ } ) ;
147+ }
144148 }
145149}
0 commit comments