Skip to content

Commit 3bb2762

Browse files
committed
Apply cargo fmt suggestions
1 parent 64232f0 commit 3bb2762

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

src/module.rs

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,22 +268,28 @@ impl Input {
268268
.swap_greed(true)
269269
.build()
270270
.unwrap();
271-
template_with_replacements = multi_comments.replace(&template_with_replacements, "").to_string();
271+
template_with_replacements = multi_comments
272+
.replace(&template_with_replacements, "")
273+
.to_string();
272274

273275
// Delete single-line comments
274276
let single_comments: Regex = RegexBuilder::new(r"^//.*\n")
275277
.multi_line(true)
276278
.swap_greed(true)
277279
.build()
278280
.unwrap();
279-
template_with_replacements = single_comments.replace_all(&template_with_replacements, "").to_string();
281+
template_with_replacements = single_comments
282+
.replace_all(&template_with_replacements, "")
283+
.to_string();
280284

281285
// Delete leading white space left over by the deleted comments
282286
let leading_whitespace: Regex = RegexBuilder::new(r"^[\s\n]*")
283287
.multi_line(true)
284288
.build()
285289
.unwrap();
286-
template_with_replacements = leading_whitespace.replace(&template_with_replacements, "").to_string();
290+
template_with_replacements = leading_whitespace
291+
.replace(&template_with_replacements, "")
292+
.to_string();
287293
}
288294

289295
template_with_replacements
@@ -316,9 +322,9 @@ impl Module {
316322

317323
#[cfg(test)]
318324
mod tests {
325+
use crate::module::Input;
319326
use crate::module::Module;
320327
use crate::module::ModuleType;
321-
use crate::module::Input;
322328
use crate::Options;
323329

324330
fn basic_options() -> Options {
@@ -333,21 +339,40 @@ mod tests {
333339
#[test]
334340
fn check_basic_assembly_fields() {
335341
let options = basic_options();
336-
let assembly = Module::new(ModuleType::Assembly, "A testing assembly with /special-characters*", &options);
342+
let assembly = Module::new(
343+
ModuleType::Assembly,
344+
"A testing assembly with /special-characters*",
345+
&options,
346+
);
337347

338348
assert_eq!(assembly.mod_type, ModuleType::Assembly);
339-
assert_eq!(assembly.title, "A testing assembly with /special-characters*");
349+
assert_eq!(
350+
assembly.title,
351+
"A testing assembly with /special-characters*"
352+
);
340353
assert_eq!(assembly.id, "a-testing-assembly-with-special-characters");
341-
assert_eq!(assembly.file_name, "assembly_a-testing-assembly-with-special-characters.adoc");
354+
assert_eq!(
355+
assembly.file_name,
356+
"assembly_a-testing-assembly-with-special-characters.adoc"
357+
);
342358
assert_eq!(assembly.include_statement, "include::<path>/assembly_a-testing-assembly-with-special-characters.adoc[leveloffset=+1]");
343359
assert_eq!(assembly.includes, None);
344360
}
345361

346362
#[test]
347363
fn check_module_builder_and_new() {
348364
let options = basic_options();
349-
let from_new: Module = Module::new(ModuleType::Assembly, "A testing assembly with /special-characters*", &options);
350-
let from_builder: Module = Input::new(ModuleType::Assembly, "A testing assembly with /special-characters*", &options).into();
365+
let from_new: Module = Module::new(
366+
ModuleType::Assembly,
367+
"A testing assembly with /special-characters*",
368+
&options,
369+
);
370+
let from_builder: Module = Input::new(
371+
ModuleType::Assembly,
372+
"A testing assembly with /special-characters*",
373+
&options,
374+
)
375+
.into();
351376
assert_eq!(from_new, from_builder);
352377
}
353378
}

0 commit comments

Comments
 (0)