Skip to content

Commit 7aaf95d

Browse files
committed
Section titles don't need escaping
1 parent 1b8741c commit 7aaf95d

File tree

1 file changed

+16
-15
lines changed
  • src/librustdoc/html/render

1 file changed

+16
-15
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,23 +1321,22 @@ impl AllTypes {
13211321
}
13221322
}
13231323

1324-
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, title: &str, class: &str) {
1325-
if !e.is_empty() {
1326-
let mut e: Vec<&ItemEntry> = e.iter().collect();
1327-
e.sort();
1328-
write!(
1329-
f,
1330-
"<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">{}</ul>",
1331-
title,
1332-
Escape(title),
1333-
class,
1334-
e.iter().map(|s| format!("<li>{}</li>", s.print())).collect::<String>()
1335-
);
1336-
}
1337-
}
1338-
13391324
impl AllTypes {
13401325
fn print(self, f: &mut Buffer) {
1326+
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, title: &str, class: &str) {
1327+
if !e.is_empty() {
1328+
let mut e: Vec<&ItemEntry> = e.iter().collect();
1329+
e.sort();
1330+
write!(f, "<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">", title, title, class);
1331+
1332+
for s in e.iter() {
1333+
write!(f, "<li>{}</li>", s.print());
1334+
}
1335+
1336+
write!(f, "</ul>");
1337+
}
1338+
}
1339+
13411340
write!(
13421341
f,
13431342
"<h1 class=\"fqn\">\
@@ -1352,6 +1351,8 @@ impl AllTypes {
13521351
</span>
13531352
</h1>"
13541353
);
1354+
// Note: print_entries does not escape the title, because we know the current set of titles
1355+
// don't require escaping.
13551356
print_entries(f, &self.structs, "Structs", "structs");
13561357
print_entries(f, &self.enums, "Enums", "enums");
13571358
print_entries(f, &self.unions, "Unions", "unions");

0 commit comments

Comments
 (0)