|
| 1 | +#![warn(clippy::doc_suspicious_footnotes)] |
| 2 | +#![allow(clippy::needless_raw_string_hashes)] |
| 3 | +//! This is not a footnote[^1]. |
| 4 | +//! |
| 5 | +//! [^1]: <!-- description --> |
| 6 | +//~^ doc_suspicious_footnotes |
| 7 | +//! |
| 8 | +//! This is not a footnote[^either], but it doesn't warn. |
| 9 | +//! |
| 10 | +//! This is not a footnote\[^1], but it also doesn't warn. |
| 11 | +//! |
| 12 | +//! This is not a footnote[^1\], but it also doesn't warn. |
| 13 | +//! |
| 14 | +//! This is not a `footnote[^1]`, but it also doesn't warn. |
| 15 | +//! |
| 16 | +//! This is a footnote[^2]. |
| 17 | +//! |
| 18 | +//! [^2]: hello world |
| 19 | + |
| 20 | +/// This is not a footnote[^1]. |
| 21 | +/// |
| 22 | +/// [^1]: <!-- description --> |
| 23 | +//~^ doc_suspicious_footnotes |
| 24 | +/// |
| 25 | +/// This is not a footnote[^either], but it doesn't warn. |
| 26 | +/// |
| 27 | +/// This is not a footnote\[^1], but it also doesn't warn. |
| 28 | +/// |
| 29 | +/// This is not a footnote[^1\], but it also doesn't warn. |
| 30 | +/// |
| 31 | +/// This is not a `footnote[^1]`, but it also doesn't warn. |
| 32 | +/// |
| 33 | +/// This is a footnote[^2]. |
| 34 | +/// |
| 35 | +/// [^2]: hello world |
| 36 | +pub fn footnotes() { |
| 37 | + // test code goes here |
| 38 | +} |
| 39 | + |
| 40 | +pub struct Foo; |
| 41 | +#[rustfmt::skip] |
| 42 | +impl Foo { |
| 43 | + #[doc = r#"This is not a footnote[^1]. |
| 44 | + |
| 45 | +[^1]: <!-- description -->"#] |
| 46 | + //~^ doc_suspicious_footnotes |
| 47 | + #[doc = r#""#] |
| 48 | + #[doc = r#"This is not a footnote[^either], but it doesn't warn."#] |
| 49 | + #[doc = r#""#] |
| 50 | + #[doc = r#"This is not a footnote\[^1], but it also doesn't warn."#] |
| 51 | + #[doc = r#""#] |
| 52 | + #[doc = r#"This is not a footnote[^1\], but it also doesn't warn."#] |
| 53 | + #[doc = r#""#] |
| 54 | + #[doc = r#"This is not a `footnote[^1]`, but it also doesn't warn."#] |
| 55 | + #[doc = r#""#] |
| 56 | + #[doc = r#"This is a footnote[^2]."#] |
| 57 | + #[doc = r#""#] |
| 58 | + #[doc = r#"[^2]: hello world"#] |
| 59 | + pub fn footnotes() { |
| 60 | + // test code goes here |
| 61 | + } |
| 62 | + #[doc = r#"This is not a footnote[^1]. |
| 63 | + |
| 64 | + This is not a footnote[^either], but it doesn't warn. |
| 65 | + |
| 66 | + This is not a footnote\[^1], but it also doesn't warn. |
| 67 | + |
| 68 | + This is not a footnote[^1\], but it also doesn't warn. |
| 69 | + |
| 70 | + This is not a `footnote[^1]`, but it also doesn't warn. |
| 71 | + |
| 72 | + This is a footnote[^2]. |
| 73 | + |
| 74 | + [^2]: hello world |
| 75 | + |
| 76 | + |
| 77 | +[^1]: <!-- description -->"#] |
| 78 | + //~^^^^^^^^^^^^^^ doc_suspicious_footnotes |
| 79 | + pub fn footnotes2() { |
| 80 | + // test code goes here |
| 81 | + } |
| 82 | + #[cfg_attr( |
| 83 | + not(FALSE), |
| 84 | + doc = r#"This is not a footnote[^1]. |
| 85 | + |
| 86 | +This is not a footnote[^either], but it doesn't warn. |
| 87 | + |
| 88 | +[^1]: <!-- description -->"# |
| 89 | + //~^ doc_suspicious_footnotes |
| 90 | + )] |
| 91 | + pub fn footnotes3() { |
| 92 | + // test code goes here |
| 93 | + } |
| 94 | + #[doc = "My footnote [^foot\note]"] |
| 95 | + pub fn footnote4() { |
| 96 | + // test code goes here |
| 97 | + } |
| 98 | + #[doc = "Hihi"]pub fn footnote5() { |
| 99 | + // test code goes here |
| 100 | + } |
| 101 | +} |
| 102 | + |
| 103 | +#[doc = r#"This is not a footnote[^1]. |
| 104 | + |
| 105 | +[^1]: <!-- description -->"#] |
| 106 | +//~^ doc_suspicious_footnotes |
| 107 | +#[doc = r""] |
| 108 | +#[doc = r"This is not a footnote[^either], but it doesn't warn."] |
| 109 | +#[doc = r""] |
| 110 | +#[doc = r"This is not a footnote\[^1], but it also doesn't warn."] |
| 111 | +#[doc = r""] |
| 112 | +#[doc = r"This is not a footnote[^1\], but it also doesn't warn."] |
| 113 | +#[doc = r""] |
| 114 | +#[doc = r"This is not a `footnote[^1]`, but it also doesn't warn."] |
| 115 | +#[doc = r""] |
| 116 | +#[doc = r"This is a footnote[^2]."] |
| 117 | +#[doc = r""] |
| 118 | +#[doc = r"[^2]: hello world"] |
| 119 | +pub fn footnotes_attrs() { |
| 120 | + // test code goes here |
| 121 | +} |
| 122 | + |
| 123 | +pub mod multiline { |
| 124 | + /*! |
| 125 | + * This is not a footnote[^1]. //~ doc_suspicious_footnotes |
| 126 | + * |
| 127 | + * This is not a footnote\[^1], but it doesn't warn. |
| 128 | + * |
| 129 | + * This is a footnote[^2]. |
| 130 | + * |
| 131 | + * These give weird results, but correct ones, so it works. |
| 132 | + * |
| 133 | + * [^2]: hello world |
| 134 | + */ |
| 135 | +/*! [^1]: <!-- description --> */ |
| 136 | + /** |
| 137 | + * This is not a footnote[^1]. //~ doc_suspicious_footnotes |
| 138 | + * |
| 139 | + * This is not a footnote\[^1], but it doesn't warn. |
| 140 | + * |
| 141 | + * This is a footnote[^2]. |
| 142 | + * |
| 143 | + * These give weird results, but correct ones, so it works. |
| 144 | + * |
| 145 | + * [^2]: hello world |
| 146 | + */ |
| 147 | +/** [^1]: <!-- description --> */ |
| 148 | + pub fn foo() {} |
| 149 | +} |
| 150 | + |
| 151 | +/// This is not a footnote [^1] |
| 152 | +/// |
| 153 | +/// [^1]: <!-- description --> |
| 154 | +//~^ doc_suspicious_footnotes |
| 155 | +/// |
| 156 | +/// This one is [^2] |
| 157 | +/// |
| 158 | +/// [^2]: contents |
| 159 | +#[doc = r#"This is not a footnote [^3] |
| 160 | + |
| 161 | +[^3]: <!-- description -->"#] |
| 162 | +//~^ doc_suspicious_footnotes |
| 163 | +#[doc = ""] |
| 164 | +#[doc = "This one is [^4]"] |
| 165 | +#[doc = ""] |
| 166 | +#[doc = "[^4]: contents"] |
| 167 | +pub struct MultiFragmentFootnote; |
| 168 | + |
| 169 | +#[doc(inline)] |
| 170 | +/// This is not a footnote [^5] |
| 171 | +/// |
| 172 | +/// [^5]: <!-- description --> |
| 173 | +//~^ doc_suspicious_footnotes |
| 174 | +/// |
| 175 | +/// This one is [^6] |
| 176 | +/// |
| 177 | +/// [^6]: contents |
| 178 | +#[doc = r#"This is not a footnote [^7] |
| 179 | + |
| 180 | +[^7]: <!-- description -->"#] |
| 181 | +//~^ doc_suspicious_footnotes |
| 182 | +#[doc = ""] |
| 183 | +#[doc = "This one is [^8]"] |
| 184 | +#[doc = ""] |
| 185 | +#[doc = "[^8]: contents"] |
| 186 | +pub use MultiFragmentFootnote as OtherInlinedFootnote; |
0 commit comments