diff --git a/src/book/book.rs b/src/book/book.rs index 3d3ad84d..25bd63b8 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -245,7 +245,8 @@ fn load_chapter>( ch.number = link.number.clone(); sub_item_parents.push(link.name.clone()); - let sub_items = link.nested_items + let sub_items = link + .nested_items .iter() .map(|i| load_summary_item(i, src_dir, sub_item_parents.clone())) .collect::>>()?; @@ -475,7 +476,8 @@ And here is some \ assert_eq!(got.len(), 5); // checking the chapter names are in the order should be sufficient here... - let chapter_names: Vec = got.into_iter() + let chapter_names: Vec = got + .into_iter() .filter_map(|i| match *i { BookItem::Chapter(ref ch) => Some(ch.name.clone()), _ => None, diff --git a/src/book/init.rs b/src/book/init.rs index 5347759a..202b3ec5 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -110,7 +110,8 @@ impl BookBuilder { fn copy_across_theme(&self) -> Result<()> { debug!("Copying theme"); - let themedir = self.config + let themedir = self + .config .html_config() .and_then(|html| html.theme) .unwrap_or_else(|| self.config.book.src.join("theme")); diff --git a/src/book/summary.rs b/src/book/summary.rs index dacf2c9f..9e2ddd2d 100644 --- a/src/book/summary.rs +++ b/src/book/summary.rs @@ -221,11 +221,14 @@ impl<'a> SummaryParser<'a> { fn parse(mut self) -> Result { let title = self.parse_title(); - let prefix_chapters = self.parse_affix(true) + let prefix_chapters = self + .parse_affix(true) .chain_err(|| "There was an error parsing the prefix chapters")?; - let numbered_chapters = self.parse_numbered() + let numbered_chapters = self + .parse_numbered() .chain_err(|| "There was an error parsing the numbered chapters")?; - let suffix_chapters = self.parse_affix(false) + let suffix_chapters = self + .parse_affix(false) .chain_err(|| "There was an error parsing the suffix chapters")?; Ok(Summary { diff --git a/src/cmd/test.rs b/src/cmd/test.rs index dac841c6..e215f028 100644 --- a/src/cmd/test.rs +++ b/src/cmd/test.rs @@ -28,7 +28,8 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { // test command implementation pub fn execute(args: &ArgMatches) -> Result<()> { - let library_paths: Vec<&str> = args.values_of("library-path") + let library_paths: Vec<&str> = args + .values_of("library-path") .map(|v| v.collect()) .unwrap_or_default(); let book_dir = get_book_dir(args); diff --git a/src/config.rs b/src/config.rs index bbbd6982..338d7191 100644 --- a/src/config.rs +++ b/src/config.rs @@ -534,11 +534,7 @@ trait Updateable<'de>: Serialize + Deserialize<'de> { } } -impl<'de, T> Updateable<'de> for T -where - T: Serialize + Deserialize<'de>, -{ -} +impl<'de, T> Updateable<'de> for T where T: Serialize + Deserialize<'de> {} #[cfg(test)] mod tests { diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 7b24d132..d29707b4 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -37,7 +37,8 @@ impl HtmlHandlebars { print_content.push_str(&content); // Update the context with data for this file - let path = ch.path + let path = ch + .path .to_str() .chain_err(|| "Could not convert path to str")?; let filepath = Path::new(&ch.path).with_extension("html"); @@ -50,7 +51,8 @@ impl HtmlHandlebars { // Non-lexical lifetimes needed :'( let title: String; { - let book_title = ctx.data + let book_title = ctx + .data .get("book_title") .and_then(serde_json::Value::as_str) .unwrap_or(""); @@ -465,7 +467,8 @@ fn make_data( } chapter.insert("name".to_owned(), json!(ch.name)); - let path = ch.path + let path = ch + .path .to_str() .chain_err(|| "Could not convert path to str")?; chapter.insert("path".to_owned(), json!(path)); diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs index 0cb19174..2e3fd40a 100644 --- a/src/renderer/html_handlebars/helpers/navigation.rs +++ b/src/renderer/html_handlebars/helpers/navigation.rs @@ -53,7 +53,8 @@ fn find_chapter(rc: &mut RenderContext, target: Target) -> Result>>(c.clone()) .map_err(|_| RenderError::new("Could not decode the JSON data")) })?; - let current = rc.evaluate_absolute("path", true)? + let current = rc + .evaluate_absolute("path", true)? .as_str() .ok_or_else(|| RenderError::new("Type error for `path`, string expected"))? .replace("\"", ""); diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 65dd9e7d..906f7e27 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -157,7 +157,8 @@ impl Renderer for CmdRenderer { let _ = fs::create_dir_all(&ctx.destination); - let mut child = match self.compose_command()? + let mut child = match self + .compose_command()? .stdin(Stdio::piped()) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) diff --git a/src/utils/mod.rs b/src/utils/mod.rs index ceaf8719..3467e72d 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -36,7 +36,8 @@ pub fn normalize_id(content: &str) -> String { }) .collect::(); // Ensure that the first character is [A-Za-z] - if ret.chars() + if ret + .chars() .next() .map_or(false, |c| !c.is_ascii_alphabetic()) { @@ -110,7 +111,8 @@ pub fn render_markdown(text: &str, curly_quotes: bool) -> String { let p = Parser::new_ext(text, opts); let mut converter = EventQuoteConverter::new(curly_quotes); - let events = p.map(clean_codeblock_headers) + let events = p + .map(clean_codeblock_headers) .map(adjust_links) .map(|event| converter.convert(event)); diff --git a/tests/rendered_output.rs b/tests/rendered_output.rs index c20b454e..44aed62b 100644 --- a/tests/rendered_output.rs +++ b/tests/rendered_output.rs @@ -174,7 +174,8 @@ fn chapter_files_were_rendered_to_html() { .filter(|path| path.file_name().and_then(OsStr::to_str) != Some("SUMMARY.md")); for chapter in chapter_files { - let rendered_location = temp.path() + let rendered_location = temp + .path() .join(chapter.strip_prefix(&src).unwrap()) .with_extension("html"); assert!( @@ -213,7 +214,8 @@ fn check_second_toc_level() { let pred = descendants!(Class("chapter"), Name("li"), Name("li"), Name("a")); - let mut children_of_children: Vec<_> = doc.find(pred) + let mut children_of_children: Vec<_> = doc + .find(pred) .map(|elem| elem.text().trim().to_string()) .collect(); children_of_children.sort(); @@ -231,7 +233,8 @@ fn check_first_toc_level() { let pred = descendants!(Class("chapter"), Name("li"), Name("a")); - let mut children: Vec<_> = doc.find(pred) + let mut children: Vec<_> = doc + .find(pred) .map(|elem| elem.text().trim().to_string()) .collect(); children.sort(); @@ -244,7 +247,8 @@ fn check_spacers() { let doc = root_index_html().unwrap(); let should_be = 1; - let num_spacers = doc.find(Class("chapter").descendant(Name("li").and(Class("spacer")))) + let num_spacers = doc + .find(Class("chapter").descendant(Name("li").and(Class("spacer")))) .count(); assert_eq!(num_spacers, should_be); }