Fix rustoc item summaries that are headers

Rustoc item summaries that are headers were not displayed at all because
they started with whitespace.

This PR fixes this and now removes the whitespace and then displays the
block.
This commit is contained in:
Christian Duerr
2017-11-30 00:28:59 +01:00
parent 0a2e9ade83
commit 91a4106911
2 changed files with 16 additions and 1 deletions

View File

@@ -1819,7 +1819,9 @@ fn full_path(cx: &Context, item: &clean::Item) -> String {
fn shorter<'a>(s: Option<&'a str>) -> String {
match s {
Some(s) => s.lines().take_while(|line|{
Some(s) => s.lines()
.skip_while(|s| s.chars().all(|c| c.is_whitespace()))
.take_while(|line|{
(*line).chars().any(|chr|{
!chr.is_whitespace()
})