Skip to content

Commit 4dfe7a1

Browse files
committed
Auto merge of #27410 - Gankro:meta, r=alexcrichton
Fixes #27404
2 parents 66109d2 + 5b0721d commit 4dfe7a1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustdoc/markdown.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ use test::{TestOptions, Collector};
2929
/// Separate any lines at the start of the file that begin with `%`.
3030
fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
3131
let mut metadata = Vec::new();
32+
let mut count = 0;
3233
for line in s.lines() {
3334
if line.starts_with("%") {
3435
// remove %<whitespace>
35-
metadata.push(line[1..].trim_left())
36+
metadata.push(line[1..].trim_left());
37+
count += line.len() + 1;
3638
} else {
37-
let line_start_byte = s.find(line).unwrap();
38-
return (metadata, &s[line_start_byte..]);
39+
return (metadata, &s[count..]);
3940
}
4041
}
4142
// if we're here, then all lines were metadata % lines.

0 commit comments

Comments
 (0)