From f9add3e936787cdd7e6146fbd7315c8a73cc142f Mon Sep 17 00:00:00 2001 From: Hamir Mahal Date: Sat, 21 Sep 2024 15:56:13 -0700 Subject: [PATCH] fix: formatting in `src/` and `tests/` directories --- src/book/mod.rs | 4 +--- src/renderer/html_handlebars/hbs_renderer.rs | 7 ++----- tests/alternative_backends.rs | 4 +--- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/book/mod.rs b/src/book/mod.rs index dfd803c6..608ed166 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -508,9 +508,7 @@ fn determine_preprocessors(config: &Config) -> Result> if let Some(after) = table.get("after") { let after = after.as_array().ok_or_else(|| { - Error::msg(format!( - "Expected preprocessor.{name}.after to be an array" - )) + Error::msg(format!("Expected preprocessor.{name}.after to be an array")) })?; for before in after { let before = before.as_str().ok_or_else(|| { diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 4dd2b934..88214077 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -856,9 +856,7 @@ fn fix_code_blocks(html: &str) -> String { let classes = &caps[2].replace(',', " "); let after = &caps[3]; - format!( - r#""# - ) + format!(r#""#) }) .into_owned() } @@ -916,8 +914,7 @@ fn add_playground_pre( // we need to inject our own main let (attrs, code) = partition_source(code); - format!("# #![allow(unused)]\n{attrs}#fn main() {{\n{code}#}}") - .into() + format!("# #![allow(unused)]\n{attrs}#fn main() {{\n{code}#}}").into() }; content } diff --git a/tests/alternative_backends.rs b/tests/alternative_backends.rs index d5f1f0f4..8ed92439 100644 --- a/tests/alternative_backends.rs +++ b/tests/alternative_backends.rs @@ -121,9 +121,7 @@ fn dummy_book_with_backend( .unwrap(); if backend_is_optional { - config - .set(format!("output.{name}.optional"), true) - .unwrap(); + config.set(format!("output.{name}.optional"), true).unwrap(); } let md = MDBook::init(temp.path())