Skip to content

Commit

Permalink
move manual "extern crate" statements outside auto "fn main" in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
QuietMisdreavus committed Feb 17, 2018
1 parent 5313e87 commit b3d6597
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustdoc/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ fn partition_source(s: &str) -> (String, String) {
for line in s.lines() {
let trimline = line.trim();
let header = trimline.is_whitespace() ||
trimline.starts_with("#![");
trimline.starts_with("#![") ||
trimline.starts_with("extern crate");
if !header || after_header {
after_header = true;
after.push_str(line);
Expand Down Expand Up @@ -858,8 +859,8 @@ use asdf::qwop;
assert_eq!(2+2, 4);";
let expected =
"#![allow(unused)]
fn main() {
extern crate asdf;
fn main() {
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
Expand Down

0 comments on commit b3d6597

Please sign in to comment.