From 9b1e224680cadf77f3a8093fe29c32cbb890ec6e Mon Sep 17 00:00:00 2001 From: Boris-Chengbiao Zhou Date: Sun, 8 May 2016 21:51:34 +0200 Subject: [PATCH] Fix no-default-features build --- src/bin/mdbook.rs | 4 +++- src/book/mod.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bin/mdbook.rs b/src/bin/mdbook.rs index 13ea9e79..ea6f410e 100644 --- a/src/bin/mdbook.rs +++ b/src/bin/mdbook.rs @@ -2,13 +2,14 @@ extern crate mdbook; #[macro_use] extern crate clap; -extern crate crossbeam; // Dependencies for the Watch feature #[cfg(feature = "watch")] extern crate notify; #[cfg(feature = "watch")] extern crate time; +#[cfg(feature = "watch")] +extern crate crossbeam; // Dependencies for the Serve feature #[cfg(feature = "serve")] @@ -269,6 +270,7 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf { // Calls the closure when a book source file is changed. This is blocking! +#[cfg(feature = "watch")] fn trigger_on_change(book: &mut MDBook, closure: F) -> () where F: Fn(notify::Event, &mut MDBook) -> () { diff --git a/src/book/mod.rs b/src/book/mod.rs index e86e7c1a..4e64092c 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -28,7 +28,6 @@ pub struct MDBook { pub content: Vec, renderer: Box, - #[cfg(feature = "serve")] livereload: Option, } @@ -57,6 +56,7 @@ impl MDBook { content: vec![], renderer: Box::new(HtmlHandlebars::new()), + livereload: None, } }