Skip to content

Commit

Permalink
fix: format the error message in ZRuntime expect (#1049)
Browse files Browse the repository at this point in the history
* fix: format the error message in `ZRuntime` expect

* fix(clippy): replace `expect` by `unwrap_or_else`
  • Loading branch information
YuanYuYuan authored May 28, 2024
1 parent 4418698 commit 3118d31
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions commons/zenoh-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ impl ZRuntimePool {

self.0
.get(&zrt)
.expect("The hashmap should contains {zrt} after initialization")
.get_or_init(|| zrt.init().expect("Failed to init {zrt}"))
.unwrap_or_else(|| panic!("The hashmap should contains {zrt} after initialization"))
.get_or_init(|| {
zrt.init()
.unwrap_or_else(|_| panic!("Failed to init {zrt}"))
})
.handle()
}
}
Expand Down

0 comments on commit 3118d31

Please sign in to comment.