Skip to content

Commit ac0bfcc

Browse files
committed
fmt
1 parent 7d0136d commit ac0bfcc

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

build.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ fn build_v8(is_asan: bool) {
333333
.join("base")
334334
.join("options.h");
335335

336-
set_abseil_options_to_use_namespace(&abseil_options_path).expect("Failed to modify options.h");
336+
set_abseil_options_to_use_namespace(&abseil_options_path)
337+
.expect("Failed to modify options.h");
337338

338339
let gn_out = run_gn_gen(&gn_args);
339340
assert!(gn_out.exists());
@@ -1089,29 +1090,31 @@ fn env_bool(key: &str) -> bool {
10891090
)
10901091
}
10911092

1092-
fn set_abseil_options_to_use_namespace(options_path: &PathBuf) -> io::Result<()> {
1093+
fn set_abseil_options_to_use_namespace(
1094+
options_path: &PathBuf,
1095+
) -> io::Result<()> {
10931096
// Read the contents of options.h
10941097
let current_content = fs::read_to_string(&options_path)?;
1095-
1098+
10961099
// Create the expected content
10971100
let new_content = current_content
1098-
.lines()
1099-
.map(|line| {
1100-
if line.contains("#define ABSL_OPTION_USE_INLINE_NAMESPACE") {
1101-
"#define ABSL_OPTION_USE_INLINE_NAMESPACE 1".to_string()
1102-
} else if line.contains("#define ABSL_OPTION_INLINE_NAMESPACE_NAME") {
1103-
"#define ABSL_OPTION_INLINE_NAMESPACE_NAME v8".to_string()
1104-
} else {
1105-
line.to_string()
1106-
}
1107-
})
1108-
.collect::<Vec<String>>()
1109-
.join("\n");
1110-
1101+
.lines()
1102+
.map(|line| {
1103+
if line.contains("#define ABSL_OPTION_USE_INLINE_NAMESPACE") {
1104+
"#define ABSL_OPTION_USE_INLINE_NAMESPACE 1".to_string()
1105+
} else if line.contains("#define ABSL_OPTION_INLINE_NAMESPACE_NAME") {
1106+
"#define ABSL_OPTION_INLINE_NAMESPACE_NAME v8".to_string()
1107+
} else {
1108+
line.to_string()
1109+
}
1110+
})
1111+
.collect::<Vec<String>>()
1112+
.join("\n");
1113+
11111114
// Only write if content actually changed
11121115
if current_content != new_content {
1113-
let mut file = fs::File::create(&options_path)?;
1114-
file.write_all(new_content.as_bytes())?;
1116+
let mut file = fs::File::create(&options_path)?;
1117+
file.write_all(new_content.as_bytes())?;
11151118
}
11161119

11171120
Ok(())

0 commit comments

Comments
 (0)