summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml7
-rw-r--r--README.md12
-rw-r--r--examples/de-emphasize.rs5
-rw-r--r--examples/nop-preprocessor.rs6
-rw-r--r--src/book/book.rs4
-rw-r--r--src/book/init.rs7
-rw-r--r--src/book/mod.rs11
-rw-r--r--src/book/summary.rs2
-rw-r--r--src/cmd/build.rs2
-rw-r--r--src/cmd/clean.rs2
-rw-r--r--src/cmd/init.rs2
-rw-r--r--src/cmd/serve.rs11
-rw-r--r--src/cmd/test.rs2
-rw-r--r--src/cmd/watch.rs10
-rw-r--r--src/config.rs5
-rw-r--r--src/lib.rs18
-rw-r--r--src/main.rs5
-rw-r--r--src/preprocess/cmd.rs7
-rw-r--r--src/preprocess/index.rs4
-rw-r--r--src/preprocess/links.rs8
-rw-r--r--src/preprocess/mod.rs8
-rw-r--r--src/renderer/html_handlebars/hbs_renderer.rs17
-rw-r--r--src/renderer/html_handlebars/helpers/navigation.rs3
-rw-r--r--src/renderer/html_handlebars/helpers/toc.rs3
-rw-r--r--src/renderer/html_handlebars/search.rs18
-rw-r--r--src/renderer/mod.rs9
-rw-r--r--src/theme/mod.rs2
-rw-r--r--src/utils/fs.rs6
-rw-r--r--src/utils/mod.rs2
-rw-r--r--tests/alternative_backends.rs3
-rw-r--r--tests/build_process.rs4
-rw-r--r--tests/custom_preprocessors.rs4
-rw-r--r--tests/dummy_book/mod.rs11
-rw-r--r--tests/init.rs3
-rw-r--r--tests/parse_existing_summary_files.rs4
-rw-r--r--tests/rendered_output.rs9
-rw-r--r--tests/testing.rs4
37 files changed, 82 insertions, 158 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 29971faa..5f569d40 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,13 +6,14 @@ authors = [
"Michael-F-Bryan <michaelfbryan@gmail.com>",
"Matt Ickstadt <mattico8@gmail.com>"
]
-description = "Creates a book from markdown files"
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"]
license = "MPL-2.0"
readme = "README.md"
-exclude = ["book-example/*"]
+repository = "https://github.com/rust-lang-nursery/mdBook"
+description = "Creates a book from markdown files"
[dependencies]
clap = "2.24"
diff --git a/README.md b/README.md
index 64c544c7..dfe56a2d 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
<tr>
<td><strong>Linux / OS X</strong></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>
</tr>
<tr>
@@ -65,7 +65,7 @@ There are multiple ways to install mdBook.
cargo install mdbook --vers "^0.1.0"
```
-3. **From Git**
+3. **From Git**
The version published to crates.io will ever so slightly be behind the
version hosted here on GitHub. If you need the latest version you can build
@@ -77,7 +77,7 @@ There are multiple ways to install mdBook.
Again, make sure to add the Cargo bin directory to your `PATH`.
-4. **For Contributions**
+4. **For Contributions**
If you want to contribute to mdBook you will have to clone the repository on
your local machine:
@@ -152,9 +152,9 @@ party plugins. These plugins are just programs which will be invoked during the
build process and are split into roughly two categories, *preprocessors* and
*renderers*.
-Preprocessors are used to transform a book before it is sent to a renderer.
-One example would be to replace all occurrences of
-`{{#include some_file.ext}}` with the contents of that file. Some existing
+Preprocessors are used to transform a book before it is sent to a renderer.
+One example would be to replace all occurrences of
+`{{#include some_file.ext}}` with the contents of that file. Some existing
preprocessors are:
- `index` - a built-in preprocessor (enabled by default) which will transform
diff --git a/examples/de-emphasize.rs b/examples/de-emphasize.rs
index 1cdf0823..eefab73d 100644
--- a/examples/de-emphasize.rs
+++ b/examples/de-emphasize.rs
@@ -1,10 +1,5 @@
//! An example preprocessor for removing all forms of emphasis from a markdown
//! book.
-
-extern crate mdbook;
-extern crate pulldown_cmark;
-extern crate pulldown_cmark_to_cmark;
-
use mdbook::book::{Book, BookItem, Chapter};
use mdbook::errors::{Error, Result};
use mdbook::preprocess::{Preprocessor, PreprocessorContext};
diff --git a/examples/nop-preprocessor.rs b/examples/nop-preprocessor.rs
index 8ee2c250..f1766944 100644
--- a/examples/nop-preprocessor.rs
+++ b/examples/nop-preprocessor.rs
@@ -1,12 +1,8 @@
-extern crate clap;
-extern crate mdbook;
-extern crate serde_json;
-
+use crate::nop_lib::Nop;
use clap::{App, Arg, ArgMatches, SubCommand};
use mdbook::book::Book;
use mdbook::errors::Error;
use mdbook::preprocess::{CmdPreprocessor, Preprocessor, PreprocessorContext};
-use nop_lib::Nop;
use std::io;
use std::process;
diff --git a/src/book/book.rs b/src/book/book.rs
index f4870f1f..6a31c9e8 100644
--- a/src/book/book.rs
+++ b/src/book/book.rs
@@ -5,8 +5,8 @@ use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use super::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem};
-use config::BuildConfig;
-use errors::*;
+use crate::config::BuildConfig;
+use crate::errors::*;
/// Load a book into memory from its `src/` directory.
pub fn load_book<P: AsRef<Path>>(src_dir: P, cfg: &BuildConfig) -> Result<Book> {
diff --git a/src/book/init.rs b/src/book/init.rs
index a70006bb..f940e1fa 100644
--- a/src/book/init.rs
+++ b/src/book/init.rs
@@ -1,12 +1,11 @@
use std::fs::{self, File};
use std::io::Write;
use std::path::PathBuf;
-use toml;
use super::MDBook;
-use config::Config;
-use errors::*;
-use theme;
+use crate::config::Config;
+use crate::errors::*;
+use crate::theme;
/// A helper for setting up a new book and its directory structure.
#[derive(Debug, Clone, PartialEq)]
diff --git a/src/book/mod.rs b/src/book/mod.rs
index 040e7265..3b25c68e 100644
--- a/src/book/mod.rs
+++ b/src/book/mod.rs
@@ -20,14 +20,14 @@ use std::string::ToString;
use tempfile::Builder as TempFileBuilder;
use toml::Value;
-use errors::*;
-use preprocess::{
+use crate::errors::*;
+use crate::preprocess::{
CmdPreprocessor, IndexPreprocessor, LinkPreprocessor, Preprocessor, PreprocessorContext,
};
-use renderer::{CmdRenderer, HtmlHandlebars, RenderContext, Renderer};
-use utils;
+use crate::renderer::{CmdRenderer, HtmlHandlebars, RenderContext, Renderer};
+use crate::utils;
-use config::Config;
+use crate::config::Config;
/// The object used to manage and build a book.
pub struct MDBook {
@@ -124,7 +124,6 @@ impl MDBook {
/// `(section: String, bookitem: &BookItem)`
///
/// ```no_run
- /// # extern crate mdbook;
/// # use mdbook::MDBook;
/// # use mdbook::book::BookItem;
/// # #[allow(unused_variables)]
diff --git a/src/book/summary.rs b/src/book/summary.rs
index e61a3459..2c32cbd8 100644
--- a/src/book/summary.rs
+++ b/src/book/summary.rs
@@ -1,4 +1,4 @@
-use errors::*;
+use crate::errors::*;
use memchr::{self, Memchr};
use pulldown_cmark::{self, Event, Tag};
use std::fmt::{self, Display, Formatter};
diff --git a/src/cmd/build.rs b/src/cmd/build.rs
index da42015e..d1c66302 100644
--- a/src/cmd/build.rs
+++ b/src/cmd/build.rs
@@ -1,7 +1,7 @@
+use crate::{get_book_dir, open};
use clap::{App, ArgMatches, SubCommand};
use mdbook::errors::Result;
use mdbook::MDBook;
-use {get_book_dir, open};
// Create clap subcommand arguments
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
diff --git a/src/cmd/clean.rs b/src/cmd/clean.rs
index 5045dc74..420037d7 100644
--- a/src/cmd/clean.rs
+++ b/src/cmd/clean.rs
@@ -1,5 +1,5 @@
+use crate::get_book_dir;
use clap::{App, ArgMatches, SubCommand};
-use get_book_dir;
use mdbook::errors::*;
use mdbook::MDBook;
use std::fs;
diff --git a/src/cmd/init.rs b/src/cmd/init.rs
index 2bea7a38..1a49f0d3 100644
--- a/src/cmd/init.rs
+++ b/src/cmd/init.rs
@@ -1,5 +1,5 @@
+use crate::get_book_dir;
use clap::{App, ArgMatches, SubCommand};
-use get_book_dir;
use mdbook::config;
use mdbook::errors::Result;
use mdbook::MDBook;
diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs
index ce194da6..3c8c53dc 100644
--- a/src/cmd/serve.rs
+++ b/src/cmd/serve.rs
@@ -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")]
use super::watch;
+use crate::{get_book_dir, open};
use clap::{App, Arg, ArgMatches, SubCommand};
+use iron::{status, AfterMiddleware, Chain, Iron, IronError, IronResult, Request, Response, Set};
use mdbook::errors::*;
use mdbook::utils;
use mdbook::MDBook;
-use std;
-use {get_book_dir, open};
struct ErrorRecover;
diff --git a/src/cmd/test.rs b/src/cmd/test.rs
index cad0ae14..f6d97aa6 100644
--- a/src/cmd/test.rs
+++ b/src/cmd/test.rs
@@ -1,5 +1,5 @@
+use crate::get_book_dir;
use clap::{App, Arg, ArgMatches, SubCommand};
-use get_book_dir;
use mdbook::errors::Result;
use mdbook::MDBook;
diff --git a/src/cmd/watch.rs b/src/cmd/watch.rs
index fc4d5c91..aa1594fa 100644
--- a/src/cmd/watch.rs
+++ b/src/cmd/watch.rs
@@ -1,15 +1,13 @@
-extern crate notify;
-
-use self::notify::Watcher;
+use crate::{get_book_dir, open};
use clap::{App, ArgMatches, SubCommand};
use mdbook::errors::Result;
use mdbook::utils;
use mdbook::MDBook;
+use notify::Watcher;
use std::path::{Path, PathBuf};
use std::sync::mpsc::channel;
use std::thread::sleep;
use std::time::Duration;
-use {get_book_dir, open};
// Create clap subcommand arguments
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
@@ -55,8 +53,8 @@ pub fn trigger_on_change<F>(book: &MDBook, closure: F)
where
F: Fn(Vec<PathBuf>, &Path),
{
- use self::notify::DebouncedEvent::*;
- use self::notify::RecursiveMode::*;
+ use notify::DebouncedEvent::*;
+ use notify::RecursiveMode::*;
// Create a channel to receive the events.
let (tx, rx) = channel();
diff --git a/src/config.rs b/src/config.rs
index 02a66421..b3707d8e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -9,9 +9,7 @@
//! # Examples
//!
//! ```rust
-//! # extern crate mdbook;
//! # use mdbook::errors::*;
-//! # extern crate toml;
//! use std::path::PathBuf;
//! use std::str::FromStr;
//! use mdbook::Config;
@@ -52,7 +50,6 @@
#![deny(missing_docs)]
use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use serde_json;
use std::env;
use std::fs::File;
use std::io::Read;
@@ -64,7 +61,7 @@ use toml_query::delete::TomlValueDeleteExt;
use toml_query::insert::TomlValueInsertExt;
use toml_query::read::TomlValueReadExt;
-use errors::*;
+use crate::errors::*;
/// The overall configuration object for MDBook, essentially an in-memory
/// representation of `book.toml`.
diff --git a/src/lib.rs b/src/lib.rs
index 60f63e30..0494d984 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -85,24 +85,14 @@
#[macro_use]
extern crate error_chain;
-extern crate handlebars;
-extern crate itertools;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
-extern crate memchr;
-extern crate pulldown_cmark;
-extern crate regex;
-extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
-extern crate shlex;
-extern crate tempfile;
-extern crate toml;
-extern crate toml_query;
#[cfg(test)]
#[macro_use]
@@ -121,10 +111,10 @@ pub mod utils;
/// compatibility checks.
pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");
-pub use book::BookItem;
-pub use book::MDBook;
-pub use config::Config;
-pub use renderer::Renderer;
+pub use crate::book::BookItem;
+pub use crate::book::MDBook;
+pub use crate::config::Config;
+pub use crate::renderer::Renderer;
/// The error types used through out this crate.
pub mod errors {
diff --git a/src/main.rs b/src/main.rs
index cd711ba4..78465d7c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,12 +1,7 @@
-extern crate chrono;
#[macro_use]
extern crate clap;
-extern crate env_logger;
-extern crate error_chain;
#[macro_use]
extern crate log;
-extern crate mdbook;
-extern crate open;
use chrono::Local;
use clap::{App, AppSettings, ArgMatches};
diff --git a/src/preprocess/cmd.rs b/src/preprocess/cmd.rs
index d548d90e..b16d365a 100644
--- a/src/preprocess/cmd.rs
+++ b/src/preprocess/cmd.rs
@@ -1,7 +1,6 @@
use super::{Preprocessor, PreprocessorContext};
-use book::Book;
-use errors::*;
-use serde_json;
+use crate::book::Book;
+use crate::errors::*;
use shlex::Shlex;
use std::io::{self, Read, Write};
use std::process::{Child, Command, Stdio};
@@ -168,8 +167,8 @@ impl Preprocessor for CmdPreprocessor {
#[cfg(test)]
mod tests {
use super::*;
+ use crate::MDBook;
use std::path::Path;
- use MDBook;
fn book_example() -> MDBook {
let example = Path::new(env!("CARGO_MANIFEST_DIR")).join("book-example");
diff --git a/src/preprocess/index.rs b/src/preprocess/index.rs
index d8e00fc1..f3256b81 100644
--- a/src/preprocess/index.rs
+++ b/src/preprocess/index.rs
@@ -1,10 +1,10 @@
use regex::Regex;
use std::path::Path;
-use errors::*;
+use crate::errors::*;
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
/// `README.md` is the de facto index file in markdown-based documentation.
diff --git a/src/preprocess/links.rs b/src/preprocess/links.rs
index f5a86905..6ee5667a 100644
--- a/src/preprocess/links.rs
+++ b/src/preprocess/links.rs
@@ -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 std::ops::{Range, RangeFrom, RangeFull, RangeTo};
use std::path::{Path, PathBuf};
-use utils::fs::file_to_string;
-use utils::take_lines;
use super::{Preprocessor, PreprocessorContext};
-use book::{Book, BookItem};
+use crate::book::{Book, BookItem};
const ESCAPE_CHAR: char = '\\';
const MAX_LINK_NESTED_DEPTH: usize = 10;
diff --git a/src/preprocess/mod.rs b/src/preprocess/mod.rs
index 1a305408..ebc34311 100644
--- a/src/preprocess/mod.rs
+++ b/src/preprocess/mod.rs
@@ -8,9 +8,9 @@ mod cmd;
mod index;
mod links;
-use book::Book;
-use config::Config;
-use errors::*;
+use crate::book::Book;
+use crate::config::Config;
+use crate::errors::*;
use std::path::PathBuf;
@@ -37,7 +37,7 @@ impl PreprocessorContext {
root,
config,
renderer,
- mdbook_version: ::MDBOOK_VERSION.to_string(),
+ mdbook_version: crate::MDBOOK_VERSION.to_string(),
__non_exhaustive: (),
}
}
diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs
index 82ced929..8f3c3320 100644
--- a/src/renderer/html_handlebars/hbs_renderer.rs
+++ b/src/renderer/html_handlebars/hbs_renderer.rs
@@ -1,10 +1,10 @@
-use book::{Book, BookItem};
-use config::{Config, HtmlConfig, Playpen};
-use errors::*;
-use renderer::html_handlebars::helpers;
-use renderer::{RenderContext, Renderer};
-use theme::{self, playpen_editor, Theme};
-use utils;
+use crate::book::{Book, BookItem};
+use crate::config::{Config, HtmlConfig, Playpen};
+use crate::errors::*;
+use crate::renderer::html_handlebars::helpers;
+use crate::renderer::{RenderContext, Renderer};
+use crate::theme::{self, playpen_editor, Theme};
+use crate::utils;
use std::collections::BTreeMap;
use std::collections::HashMap;
@@ -13,7 +13,6 @@ use std::path::{Path, PathBuf};
use handlebars::Handlebars;
use regex::{Captures, Regex};
-use serde_json;
#[derive(Default)]
pub struct HtmlHandlebars;
@@ -113,7 +112,7 @@ impl HtmlHandlebars {
theme: &Theme,
html_config: &HtmlConfig,
) -> Result<()> {
- use utils::fs::write_file;
+ use crate::utils::fs::write_file;
write_file(
destination,
diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs
index dd39400b..9264d598 100644
--- a/src/renderer/html_handlebars/helpers/navigation.rs
+++ b/src/renderer/html_handlebars/helpers/navigation.rs
@@ -2,9 +2,8 @@ use std::collections::BTreeMap;
use std::path::Path;
use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError, Renderable};
-use serde_json;
-use utils;
+use crate::utils;
type StringMap = BTreeMap<String, String>;
diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs
index ae085e5f..27986c8f 100644
--- a/src/renderer/html_handlebars/helpers/toc.rs
+++ b/src/renderer/html_handlebars/helpers/toc.rs
@@ -1,11 +1,10 @@
use std::collections::BTreeMap;
use std::path::Path;
-use utils;
+use crate::utils;
use handlebars::{Context, Handlebars, Helper, HelperDef, Output, RenderContext, RenderError};
use pulldown_cmark::{html, Event, Parser, Tag};
-use serde_json;
// Handlebars helper to construct TOC
#[derive(Clone, Copy)]
diff --git a/src/renderer/html_handlebars/search.rs b/src/renderer/html_handlebars/search.rs
index 0531a232..c5422b39 100644
--- a/src/renderer/html_handlebars/search.rs
+++ b/src/renderer/html_handlebars/search.rs
@@ -1,19 +1,15 @@
-extern crate ammonia;
-extern crate elasticlunr;
-
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::path::Path;
-use self::elasticlunr::Index;
+use elasticlunr::Index;
use pulldown_cmark::*;
-use serde_json;
-use book::{Book, BookItem};
-use config::Search;
-use errors::*;
-use theme::searcher;
-use utils;
+use crate::book::{Book, BookItem};
+use crate::config::Search;
+use crate::errors::*;
+use crate::theme::searcher;
+use crate::utils;
/// Creates all files required for search.
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> {
- use self::elasticlunr::config::{SearchBool, SearchOptions, SearchOptionsField};
+ use elasticlunr::config::{SearchBool, SearchOptions, SearchOptionsField};
use std::collections::BTreeMap;
#[derive(Serialize)]
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index ae26c6ac..d4243332 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -15,16 +15,15 @@ pub use self::html_handlebars::HtmlHandlebars;
mod html_handlebars;
-use serde_json;
use shlex::Shlex;
use std::fs;
use std::io::{self, Read};
use std::path::PathBuf;
use std::process::{Command, Stdio};
-use book::Book;
-use config::Config;
-use errors::*;
+use crate::book::Book;
+use crate::config::Config;
+use crate::errors::*;
/// An arbitrary `mdbook` backend.
///
@@ -78,7 +77,7 @@ impl RenderContext {
RenderContext {
book,
config,
- version: ::MDBOOK_VERSION.to_string(),
+ version: crate::MDBOOK_VERSION.to_string(),
root: root.into(),
destination: destination.into(),
__non_exhaustive: (),
diff --git a/src/theme/mod.rs b/src/theme/mod.rs
index 37d373ef..3598322a 100644
--- a/src/theme/mod.rs
+++ b/src/theme/mod.rs
@@ -9,7 +9,7 @@ use std::fs::File;
use std::io::Read;
use std::path::Path;
-use errors::*;
+use crate::errors::*;
pub static INDEX: &'static [u8] = include_bytes!("index.hbs");
pub static HEADER: &'static [u8] = include_bytes!("header.hbs");
diff --git a/src/utils/fs.rs b/src/utils/fs.rs
index 4e0aeb7d..97d19d2f 100644
--- a/src/utils/fs.rs
+++ b/src/utils/fs.rs
@@ -1,4 +1,4 @@
-use errors::*;
+use crate::errors::*;
use std::convert::Into;
use std::fs::{self, File};
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.
///
/// ```rust
-/// # extern crate mdbook;
-/// #
/// # use std::path::Path;
/// # use mdbook::utils::fs::path_to_root;
/// #
@@ -188,8 +186,6 @@ pub fn copy_files_except_ext(
#[cfg(test)]
mod tests {
- extern crate tempfile;
-
use super::copy_files_except_ext;
use std::fs;
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index 30c776fa..3f542cf8 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -2,7 +2,7 @@
pub mod fs;
mod string;
-use errors::Error;
+use crate::errors::Error;
use regex::Regex;
use pulldown_cmark::{
diff --git a/tests/alternative_backends.rs b/tests/alternative_backends.rs
index a8593889..ff2ab687 100644
--- a/tests/alternative_backends.rs
+++ b/tests/alternative_backends.rs
@@ -1,8 +1,5 @@
//! Integration tests to make sure alternative backends work.
-extern crate mdbook;
-extern crate tempfile;
-
use mdbook::config::Config;
use mdbook::MDBook;
#[cfg(not(windows))]
diff --git a/tests/build_process.rs b/tests/build_process.rs
index a1e49caa..10d0b4a9 100644
--- a/tests/build_process.rs
+++ b/tests/build_process.rs
@@ -1,8 +1,6 @@
-extern crate mdbook;
-
mod dummy_book;
-use dummy_book::DummyBook;
+use crate::dummy_book::DummyBook;
use mdbook::book::Book;
use mdbook::config::Config;
use mdbook::errors::*;
diff --git a/tests/custom_preprocessors.rs b/tests/custom_preprocessors.rs
index 6e71fbbd..8237602d 100644
--- a/tests/custom_preprocessors.rs
+++ b/tests/custom_preprocessors.rs
@@ -1,8 +1,6 @@
-extern crate mdbook;
-
mod dummy_book;
-use dummy_book::DummyBook;
+use crate::dummy_book::DummyBook;
use mdbook::preprocess::{CmdPreprocessor, Preprocessor};
use mdbook::MDBook;
diff --git a/tests/dummy_book/mod.rs b/tests/dummy_book/mod.rs
index 4fe24455..332c1f6f 100644
--- a/tests/dummy_book/mod.rs
+++ b/tests/dummy_book/mod.rs
@@ -3,9 +3,6 @@
// Not all features are used in all test crates, so...
#![allow(dead_code, unused_variables, unused_imports, unused_extern_crates)]
-extern crate mdbook;
-extern crate tempfile;
-extern crate walkdir;
use mdbook::errors::*;
use mdbook::utils::fs::file_to_string;
@@ -13,11 +10,9 @@ use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::Path;
-// The funny `self::` here is because we've got an `extern crate ...` and are
-// in a submodule
-use self::mdbook::MDBook;
-use self::tempfile::{Builder as TempFileBuilder, TempDir};
-use self::walkdir::WalkDir;
+use mdbook::MDBook;
+use tempfile::{Builder as TempFileBuilder, TempDir};
+use walkdir::WalkDir;
/// Create a dummy book in a temporary directory, using the contents of
/// `SUMMARY_MD` as a guide.
diff --git a/tests/init.rs b/tests/init.rs
index ed9aed7e..d54e4fb1 100644
--- a/tests/init.rs
+++ b/tests/init.rs
@@ -1,6 +1,3 @@
-extern crate mdbook;
-extern crate tempfile;
-
use mdbook::config::Config;
use mdbook::MDBook;
use std::fs;
diff --git a/tests/parse_existing_summary_files.rs b/tests/parse_existing_summary_files.rs
index 0366b5d0..5c75b0d5 100644
--- a/tests/parse_existing_summary_files.rs
+++ b/tests/parse_existing_summary_files.rs
@@ -1,10 +1,6 @@
//! Some integration tests to make sure the `SUMMARY.md` parser can deal with
//! some real-life examples.
-extern crate env_logger;
-extern crate error_chain;
-extern crate mdbook;
-
use mdbook::book;
use std::fs::File;
use std::io::Read;
diff --git a/tests/rendered_output.rs b/tests/rendered_output.rs
index e5d07243..12aa3a3b 100644
--- a/tests/rendered_output.rs
+++ b/tests/rendered_output.rs
@@ -1,13 +1,9 @@
-extern crate mdbook;
#[macro_use]
extern crate pretty_assertions;
-extern crate select;
-extern crate tempfile;
-extern crate walkdir;
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::errors::*;
@@ -434,8 +430,7 @@ fn no_index_for_print_html() {
#[cfg(feature = "search")]
mod search {
- extern crate serde_json;
- use dummy_book::DummyBook;
+ use crate::dummy_book::DummyBook;
use mdbook::utils::fs::file_to_string;
use mdbook::MDBook;
use std::fs::File;
diff --git a/tests/testing.rs b/tests/testing.rs
index 23e17371..92f9b7e1 100644
--- a/tests/testing.rs
+++ b/tests/testing.rs
@@ -1,8 +1,6 @@
-extern crate mdbook;
-
mod dummy_book;
-use dummy_book::DummyBook;
+use crate::dummy_book::DummyBook;
use mdbook::MDBook;