refactor: remove panic-prone unwrap and expect calls

This commit is contained in:
lbl
2026-08-23 12:04:40 +08:00
parent 2100ec1ca5
commit c2fd1ff870
18 changed files with 161 additions and 128 deletions
+3 -4
View File
@@ -1,4 +1,4 @@
fn main() {
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut config = prost_build::Config::new();
match protoc_bin_vendored::protoc_bin_path() {
@@ -13,7 +13,6 @@ fn main() {
}
config.protoc_arg("--experimental_allow_proto3_optional");
config
.compile_protos(&["proto/local_ipc.proto"], &["proto"])
.unwrap();
config.compile_protos(&["proto/local_ipc.proto"], &["proto"])?;
Ok(())
}
+1 -1
View File
@@ -285,5 +285,5 @@ pub fn ts_to_string(ts_secs: i64) -> String {
};
let dt_local = dt.to_offset(local_offset);
let format = format_description!("[year]-[month]-[day] [hour]:[minute]:[second]");
dt_local.format(&format).unwrap()
dt_local.format(&format).unwrap_or_default()
}