Skip to content

Commit 5b05f68

Browse files
committed
Revert "rustdoc: Hide #text in doc-tests"
This reverts commit af6c320.
1 parent e11a9fa commit 5b05f68

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

src/librustdoc/html/markdown.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,12 @@ fn map_line(s: &str) -> Line<'_> {
147147
let trimmed = s.trim();
148148
if trimmed.starts_with("##") {
149149
Line::Shown(Cow::Owned(s.replacen("##", "#", 1)))
150-
} else if trimmed.starts_with('#') {
151-
let mut without_hash = trimmed[1..].trim_start();
152-
if without_hash.starts_with('!') {
153-
// #! text
154-
without_hash = without_hash[1..].trim_start_matches(' ');
155-
}
156-
if without_hash.starts_with('[') {
157-
// #[attr] or #![attr]
158-
Line::Shown(Cow::Borrowed(s))
159-
} else {
160-
// #text
161-
Line::Hidden(without_hash)
162-
}
150+
} else if let Some(stripped) = trimmed.strip_prefix("# ") {
151+
// # text
152+
Line::Hidden(&stripped)
153+
} else if trimmed == "#" {
154+
// We cannot handle '#text' because it could be #[attr].
155+
Line::Hidden("")
163156
} else {
164157
Line::Shown(Cow::Borrowed(s))
165158
}

src/test/rustdoc-ui/test-hidden.rs

-25
This file was deleted.

src/test/rustdoc-ui/test-hidden.stdout

-6
This file was deleted.

0 commit comments

Comments
 (0)