avoid unnecessary clones

This commit is contained in:
Bahex 2025-04-26 10:44:23 +03:00
parent 0389815137
commit 9976718363

View File

@ -183,8 +183,10 @@ fn parse_collection_shape(
return mk_shape(vec![]); return mk_shape(vec![]);
}; };
let key_bytes = working_set.get_span_contents(tokens[idx].span).to_vec(); if working_set
if key_bytes.first().copied() == Some(b',') { .get_span_contents(tokens[idx].span)
.starts_with(b",")
{
idx += 1; idx += 1;
continue; continue;
} }
@ -205,8 +207,8 @@ fn parse_collection_shape(
idx += 1; idx += 1;
} }
let maybe_colon = working_set.get_span_contents(tokens[idx].span).to_vec(); let maybe_colon = working_set.get_span_contents(tokens[idx].span);
match maybe_colon.as_slice() { match maybe_colon {
b":" => { b":" => {
if idx + 1 == tokens.len() { if idx + 1 == tokens.len() {
working_set working_set