diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2022-09-17 15:53:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-17 15:53:13 +0200 |
commit | 0d58da27e7e8ff0e80d8088e26413a8bb3c8e372 (patch) | |
tree | 076d223c2b34f236ea7a0b46d654eac42e18cacd /src/path/mod.rs | |
parent | bfe819a943d8d68124eeafe9b268c7c3036ddb11 (diff) | |
parent | b2dfb937e2e212ce5809c8deb5af112e1aeb7651 (diff) |
Merge pull request #354 from YounessBird/fix-uppercase-lowercase-isses
Fix uppercase lowercase isses
Diffstat (limited to 'src/path/mod.rs')
-rw-r--r-- | src/path/mod.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/path/mod.rs b/src/path/mod.rs index 7456aa3..b3773d1 100644 --- a/src/path/mod.rs +++ b/src/path/mod.rs @@ -120,7 +120,7 @@ impl Expression { match *self { Self::Identifier(ref id) => match root.kind { ValueKind::Table(ref mut map) => Some( - map.entry(id.clone()) + map.entry(id.to_lowercase()) .or_insert_with(|| Value::new(None, ValueKind::Nil)), ), @@ -131,7 +131,7 @@ impl Expression { Some(value) => { if let ValueKind::Table(ref mut map) = value.kind { Some( - map.entry(key.clone()) + map.entry(key.to_lowercase()) .or_insert_with(|| Value::new(None, ValueKind::Nil)), ) } else { @@ -139,7 +139,7 @@ impl Expression { if let ValueKind::Table(ref mut map) = value.kind { Some( - map.entry(key.clone()) + map.entry(key.to_lowercase()) .or_insert_with(|| Value::new(None, ValueKind::Nil)), ) } else { @@ -194,7 +194,7 @@ impl Expression { ValueKind::Table(ref incoming_map) => { // Pull out another table let target = if let ValueKind::Table(ref mut map) = root.kind { - map.entry(id.clone()) + map.entry(id.to_lowercase()) .or_insert_with(|| Map::<String, Value>::new().into()) } else { unreachable!(); @@ -202,17 +202,17 @@ impl Expression { // Continue the deep merge for (key, val) in incoming_map { - Self::Identifier(key.clone()).set(target, val.clone()); + Self::Identifier(key.to_lowercase()).set(target, val.clone()); } } _ => { if let ValueKind::Table(ref mut map) = root.kind { // Just do a simple set - if let Some(existing) = map.get_mut(id) { + if let Some(existing) = map.get_mut(&id.to_lowercase()) { *existing = value; } else { - map.insert(id.clone(), value); + map.insert(id.to_lowercase(), value); } } } @@ -225,7 +225,7 @@ impl Expression { // Didn't find a table. Oh well. Make a table and do this anyway *parent = Map::<String, Value>::new().into(); } - Self::Identifier(key.clone()).set(parent, value); + Self::Identifier(key.to_lowercase()).set(parent, value); } } |