move manual "extern crate" statements outside auto "fn main" in doctests
This commit is contained in:
parent
5313e8728f
commit
b3d6597855
1 changed files with 3 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue