move manual "extern crate" statements outside auto "fn main" in doctests

This commit is contained in:
QuietMisdreavus 2018-02-09 14:43:21 -06:00
parent 5313e8728f
commit b3d6597855

View File

@ -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);
@ -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();