Skip to content

Commit 5c62a18

Browse files
authored
Rollup merge of #82962 - notriddle:cleanup-index, r=jyn514
Treat header as first paragraph for shortened markdown descriptions "The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.
2 parents b9a2570 + 66b6504 commit 5c62a18

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/librustdoc/html/markdown.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ fn markdown_summary_with_limit(md: &str, length_limit: usize) -> (String, bool)
10931093
Tag::Emphasis => s.push_str("</em>"),
10941094
Tag::Strong => s.push_str("</strong>"),
10951095
Tag::Paragraph => break,
1096+
Tag::Heading(..) => break,
10961097
_ => {}
10971098
},
10981099
Event::HardBreak | Event::SoftBreak => {

src/librustdoc/html/markdown/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ fn test_short_markdown_summary() {
235235
t("code `let x = i32;` ...", "code <code>let x = i32;</code> …");
236236
t("type `Type<'static>` ...", "type <code>Type<'static></code> …");
237237
t("# top header", "top header");
238+
t("# top header\n\nfollowed by a paragraph", "top header");
238239
t("## header", "header");
239240
t("first paragraph\n\nsecond paragraph", "first paragraph");
240241
t("```\nfn main() {}\n```", "");

src/librustdoc/html/render/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,7 @@ impl Serialize for TypeWithKind {
286286
where
287287
S: Serializer,
288288
{
289-
let mut seq = serializer.serialize_seq(None)?;
290-
seq.serialize_element(&self.ty.name)?;
291-
let x: ItemType = self.kind.into();
292-
seq.serialize_element(&x)?;
293-
seq.end()
289+
(&self.ty.name, ItemType::from(self.kind)).serialize(serializer)
294290
}
295291
}
296292

0 commit comments

Comments
 (0)