Skip to content

Commit 41abebe

Browse files
committed
fix: Replace unwrap with ? for error handling in normalize function
1 parent 09ad0ef commit 41abebe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn deparse(protobuf: &protobuf::ParseResult) -> Result<String> {
9595
/// assert_eq!(result, "SELECT * FROM contacts WHERE name=$1");
9696
/// ```
9797
pub fn normalize(statement: &str) -> Result<String> {
98-
let input = CString::new(statement).unwrap();
98+
let input = CString::new(statement)?;
9999
let result = unsafe { pg_query_normalize(input.as_ptr()) };
100100
let normalized_query = if !result.error.is_null() {
101101
let message = unsafe { CStr::from_ptr((*result.error).message) }.to_string_lossy().to_string();

0 commit comments

Comments
 (0)