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:56:51 +08:00
parent b214480f1d
commit 3f1cb85b61
2 changed files with 4 additions and 5 deletions

View File

@@ -19,4 +19,4 @@ pub fn download_url(url: &str, dest: &mut File) -> XResult<()> {
pub fn get_url(url: &str) -> XResult<String> {
Ok(reqwest::get(url)?.text()?)
}
}

View File

@@ -127,10 +127,9 @@ pub fn extract_jdk_and_wait(file_name: &str) {
Err(_) => return,
Ok(o) => o,
};
match local_util::extract_package_and_wait(&local_java_home_base_dir, file_name) {
Err(err) => print_message(MessageType::ERROR, &format!("Extract file: {}, failed: {}", file_name, err)),
Ok(_) => (),
};
local_util::extract_package_and_wait(&local_java_home_base_dir, file_name).unwrap_or_else(|err| {
print_message(MessageType::ERROR, &format!("Extract file: {}, failed: {}", file_name, err));
});
}
pub fn get_env() -> HashMap<String, String> {