From bc6ddad852ad65faf12b8064c2ddea114d9fdbee Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Sat, 5 Oct 2024 00:58:58 -0400 Subject: Limit unsafe{} blocks even more tightly. --- src/db/backup.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/db/backup.rs b/src/db/backup.rs index 9be195c..027c233 100644 --- a/src/db/backup.rs +++ b/src/db/backup.rs @@ -121,13 +121,10 @@ impl Error { } fn message_for(handle: NonNull) -> String { - unsafe { - let msg = sqlite3_errmsg(handle.as_ptr()); - debug_assert!(!msg.is_null()); - - from_utf8(CStr::from_ptr(msg).to_bytes()) - .expect("error messages from sqlite are always utf-8") - .to_owned() - } + let msg = unsafe { sqlite3_errmsg(handle.as_ptr()) }; + debug_assert!(!msg.is_null()); + from_utf8(unsafe { CStr::from_ptr(msg) }.to_bytes()) + .expect("error messages from sqlite are always utf-8") + .to_owned() } } -- cgit v1.2.3