We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 66109d2 + 5b0721d commit 4dfe7a1Copy full SHA for 4dfe7a1
src/librustdoc/markdown.rs
@@ -29,13 +29,14 @@ use test::{TestOptions, Collector};
29
/// Separate any lines at the start of the file that begin with `%`.
30
fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
31
let mut metadata = Vec::new();
32
+ let mut count = 0;
33
for line in s.lines() {
34
if line.starts_with("%") {
35
// remove %<whitespace>
- metadata.push(line[1..].trim_left())
36
+ metadata.push(line[1..].trim_left());
37
+ count += line.len() + 1;
38
} else {
- let line_start_byte = s.find(line).unwrap();
- return (metadata, &s[line_start_byte..]);
39
+ return (metadata, &s[count..]);
40
}
41
42
// if we're here, then all lines were metadata % lines.
0 commit comments