refactor: remove panic-prone unwrap and expect calls
This commit is contained in:
+3
-4
@@ -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(())
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user