Skip to content

Commit 98de40b

Browse files
make main() alone handle process exit status
1 parent 217a0c8 commit 98de40b

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

examples/write_dir.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ enum CompressionMethod {
3030
Zstd,
3131
}
3232

33-
fn main() {
34-
std::process::exit(real_main());
35-
}
36-
37-
fn real_main() -> i32 {
33+
fn main() -> ! {
3834
let args = Args::parse();
3935
let src_dir = &args.source;
4036
let dst_file = &args.destination;
@@ -70,11 +66,15 @@ fn real_main() -> i32 {
7066
},
7167
};
7268
match doit(src_dir, dst_file, method) {
73-
Ok(_) => println!("done: {src_dir:?} written to {dst_file:?}"),
74-
Err(e) => eprintln!("Error: {e:?}"),
69+
Ok(_) => {
70+
println!("done: {src_dir:?} written to {dst_file:?}");
71+
std::process::exit(0);
72+
}
73+
Err(e) => {
74+
eprintln!("Error: {e:?}");
75+
std::process::abort();
76+
}
7577
}
76-
77-
0
7878
}
7979

8080
fn zip_dir<T>(

fuzz_read/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use afl::fuzz;
22
use std::io::{Read, Seek, SeekFrom};
33
use tikv_jemallocator::Jemalloc;
4-
use zip::cfg_if;
54
use zip::read::read_zipfile_from_stream;
65

76
const MAX_BYTES_TO_READ: u64 = 1 << 24;

0 commit comments

Comments
 (0)