Skip to content

Commit

Permalink
chore: remove unnecessary explicit lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Dec 6, 2024
1 parent 02c233f commit 1088976
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/json/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl Json {
Err("Unterminated string".to_string())
}

fn parse_value<'a>(input: &'a [u8], start: usize) -> Result<(DValue<'a>, usize), String> {
fn parse_value(input: &[u8], start: usize) -> Result<(DValue<'_>, usize), String> {
let pos = Self::skip_whitespace(input, start);
if pos >= input.len() {
return Err("Unexpected end of input".to_string());
Expand All @@ -166,7 +166,7 @@ impl Json {
}
}

fn parse_array<'a>(input: &'a [u8], start: usize) -> Result<(DValue<'a>, usize), String> {
fn parse_array(input: &[u8], start: usize) -> Result<(DValue<'_>, usize), String> {
let mut pos = start;
let mut values = Vec::new();
let mut expecting_value = true;
Expand Down Expand Up @@ -195,7 +195,7 @@ impl Json {
Err("Unterminated array".to_string())
}

fn parse_object<'a>(input: &'a [u8], start: usize) -> Result<(DValue<'a>, usize), String> {
fn parse_object(input: &[u8], start: usize) -> Result<(DValue<'_>, usize), String> {
let mut pos = start;
let mut map = HashMap::new();
let mut expecting_key = true;
Expand Down Expand Up @@ -232,7 +232,7 @@ impl Json {
Err("Unterminated object".to_string())
}

fn parse_true<'a>(input: &'a [u8], start: usize) -> Result<(DValue<'a>, usize), String> {
fn parse_true(input: &[u8], start: usize) -> Result<(DValue<'_>, usize), String> {
if input.len() >= start + 4 && &input[start..start + 4] == b"true" {
Ok((DValue::Bool(true), start + 4))
} else {
Expand All @@ -248,15 +248,15 @@ impl Json {
}
}

fn parse_null<'a>(input: &'a [u8], start: usize) -> Result<(DValue<'a>, usize), String> {
fn parse_null(input: &[u8], start: usize) -> Result<(DValue<'_>, usize), String> {
if input.len() >= start + 4 && &input[start..start + 4] == b"null" {
Ok((DValue::Null, start + 4))
} else {
Err("Invalid 'null' value".to_string())
}
}

fn parse_number<'a>(input: &'a [u8], start: usize) -> Result<(DValue<'a>, usize), String> {
fn parse_number(input: &[u8], start: usize) -> Result<(DValue<'_>, usize), String> {
let mut pos = start;
let mut num_str = Vec::new();

Expand Down

0 comments on commit 1088976

Please sign in to comment.