Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: simplify string formatting for readability #2442

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: formatting in src/ and tests/ directories
  • Loading branch information
hamirmahal committed Sep 21, 2024
commit f9add3e936787cdd7e6146fbd7315c8a73cc142f
4 changes: 1 addition & 3 deletions src/book/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,7 @@ fn determine_preprocessors(config: &Config) -> Result<Vec<Box<dyn Preprocessor>>

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(|| {
Expand Down
7 changes: 2 additions & 5 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,7 @@ fn fix_code_blocks(html: &str) -> String {
let classes = &caps[2].replace(',', " ");
let after = &caps[3];

format!(
r#"<code{before}class="{classes}"{after}>"#
)
format!(r#"<code{before}class="{classes}"{after}>"#)
})
.into_owned()
}
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 1 addition & 3 deletions tests/alternative_backends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down