Skip to content

Commit 74a5129

Browse files
authored
refactor: unwrap to expect in error.rs (#347)
1 parent 05f5d38 commit 74a5129

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/error.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ pub fn panic_on_tskit_error(code: i32) {
9191
/// if the system runs out of memory.
9292
pub fn get_tskit_error_message(code: i32) -> String {
9393
let c_str = unsafe { std::ffi::CStr::from_ptr(crate::bindings::tsk_strerror(code)) };
94-
c_str.to_str().unwrap().to_owned()
94+
c_str
95+
.to_str()
96+
.expect("failed to convert c_str to &str")
97+
.to_owned()
9598
}
9699

97100
/// Given an instance of [``TskReturnValue``](crate::TskReturnValue),

0 commit comments

Comments
 (0)