Skip to content

Commit acfe95c

Browse files
committed
Apply clippy's suggestion format-collect for build.rs
1 parent 3ccb14e commit acfe95c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

spdlog/build.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::{
22
env,
33
error::Error,
4+
fmt::Write,
45
fs,
56
path::{Path, PathBuf},
67
};
@@ -38,10 +39,13 @@ fn generate_code_test_utils() -> Result<(), Box<dyn Error>> {
3839

3940
fs::write(
4041
out_dir.join("common_for_doc_test.rs"),
41-
format!("mod test_utils {{\n{}\n}}", input)
42-
.lines()
43-
.map(|line| format!("# {}\n", line))
44-
.collect::<String>(),
42+
format!("mod test_utils {{\n{}\n}}", input).lines().fold(
43+
String::new(),
44+
|mut contents, line| {
45+
writeln!(&mut contents, "# {}", line).unwrap();
46+
contents
47+
},
48+
),
4549
)?;
4650
fs::write(
4751
out_dir.join("common_for_integration_test.rs"),

0 commit comments

Comments
 (0)