From e14205fab8c88cd076bda3e7b9e1dcdf1b93f92c Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Tue, 14 Jan 2025 20:00:52 +0530 Subject: [PATCH] add few suggestion --- utils/sv2_serde_json/src/parser.rs | 2 +- utils/sv2_serde_json/src/token.rs | 1 - utils/sv2_serde_json/src/value.rs | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/sv2_serde_json/src/parser.rs b/utils/sv2_serde_json/src/parser.rs index 7a2681058..f56b89e70 100644 --- a/utils/sv2_serde_json/src/parser.rs +++ b/utils/sv2_serde_json/src/parser.rs @@ -15,7 +15,7 @@ use crate::{ pub struct JsonParser; impl JsonParser { - pub fn parse_from_bytes<'a>(input: &'a [u8]) -> Result { + pub fn parse_from_bytes(input: & [u8]) -> Result { let mut json_tokenizer = Jsontokensizer::>>::from_bytes(input); let tokens = json_tokenizer.tokensize_json()?; Ok(Self::tokens_to_value(tokens)) diff --git a/utils/sv2_serde_json/src/token.rs b/utils/sv2_serde_json/src/token.rs index 30a2f031e..234290cd7 100644 --- a/utils/sv2_serde_json/src/token.rs +++ b/utils/sv2_serde_json/src/token.rs @@ -58,7 +58,6 @@ where while let Some(character) = self.iterator.peek() { match *character { '"' => { - // Pushed opening quote to output tokens list. self.tokens.push(Token::Quotes); let _ = self.iterator.next(); diff --git a/utils/sv2_serde_json/src/value.rs b/utils/sv2_serde_json/src/value.rs index 39a9f37bd..d20189166 100644 --- a/utils/sv2_serde_json/src/value.rs +++ b/utils/sv2_serde_json/src/value.rs @@ -14,7 +14,7 @@ pub enum Value { Array(Vec), Object(HashMap), Null, - None, + None, Some(Box), } @@ -58,7 +58,6 @@ pub trait FromJsonValue: Sized { fn from_json_value(value: &Value) -> Result; } - impl ToJsonValue for String { fn to_json_value(&self) -> Value { Value::String(self.clone())