1
0
mirror of https://github.com/jht5945/buildj.git synced 2025-12-28 01:31:35 +08:00

match -> unwrap_or_else

This commit is contained in:
2019-08-04 22:07:00 +08:00
parent fa510c3459
commit afffde7f2c

View File

@@ -116,11 +116,8 @@ pub fn init_home_dir(home_sub_dir: &str) {
pub fn init_dir(dir: &str) {
if ! Path::new(dir).exists() {
match fs::create_dir_all(dir) {
Ok(_) => (),
Err(err) => {
print_message(MessageType::ERROR, &format!("Init dir {} failed: {}", dir, err));
},
}
fs::create_dir_all(dir).unwrap_or_else(|err| {
print_message(MessageType::ERROR, &format!("Init dir {} failed: {}", dir, err));
});
}
}