Transition to 2018 edition (#933)

* Transition to 2018 edition

* Update Travis CI badge in README

* Remove non-idiomatic `extern crate` lines
This commit is contained in:
lzutao 2019-05-26 01:50:41 +07:00 committed by Dylan DPC
parent fe492d1cb9
commit 8542f7f29d
37 changed files with 82 additions and 158 deletions

View File

@ -6,13 +6,14 @@ authors = [
"Michael-F-Bryan <michaelfbryan@gmail.com>", "Michael-F-Bryan <michaelfbryan@gmail.com>",
"Matt Ickstadt <mattico8@gmail.com>" "Matt Ickstadt <mattico8@gmail.com>"
] ]
description = "Creates a book from markdown files"
documentation = "http://rust-lang-nursery.github.io/mdBook/index.html" documentation = "http://rust-lang-nursery.github.io/mdBook/index.html"
repository = "https://github.com/rust-lang-nursery/mdBook" edition = "2018"
exclude = ["/book-example/*"]
keywords = ["book", "gitbook", "rustbook", "markdown"] keywords = ["book", "gitbook", "rustbook", "markdown"]
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
exclude = ["book-example/*"] repository = "https://github.com/rust-lang-nursery/mdBook"
description = "Creates a book from markdown files"
[dependencies] [dependencies]
clap = "2.24" clap = "2.24"

View File

@ -4,7 +4,7 @@
<tr> <tr>
<td><strong>Linux / OS X</strong></td> <td><strong>Linux / OS X</strong></td>
<td> <td>
<a href="https://travis-ci.org/rust-lang-nursery/mdBook"><img src="https://travis-ci.org/rust-lang-nursery/mdBook.svg?branch=master"></a> <a href="https://travis-ci.com/rust-lang-nursery/mdBook"><img src="https://travis-ci.com/rust-lang-nursery/mdBook.svg?branch=master"></a>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -1,10 +1,5 @@
//! An example preprocessor for removing all forms of emphasis from a markdown //! An example preprocessor for removing all forms of emphasis from a markdown
//! book. //! book.
extern crate mdbook;
extern crate pulldown_cmark;
extern crate pulldown_cmark_to_cmark;
use mdbook::book::{Book, BookItem, Chapter}; use mdbook::book::{Book, BookItem, Chapter};
use mdbook::errors::{Error, Result}; use mdbook::errors::{Error, Result};
use mdbook::preprocess::{Preprocessor, PreprocessorContext}; use mdbook::preprocess::{Preprocessor, PreprocessorContext};

View File

@ -1,12 +1,8 @@
extern crate clap; use crate::nop_lib::Nop;
extern crate mdbook;
extern crate serde_json;
use clap::{App, Arg, ArgMatches, SubCommand}; use clap::{App, Arg, ArgMatches, SubCommand};
use mdbook::book::Book; use mdbook::book::Book;
use mdbook::errors::Error; use mdbook::errors::Error;
use mdbook::preprocess::{CmdPreprocessor, Preprocessor, PreprocessorContext}; use mdbook::preprocess::{CmdPreprocessor, Preprocessor, PreprocessorContext};
use nop_lib::Nop;
use std::io; use std::io;
use std::process; use std::process;

View File

@ -5,8 +5,8 @@ use std::io::{Read, Write};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use super::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem}; use super::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem};
use config::BuildConfig; use crate::config::BuildConfig;
use errors::*; use crate::errors::*;
/// Load a book into memory from its `src/` directory. /// Load a book into memory from its `src/` directory.
pub fn load_book<P: AsRef<Path>>(src_dir: P, cfg: &BuildConfig) -> Result<Book> { pub fn load_book<P: AsRef<Path>>(src_dir: P, cfg: &BuildConfig) -> Result<Book> {

View File

@ -1,12 +1,11 @@
use std::fs::{self, File}; use std::fs::{self, File};
use std::io::Write; use std::io::Write;
use std::path::PathBuf; use std::path::PathBuf;
use toml;
use super::MDBook; use super::MDBook;
use config::Config; use crate::config::Config;
use errors::*; use crate::errors::*;
use theme; use crate::theme;
/// A helper for setting up a new book and its directory structure. /// A helper for setting up a new book and its directory structure.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]

View File

@ -20,14 +20,14 @@ use std::string::ToString;
use tempfile::Builder as TempFileBuilder; use tempfile::Builder as TempFileBuilder;
use toml::Value; use toml::Value;
use errors::*; use crate::errors::*;
use preprocess::{ use crate::preprocess::{
CmdPreprocessor, IndexPreprocessor, LinkPreprocessor, Preprocessor, PreprocessorContext, CmdPreprocessor, IndexPreprocessor, LinkPreprocessor, Preprocessor, PreprocessorContext,
}; };
use renderer::{CmdRenderer, HtmlHandlebars, RenderContext, Renderer}; use crate::renderer::{CmdRenderer, HtmlHandlebars, RenderContext, Renderer};
use utils; use crate::utils;
use config::Config; use crate::config::Config;
/// The object used to manage and build a book. /// The object used to manage and build a book.
pub struct MDBook { pub struct MDBook {
@ -124,7 +124,6 @@ impl MDBook {
/// `(section: String, bookitem: &BookItem)` /// `(section: String, bookitem: &BookItem)`
/// ///
/// ```no_run /// ```no_run
/// # extern crate mdbook;
/// # use mdbook::MDBook; /// # use mdbook::MDBook;
/// # use mdbook::book::BookItem; /// # use mdbook::book::BookItem;
/// # #[allow(unused_variables)] /// # #[allow(unused_variables)]

View File

@ -1,4 +1,4 @@
use errors::*; use crate::errors::*;
use memchr::{self, Memchr}; use memchr::{self, Memchr};
use pulldown_cmark::{self, Event, Tag}; use pulldown_cmark::{self, Event, Tag};
use std::fmt::{self, Display, Formatter}; use std::fmt::{self, Display, Formatter};

View File

@ -1,7 +1,7 @@
use crate::{get_book_dir, open};
use clap::{App, ArgMatches, SubCommand}; use clap::{App, ArgMatches, SubCommand};
use mdbook::errors::Result; use mdbook::errors::Result;
use mdbook::MDBook; use mdbook::MDBook;
use {get_book_dir, open};
// Create clap subcommand arguments // Create clap subcommand arguments
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {

View File

@ -1,5 +1,5 @@
use crate::get_book_dir;
use clap::{App, ArgMatches, SubCommand}; use clap::{App, ArgMatches, SubCommand};
use get_book_dir;
use mdbook::errors::*; use mdbook::errors::*;
use mdbook::MDBook; use mdbook::MDBook;
use std::fs; use std::fs;

View File

@ -1,5 +1,5 @@
use crate::get_book_dir;
use clap::{App, ArgMatches, SubCommand}; use clap::{App, ArgMatches, SubCommand};
use get_book_dir;
use mdbook::config; use mdbook::config;
use mdbook::errors::Result; use mdbook::errors::Result;
use mdbook::MDBook; use mdbook::MDBook;

View File

@ -1,18 +1,11 @@
extern crate iron;
extern crate staticfile;
extern crate ws;
use self::iron::{
status, AfterMiddleware, Chain, Iron, IronError, IronResult, Request, Response, Set,
};
#[cfg(feature = "watch")] #[cfg(feature = "watch")]
use super::watch; use super::watch;
use crate::{get_book_dir, open};
use clap::{App, Arg, ArgMatches, SubCommand}; use clap::{App, Arg, ArgMatches, SubCommand};
use iron::{status, AfterMiddleware, Chain, Iron, IronError, IronResult, Request, Response, Set};
use mdbook::errors::*; use mdbook::errors::*;
use mdbook::utils; use mdbook::utils;
use mdbook::MDBook; use mdbook::MDBook;
use std;
use {get_book_dir, open};
struct ErrorRecover; struct ErrorRecover;

View File

@ -1,5 +1,5 @@
use crate::get_book_dir;
use clap::{App, Arg, ArgMatches, SubCommand}; use clap::{App, Arg, ArgMatches, SubCommand};
use get_book_dir;
use mdbook::errors::Result; use mdbook::errors::Result;
use mdbook::MDBook; use mdbook::MDBook;

View File

@ -1,15 +1,13 @@
extern crate notify; use crate::{get_book_dir, open};
use self::notify::Watcher;
use clap::{App, ArgMatches, SubCommand}; use clap::{App, ArgMatches, SubCommand};
use mdbook::errors::Result; use mdbook::errors::Result;
use mdbook::utils; use mdbook::utils;
use mdbook::MDBook; use mdbook::MDBook;
use notify::Watcher;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use {get_book_dir, open};
// Create clap subcommand arguments // Create clap subcommand arguments
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
@ -55,8 +53,8 @@ pub fn trigger_on_change<F>(book: &MDBook, closure: F)
where where
F: Fn(Vec<PathBuf>, &Path), F: Fn(Vec<PathBuf>, &Path),
{ {
use self::notify::DebouncedEvent::*; use notify::DebouncedEvent::*;
use self::notify::RecursiveMode::*; use notify::RecursiveMode::*;
// Create a channel to receive the events. // Create a channel to receive the events.
let (tx, rx) = channel(); let (tx, rx) = channel();

View File

@ -9,9 +9,7 @@
//! # Examples //! # Examples
//! //!
//! ```rust //! ```rust
//! # extern crate mdbook;
//! # use mdbook::errors::*; //! # use mdbook::errors::*;
//! # extern crate toml;
//! use std::path::PathBuf; //! use std::path::PathBuf;
//! use std::str::FromStr; //! use std::str::FromStr;
//! use mdbook::Config; //! use mdbook::Config;
@ -52,7 +50,6 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json;
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
@ -64,7 +61,7 @@ use toml_query::delete::TomlValueDeleteExt;
use toml_query::insert::TomlValueInsertExt; use toml_query::insert::TomlValueInsertExt;
use toml_query::read::TomlValueReadExt; use toml_query::read::TomlValueReadExt;
use errors::*; use crate::errors::*;
/// The overall configuration object for MDBook, essentially an in-memory /// The overall configuration object for MDBook, essentially an in-memory
/// representation of `book.toml`. /// representation of `book.toml`.

View File

@ -85,24 +85,14 @@
#[macro_use] #[macro_use]
extern crate error_chain; extern crate error_chain;
extern crate handlebars;
extern crate itertools;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate memchr;
extern crate pulldown_cmark;
extern crate regex;
extern crate serde;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
#[macro_use] #[macro_use]
extern crate serde_json; extern crate serde_json;
extern crate shlex;
extern crate tempfile;
extern crate toml;
extern crate toml_query;
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]
@ -121,10 +111,10 @@ pub mod utils;
/// compatibility checks. /// compatibility checks.
pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION"); pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");
pub use book::BookItem; pub use crate::book::BookItem;
pub use book::MDBook; pub use crate::book::MDBook;
pub use config::Config; pub use crate::config::Config;
pub use renderer::Renderer; pub use crate::renderer::Renderer;
/// The error types used through out this crate. /// The error types used through out this crate.
pub mod errors { pub mod errors {

View File

@ -1,12 +1,7 @@
extern crate chrono;
#[macro_use] #[macro_use]
extern crate clap; extern crate clap;
extern crate env_logger;
extern crate error_chain;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate mdbook;
extern crate open;
use chrono::Local; use chrono::Local;
use clap::{App, AppSettings, ArgMatches}; use clap::{App, AppSettings, ArgMatches};

View File

@ -1,7 +1,6 @@
use super::{Preprocessor, PreprocessorContext}; use super::{Preprocessor, PreprocessorContext};
use book::Book; use crate::book::Book;
use errors::*; use crate::errors::*;
use serde_json;
use shlex::Shlex; use shlex::Shlex;
use std::io::{self, Read, Write}; use std::io::{self, Read, Write};
use std::process::{Child, Command, Stdio}; use std::process::{Child, Command, Stdio};
@ -168,8 +167,8 @@ impl Preprocessor for CmdPreprocessor {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::MDBook;
use std::path::Path; use std::path::Path;
use MDBook;
fn book_example() -> MDBook { fn book_example() -> MDBook {
let example = Path::new(env!("CARGO_MANIFEST_DIR")).join("book-example"); let example = Path::new(env!("CARGO_MANIFEST_DIR")).join("book-example");

View File

@ -1,10 +1,10 @@
use regex::Regex; use regex::Regex;
use std::path::Path; use std::path::Path;
use errors::*; use crate::errors::*;
use super::{Preprocessor, PreprocessorContext}; use super::{Preprocessor, PreprocessorContext};
use book::{Book, BookItem}; use crate::book::{Book, BookItem};
/// A preprocessor for converting file name `README.md` to `index.md` since /// A preprocessor for converting file name `README.md` to `index.md` since
/// `README.md` is the de facto index file in markdown-based documentation. /// `README.md` is the de facto index file in markdown-based documentation.

View File

@ -1,12 +1,12 @@
use errors::*; use crate::errors::*;
use crate::utils::fs::file_to_string;
use crate::utils::take_lines;
use regex::{CaptureMatches, Captures, Regex}; use regex::{CaptureMatches, Captures, Regex};
use std::ops::{Range, RangeFrom, RangeFull, RangeTo}; use std::ops::{Range, RangeFrom, RangeFull, RangeTo};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use utils::fs::file_to_string;
use utils::take_lines;
use super::{Preprocessor, PreprocessorContext}; use super::{Preprocessor, PreprocessorContext};
use book::{Book, BookItem}; use crate::book::{Book, BookItem};
const ESCAPE_CHAR: char = '\\'; const ESCAPE_CHAR: char = '\\';
const MAX_LINK_NESTED_DEPTH: usize = 10; const MAX_LINK_NESTED_DEPTH: usize = 10;

View File

@ -8,9 +8,9 @@ mod cmd;
mod index; mod index;
mod links; mod links;
use book::Book; use crate::book::Book;
use config::Config; use crate::config::Config;
use errors::*; use crate::errors::*;
use std::path::PathBuf; use std::path::PathBuf;
@ -37,7 +37,7 @@ impl PreprocessorContext {
root, root,
config, config,
renderer, renderer,
mdbook_version: ::MDBOOK_VERSION.to_string(), mdbook_version: crate::MDBOOK_VERSION.to_string(),
__non_exhaustive: (), __non_exhaustive: (),
} }
} }

View File

@ -1,10 +1,10 @@
use book::{Book, BookItem}; use crate::book::{Book, BookItem};
use config::{Config, HtmlConfig, Playpen}; use crate::config::{Config, HtmlConfig, Playpen};
use errors::*; use crate::errors::*;
use renderer::html_handlebars::helpers; use crate::renderer::html_handlebars::helpers;
use renderer::{RenderContext, Renderer}; use crate::renderer::{RenderContext, Renderer};
use theme::{self, playpen_editor, Theme}; use crate::theme::{self, playpen_editor, Theme};
use utils; use crate::utils;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::collections::HashMap; use std::collections::HashMap;
@ -13,7 +13,6 @@ use std::path::{Path, PathBuf};
use handlebars::Handlebars; use handlebars::Handlebars;
use regex::{Captures, Regex}; use regex::{Captures, Regex};
use serde_json;
#[derive(Default)] #[derive(Default)]
pub struct HtmlHandlebars; pub struct HtmlHandlebars;
@ -113,7 +112,7 @@ impl HtmlHandlebars {
theme: &Theme, theme: &Theme,
html_config: &HtmlConfig, html_config: &HtmlConfig,
) -> Result<()> { ) -> Result<()> {
use utils::fs::write_file; use crate::utils::fs::write_file;
write_file( write_file(
destination, destination,

View File

@ -2,9 +2,8 @@ use std::collections::BTreeMap;
use std::path::Path; use std::path::Path;
use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError, Renderable}; use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError, Renderable};
use serde_json;
use utils; use crate::utils;
type StringMap = BTreeMap<String, String>; type StringMap = BTreeMap<String, String>;

View File

@ -1,11 +1,10 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::path::Path; use std::path::Path;
use utils; use crate::utils;
use handlebars::{Context, Handlebars, Helper, HelperDef, Output, RenderContext, RenderError}; use handlebars::{Context, Handlebars, Helper, HelperDef, Output, RenderContext, RenderError};
use pulldown_cmark::{html, Event, Parser, Tag}; use pulldown_cmark::{html, Event, Parser, Tag};
use serde_json;
// Handlebars helper to construct TOC // Handlebars helper to construct TOC
#[derive(Clone, Copy)] #[derive(Clone, Copy)]

View File

@ -1,19 +1,15 @@
extern crate ammonia;
extern crate elasticlunr;
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::path::Path; use std::path::Path;
use self::elasticlunr::Index; use elasticlunr::Index;
use pulldown_cmark::*; use pulldown_cmark::*;
use serde_json;
use book::{Book, BookItem}; use crate::book::{Book, BookItem};
use config::Search; use crate::config::Search;
use errors::*; use crate::errors::*;
use theme::searcher; use crate::theme::searcher;
use utils; use crate::utils;
/// Creates all files required for search. /// Creates all files required for search.
pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> Result<()> { pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> Result<()> {
@ -170,7 +166,7 @@ fn render_item(
} }
fn write_to_json(index: Index, search_config: &Search, doc_urls: Vec<String>) -> Result<String> { fn write_to_json(index: Index, search_config: &Search, doc_urls: Vec<String>) -> Result<String> {
use self::elasticlunr::config::{SearchBool, SearchOptions, SearchOptionsField}; use elasticlunr::config::{SearchBool, SearchOptions, SearchOptionsField};
use std::collections::BTreeMap; use std::collections::BTreeMap;
#[derive(Serialize)] #[derive(Serialize)]

View File

@ -15,16 +15,15 @@ pub use self::html_handlebars::HtmlHandlebars;
mod html_handlebars; mod html_handlebars;
use serde_json;
use shlex::Shlex; use shlex::Shlex;
use std::fs; use std::fs;
use std::io::{self, Read}; use std::io::{self, Read};
use std::path::PathBuf; use std::path::PathBuf;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use book::Book; use crate::book::Book;
use config::Config; use crate::config::Config;
use errors::*; use crate::errors::*;
/// An arbitrary `mdbook` backend. /// An arbitrary `mdbook` backend.
/// ///
@ -78,7 +77,7 @@ impl RenderContext {
RenderContext { RenderContext {
book, book,
config, config,
version: ::MDBOOK_VERSION.to_string(), version: crate::MDBOOK_VERSION.to_string(),
root: root.into(), root: root.into(),
destination: destination.into(), destination: destination.into(),
__non_exhaustive: (), __non_exhaustive: (),

View File

@ -9,7 +9,7 @@ use std::fs::File;
use std::io::Read; use std::io::Read;
use std::path::Path; use std::path::Path;
use errors::*; use crate::errors::*;
pub static INDEX: &'static [u8] = include_bytes!("index.hbs"); pub static INDEX: &'static [u8] = include_bytes!("index.hbs");
pub static HEADER: &'static [u8] = include_bytes!("header.hbs"); pub static HEADER: &'static [u8] = include_bytes!("header.hbs");

View File

@ -1,4 +1,4 @@
use errors::*; use crate::errors::*;
use std::convert::Into; use std::convert::Into;
use std::fs::{self, File}; use std::fs::{self, File};
use std::io::{Read, Write}; use std::io::{Read, Write};
@ -39,8 +39,6 @@ pub fn write_file<P: AsRef<Path>>(build_dir: &Path, filename: P, content: &[u8])
/// directory from where the path starts. /// directory from where the path starts.
/// ///
/// ```rust /// ```rust
/// # extern crate mdbook;
/// #
/// # use std::path::Path; /// # use std::path::Path;
/// # use mdbook::utils::fs::path_to_root; /// # use mdbook::utils::fs::path_to_root;
/// # /// #
@ -188,8 +186,6 @@ pub fn copy_files_except_ext(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
extern crate tempfile;
use super::copy_files_except_ext; use super::copy_files_except_ext;
use std::fs; use std::fs;

View File

@ -2,7 +2,7 @@
pub mod fs; pub mod fs;
mod string; mod string;
use errors::Error; use crate::errors::Error;
use regex::Regex; use regex::Regex;
use pulldown_cmark::{ use pulldown_cmark::{

View File

@ -1,8 +1,5 @@
//! Integration tests to make sure alternative backends work. //! Integration tests to make sure alternative backends work.
extern crate mdbook;
extern crate tempfile;
use mdbook::config::Config; use mdbook::config::Config;
use mdbook::MDBook; use mdbook::MDBook;
#[cfg(not(windows))] #[cfg(not(windows))]

View File

@ -1,8 +1,6 @@
extern crate mdbook;
mod dummy_book; mod dummy_book;
use dummy_book::DummyBook; use crate::dummy_book::DummyBook;
use mdbook::book::Book; use mdbook::book::Book;
use mdbook::config::Config; use mdbook::config::Config;
use mdbook::errors::*; use mdbook::errors::*;

View File

@ -1,8 +1,6 @@
extern crate mdbook;
mod dummy_book; mod dummy_book;
use dummy_book::DummyBook; use crate::dummy_book::DummyBook;
use mdbook::preprocess::{CmdPreprocessor, Preprocessor}; use mdbook::preprocess::{CmdPreprocessor, Preprocessor};
use mdbook::MDBook; use mdbook::MDBook;

View File

@ -3,9 +3,6 @@
// Not all features are used in all test crates, so... // Not all features are used in all test crates, so...
#![allow(dead_code, unused_variables, unused_imports, unused_extern_crates)] #![allow(dead_code, unused_variables, unused_imports, unused_extern_crates)]
extern crate mdbook;
extern crate tempfile;
extern crate walkdir;
use mdbook::errors::*; use mdbook::errors::*;
use mdbook::utils::fs::file_to_string; use mdbook::utils::fs::file_to_string;
@ -13,11 +10,9 @@ use std::fs::{self, File};
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::Path; use std::path::Path;
// The funny `self::` here is because we've got an `extern crate ...` and are use mdbook::MDBook;
// in a submodule use tempfile::{Builder as TempFileBuilder, TempDir};
use self::mdbook::MDBook; use walkdir::WalkDir;
use self::tempfile::{Builder as TempFileBuilder, TempDir};
use self::walkdir::WalkDir;
/// Create a dummy book in a temporary directory, using the contents of /// Create a dummy book in a temporary directory, using the contents of
/// `SUMMARY_MD` as a guide. /// `SUMMARY_MD` as a guide.

View File

@ -1,6 +1,3 @@
extern crate mdbook;
extern crate tempfile;
use mdbook::config::Config; use mdbook::config::Config;
use mdbook::MDBook; use mdbook::MDBook;
use std::fs; use std::fs;

View File

@ -1,10 +1,6 @@
//! Some integration tests to make sure the `SUMMARY.md` parser can deal with //! Some integration tests to make sure the `SUMMARY.md` parser can deal with
//! some real-life examples. //! some real-life examples.
extern crate env_logger;
extern crate error_chain;
extern crate mdbook;
use mdbook::book; use mdbook::book;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;

View File

@ -1,13 +1,9 @@
extern crate mdbook;
#[macro_use] #[macro_use]
extern crate pretty_assertions; extern crate pretty_assertions;
extern crate select;
extern crate tempfile;
extern crate walkdir;
mod dummy_book; mod dummy_book;
use dummy_book::{assert_contains_strings, assert_doesnt_contain_strings, DummyBook}; use crate::dummy_book::{assert_contains_strings, assert_doesnt_contain_strings, DummyBook};
use mdbook::config::Config; use mdbook::config::Config;
use mdbook::errors::*; use mdbook::errors::*;
@ -434,8 +430,7 @@ fn no_index_for_print_html() {
#[cfg(feature = "search")] #[cfg(feature = "search")]
mod search { mod search {
extern crate serde_json; use crate::dummy_book::DummyBook;
use dummy_book::DummyBook;
use mdbook::utils::fs::file_to_string; use mdbook::utils::fs::file_to_string;
use mdbook::MDBook; use mdbook::MDBook;
use std::fs::File; use std::fs::File;

View File

@ -1,8 +1,6 @@
extern crate mdbook;
mod dummy_book; mod dummy_book;
use dummy_book::DummyBook; use crate::dummy_book::DummyBook;
use mdbook::MDBook; use mdbook::MDBook;