From d995aec200dd4177ffd4b5779a65474592bac8fb Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 6 Dec 2022 20:27:42 +0800 Subject: [PATCH] perf: parser function --- src/to-json/src/convert.rs | 6 +++--- src/to-json/src/ffi.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/to-json/src/convert.rs b/src/to-json/src/convert.rs index 72d7dd0..9393fad 100644 --- a/src/to-json/src/convert.rs +++ b/src/to-json/src/convert.rs @@ -2,9 +2,9 @@ use crate::parser::{parser, Value}; fn json_convert(content: &str) -> Result { // convert to JSON format let data = match parser(content)? { - Value::JSON(_json) => serde_json::to_string(&_json), - Value::YAML(_yaml) => serde_json::to_string(&_yaml), - Value::TOML(_toml) => serde_json::to_string(&_toml), + Value::JSON(json) => serde_json::to_string(&json), + Value::YAML(yaml) => serde_json::to_string(&yaml), + Value::TOML(toml) => serde_json::to_string(&toml), }; match data { Ok(data) => Ok(data), diff --git a/src/to-json/src/ffi.rs b/src/to-json/src/ffi.rs index 466bdc4..dcaf66d 100644 --- a/src/to-json/src/ffi.rs +++ b/src/to-json/src/ffi.rs @@ -12,7 +12,7 @@ unsafe fn load_c_string(ptr: *const c_char) -> String { // load string from c-st } #[no_mangle] -pub unsafe extern "C" fn free_rust_string(ptr: *const c_char) { +pub unsafe extern "C" fn free_rust_string(ptr: *const c_char) { // free string memory let _ = CString::from_raw(ptr as *mut _); }