Skip to content

Commit

Permalink
fixed clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Sep 2, 2024
1 parent af939d1 commit f3b70ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/c_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::os::raw::c_char;
pub unsafe extern "C" fn to_json(from: ext::Ext, input: *const c_char) -> *mut c_char {
let input = CStr::from_ptr(input);
let deserialized = ext::deserialize::<ext::json::Value>(from, input.to_str().unwrap());
let serialized = CString::new(ext::json::serialize(&deserialized.unwrap()).unwrap()).unwrap();
let serialized = CString::new(ext::json::serialize(deserialized.unwrap()).unwrap()).unwrap();
serialized.into_raw()
}

Expand All @@ -25,7 +25,7 @@ pub unsafe extern "C" fn to_json(from: ext::Ext, input: *const c_char) -> *mut c
pub unsafe extern "C" fn to_yaml(from: ext::Ext, input: *const c_char) -> *mut c_char {
let input = CStr::from_ptr(input);
let deserialized = ext::deserialize::<ext::yaml::Value>(from, input.to_str().unwrap());
let serialized = CString::new(ext::yaml::serialize(&deserialized.unwrap()).unwrap()).unwrap();
let serialized = CString::new(ext::yaml::serialize(deserialized.unwrap()).unwrap()).unwrap();
serialized.into_raw()
}

Expand All @@ -38,7 +38,7 @@ pub unsafe extern "C" fn to_yaml(from: ext::Ext, input: *const c_char) -> *mut c
pub unsafe extern "C" fn to_toml(from: ext::Ext, input: *const c_char) -> *mut c_char {
let input = CStr::from_ptr(input);
let deserialized = ext::deserialize::<ext::toml::Value>(from, input.to_str().unwrap());
let serialized = CString::new(ext::toml::serialize(&deserialized.unwrap()).unwrap()).unwrap();
let serialized = CString::new(ext::toml::serialize(deserialized.unwrap()).unwrap()).unwrap();
serialized.into_raw()
}

Expand Down

0 comments on commit f3b70ff

Please sign in to comment.