From 1826fbd65e005ad6cb16dda19bc76fbf3b7ff272 Mon Sep 17 00:00:00 2001 From: Michael Bryan Date: Mon, 21 Aug 2017 22:59:19 +0800 Subject: [PATCH] Removed an unused function --- src/book/book.rs | 8 ++++---- src/book/mod.rs | 14 ++++++++++---- src/book/summary.rs | 5 ----- src/lib.rs | 2 +- src/renderer/html_handlebars/hbs_renderer.rs | 2 +- tests/loading.rs | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/book/book.rs b/src/book/book.rs index 3acb697f..61e89909 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -88,7 +88,7 @@ impl Chapter { /// /// You need to pass in the book's source directory because all the links in /// `SUMMARY.md` give the chapter locations relative to it. -pub fn load_book_from_disk>(summary: &Summary, src_dir: P) -> Result { +fn load_book_from_disk>(summary: &Summary, src_dir: P) -> Result { debug!("[*] Loading the book from disk"); let src_dir = src_dir.as_ref(); @@ -229,9 +229,9 @@ And here is some more text. let mut second = Link::new("Nested Chapter 1", &second_path); second.number = Some(SectionNumber(vec![1, 2])); - root.push_item(second.clone()); - root.push_item(SummaryItem::Separator); - root.push_item(second.clone()); + root.nested_items.push(second.clone().into()); + root.nested_items.push(SummaryItem::Separator); + root.nested_items.push(second.clone().into()); (root, temp_dir) } diff --git a/src/book/mod.rs b/src/book/mod.rs index e8f58343..b78fc263 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -1,7 +1,10 @@ -pub mod book; -pub mod summary; +//! The internal representation of a `Book`. -use self::book::{load_book, Book, BookItem, BookItems}; +mod book; +mod summary; + +pub use self::book::{load_book, Book, BookItem, BookItems, Chapter}; +pub use self::summary::SectionNumber; use std::path::{Path, PathBuf}; use std::fs::{self, File}; @@ -19,6 +22,9 @@ use config::tomlconfig::TomlConfig; use config::htmlconfig::HtmlConfig; use config::jsonconfig::JsonConfig; + +/// A helper for managing the `Book`, its configuration, and the rendering +/// process. pub struct MDBook { config: BookConfig, @@ -85,7 +91,7 @@ impl MDBook { /// ```no_run /// # extern crate mdbook; /// # use mdbook::MDBook; - /// # use mdbook::book::book::BookItem; + /// # use mdbook::book::BookItem; /// # #[allow(unused_variables)] /// # fn main() { /// # let book = MDBook::new("mybook"); diff --git a/src/book/summary.rs b/src/book/summary.rs index f02942fe..009b33e1 100644 --- a/src/book/summary.rs +++ b/src/book/summary.rs @@ -86,11 +86,6 @@ impl Link { nested_items: Vec::new(), } } - - /// Add an item to this link's `nested_items`. - pub fn push_item>(&mut self, item: I) { - self.nested_items.push(item.into()); - } } impl Default for Link { diff --git a/src/lib.rs b/src/lib.rs index b3c373db..242437d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -99,7 +99,7 @@ pub mod theme; pub mod utils; pub use book::MDBook; -pub use book::book::Book; +pub use book::Book; pub use renderer::Renderer; /// The error types used through out this crate. diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 0b2138bb..d90ad754 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -4,7 +4,7 @@ use renderer::Renderer; use book::MDBook; use config::PlaypenConfig; use theme::{self, Theme, playpen_editor}; -use book::book::{BookItem, Chapter}; +use book::{BookItem, Chapter}; use utils; use errors::*; use regex::{Regex, Captures}; diff --git a/tests/loading.rs b/tests/loading.rs index f3ce86a3..356c7e81 100644 --- a/tests/loading.rs +++ b/tests/loading.rs @@ -5,7 +5,7 @@ extern crate env_logger; use std::path::PathBuf; -use mdbook::book::book::load_book; +use mdbook::book::load_book; #[test]