Format Rust code using rustfmt

This commit is contained in:
github-actions[bot] 2023-12-19 22:05:20 +00:00 committed by GitHub
parent 859d7db4fa
commit 7a43270559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,14 +159,13 @@ fn main() {
run_command(Command::new("touch").args([&format!("{}/world", pwd.display())])).unwrap(); run_command(Command::new("touch").args([&format!("{}/world", pwd.display())])).unwrap();
// Build wasm32-wasi apps, zip, and add to bootstrapped_processes.rs // Build wasm32-wasi apps, zip, and add to bootstrapped_processes.rs
let mut bootstrapped_processes = fs::File::create(format!( let mut bootstrapped_processes =
"{}/src/bootstrapped_processes.rs", fs::File::create(format!("{}/src/bootstrapped_processes.rs", pwd.display(),)).unwrap();
pwd.display(),
)).unwrap();
writeln!( writeln!(
bootstrapped_processes, bootstrapped_processes,
"pub static BOOTSTRAPPED_PROCESSES: &[(&str, &'static [u8])] = &[", "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &'static [u8])] = &[",
).unwrap(); )
.unwrap();
let modules_dir = format!("{}/modules", pwd.display()); let modules_dir = format!("{}/modules", pwd.display());
for entry in std::fs::read_dir(modules_dir).unwrap() { for entry in std::fs::read_dir(modules_dir).unwrap() {
let entry_path = entry.unwrap().path(); let entry_path = entry.unwrap().path();
@ -193,15 +192,8 @@ fn main() {
} }
// After processing all sub-apps, zip the parent's pkg/ directory // After processing all sub-apps, zip the parent's pkg/ directory
let zip_filename = format!( let zip_filename = format!("{}.zip", entry_path.file_name().unwrap().to_str().unwrap(),);
"{}.zip", let zip_path = format!("{}/target/{}", pwd.display(), zip_filename,);
entry_path.file_name().unwrap().to_str().unwrap(),
);
let zip_path = format!(
"{}/target/{}",
pwd.display(),
zip_filename,
);
let writer = std::fs::File::create(&zip_path).unwrap(); let writer = std::fs::File::create(&zip_path).unwrap();
let options = zip::write::FileOptions::default() let options = zip::write::FileOptions::default()
.compression_method(zip::CompressionMethod::Stored) .compression_method(zip::CompressionMethod::Stored)
@ -233,9 +225,9 @@ fn main() {
writeln!( writeln!(
bootstrapped_processes, bootstrapped_processes,
" (\"{}\", include_bytes!(\"{}\")),", " (\"{}\", include_bytes!(\"{}\")),",
zip_filename, zip_filename, zip_path,
zip_path, )
).unwrap(); .unwrap();
} }
writeln!(bootstrapped_processes, "];").unwrap(); writeln!(bootstrapped_processes, "];").unwrap();
} }