remove many unwrap and enum_value_or_default

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-07-22 14:16:41 +08:00
parent 31b3c5d721
commit aa740f4263
26 changed files with 345 additions and 191 deletions

View File

@@ -153,10 +153,10 @@ pub fn start() -> ResultType<()> {
}
let exe_file = std::env::current_exe()?;
if exe_file.parent().is_none() {
let Some(cur_dir) = exe_file
.parent() else {
bail!("Cannot get parent of current exe file");
}
let cur_dir = exe_file.parent().unwrap();
};
let dll_file = cur_dir.join("WindowInjection.dll");
if !dll_file.exists() {
@@ -344,6 +344,7 @@ async fn set_privacy_mode_state(
}
pub(super) mod privacy_hook {
use super::*;
use std::sync::mpsc::{channel, Sender};
@@ -426,7 +427,7 @@ pub(super) mod privacy_hook {
}
Err(e) => {
// Fatal error
tx.send(format!("Unexpected err when hook {}", e)).unwrap();
allow_err!(tx.send(format!("Unexpected err when hook {}", e)));
return;
}
}