diff options
| author | bors <bors@rust-lang.org> | 2015-07-30 23:45:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-30 23:45:43 +0000 |
| commit | 4dfe7a16cd8dff6bef0eea989ae98f4e9d8910fc (patch) | |
| tree | 4307b6badd4c7b75052e52d9e117e07233c9cc21 | |
| parent | 66109d2c38b4ff2b1e097014fa4710682937a10b (diff) | |
| parent | 5b0721d0fe390ff3f6741cdf15bf93b8a1df2879 (diff) | |
| download | rust-4dfe7a16cd8dff6bef0eea989ae98f4e9d8910fc.tar.gz rust-4dfe7a16cd8dff6bef0eea989ae98f4e9d8910fc.zip | |
Auto merge of #27410 - Gankro:meta, r=alexcrichton
Fixes #27404
| -rw-r--r-- | src/librustdoc/markdown.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index bc6c797e5c5..a311b938e96 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -29,13 +29,14 @@ use test::{TestOptions, Collector}; /// Separate any lines at the start of the file that begin with `%`. fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) { let mut metadata = Vec::new(); + let mut count = 0; for line in s.lines() { if line.starts_with("%") { // remove %<whitespace> - metadata.push(line[1..].trim_left()) + metadata.push(line[1..].trim_left()); + count += line.len() + 1; } else { - let line_start_byte = s.find(line).unwrap(); - return (metadata, &s[line_start_byte..]); + return (metadata, &s[count..]); } } // if we're here, then all lines were metadata % lines. |
