From 14f6858512c42002f566b96b67233538465b4633 Mon Sep 17 00:00:00 2001 From: "Kevin R. Thornton" Date: Fri, 28 Oct 2022 16:28:17 -0700 Subject: [PATCH] refactor: unwrap to expect in error.rs --- src/error.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/error.rs b/src/error.rs index 3b4656d59..b09938249 100644 --- a/src/error.rs +++ b/src/error.rs @@ -91,7 +91,10 @@ pub fn panic_on_tskit_error(code: i32) { /// if the system runs out of memory. pub fn get_tskit_error_message(code: i32) -> String { let c_str = unsafe { std::ffi::CStr::from_ptr(crate::bindings::tsk_strerror(code)) }; - c_str.to_str().unwrap().to_owned() + c_str + .to_str() + .expect("failed to convert c_str to &str") + .to_owned() } /// Given an instance of [``TskReturnValue``](crate::TskReturnValue),