Refactor code based on clippy suggestions

This commit is contained in:
2022-08-25 17:45:16 -04:00
parent 9a9b5335f1
commit b97b2fe6d0
16 changed files with 145 additions and 204 deletions

View File

@@ -16,7 +16,7 @@ pub fn parse_key_value(text: &str) -> HashMap<String, String> {
let mut result = HashMap::new();
tokens = scan(text, 0, tokens);
for token_chunk in tokens.chunks(4) {
match &token_chunk[..] {
match token_chunk {
[Token::Identifier(key), Token::Equal, Token::Identifier(value), Token::Ampersand] => {
result.insert(key.to_string(), value.to_string());
}
@@ -54,8 +54,8 @@ fn scan(code: &str, mut ix: usize, mut tokens: Tokens) -> Tokens {
fn scan_identifier(code: &str, mut ix: usize, mut tokens: Tokens) -> Tokens {
let start_ix = ix;
let mut chars = code[ix..].chars();
while let Some(c) = chars.next() {
let chars = code[ix..].chars();
for c in chars {
if c.is_ascii_alphanumeric() || SPECIAL_CHARS.contains(&c) {
ix += 1;
} else {