From 01f2879e10ba493e4d1bc4f618f07e8aa7e24ea4 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 6 Jan 2021 14:27:35 +0100 Subject: [PATCH] cargo fmt --- src/lib.rs | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a6c3f50..931d319 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::fmt::Write; + use mdbook::book::{Book, BookItem, Chapter}; use mdbook::errors::{Error, Result}; use mdbook::preprocess::{Preprocessor, PreprocessorContext}; @@ -67,7 +68,7 @@ fn build_toc(toc: &[(u32, String, String)]) -> String { // Start from the level of the first header. let mut last_lower = match toc_iter.peek() { Some((lvl, _, _)) => *lvl, - None => 0 + None => 0, }; let toc = toc.iter().map(|(lvl, name, slug)| { let lvl = *lvl; @@ -190,7 +191,10 @@ fn add_toc(content: &str, marker: &str) -> Result { }) .flatten(); - let opts = COptions { newlines_after_codeblock: 1, ..Default::default() }; + let opts = COptions { + newlines_after_codeblock: 1, + ..Default::default() + }; cmark_with_options(events, &mut buf, None, opts) .map(|_| buf) .map_err(|err| Error::msg(format!("Markdown serialization failed: {}", err))) @@ -248,10 +252,7 @@ mod test { ### Header 2.2.1"#; - assert_eq!( - expected, - add_toc(content, DEFAULT_MARKER).unwrap() - ); + assert_eq!(expected, add_toc(content, DEFAULT_MARKER).unwrap()); } #[test] @@ -284,10 +285,7 @@ mod test { ## Header 2.1"#; - assert_eq!( - expected, - add_toc(content, DEFAULT_MARKER).unwrap() - ); + assert_eq!(expected, add_toc(content, DEFAULT_MARKER).unwrap()); } #[test] @@ -309,10 +307,7 @@ mod test { |------|------| |Row 1|Row 2|"#; - assert_eq!( - expected, - add_toc(content, DEFAULT_MARKER).unwrap() - ); + assert_eq!(expected, add_toc(content, DEFAULT_MARKER).unwrap()); } #[test] @@ -361,10 +356,7 @@ mod test { # Another header `with inline` code"#; - assert_eq!( - expected, - add_toc(content, DEFAULT_MARKER).unwrap() - ); + assert_eq!(expected, add_toc(content, DEFAULT_MARKER).unwrap()); } #[test] @@ -411,10 +403,7 @@ mod test { ## User Preferences"#; - assert_eq!( - expected, - add_toc(content, DEFAULT_MARKER).unwrap() - ); + assert_eq!(expected, add_toc(content, DEFAULT_MARKER).unwrap()); } #[test] @@ -451,10 +440,7 @@ text"#; text"#; - assert_eq!( - expected, - add_toc(content, DEFAULT_MARKER).unwrap() - ); + assert_eq!(expected, add_toc(content, DEFAULT_MARKER).unwrap()); } #[test]