Skip to content

Commit 02e62db

Browse files
committed
refactor(path): Make lookups more consistent
1 parent ec36bff commit 02e62db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/path/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ fn abs_index(index: isize, len: usize) -> Result<usize, usize> {
6060
impl Expression {
6161
pub(crate) fn get(self, root: &Value) -> Option<&Value> {
6262
match self {
63-
Self::Identifier(id) => {
63+
Self::Identifier(key) => {
6464
match root.kind {
6565
// `x` access on a table is equivalent to: map[x]
66-
ValueKind::Table(ref map) => map.get(&id),
66+
ValueKind::Table(ref map) => map.get(&key),
6767

6868
// all other variants return None
6969
_ => None,
@@ -103,13 +103,13 @@ impl Expression {
103103

104104
pub(crate) fn get_mut_forcibly<'a>(&self, root: &'a mut Value) -> &'a mut Value {
105105
match *self {
106-
Self::Identifier(ref id) => {
106+
Self::Identifier(ref key) => {
107107
if !matches!(root.kind, ValueKind::Table(_)) {
108108
*root = Map::<String, Value>::new().into();
109109
}
110110

111111
if let ValueKind::Table(ref mut map) = root.kind {
112-
map.entry(id.clone())
112+
map.entry(key.clone())
113113
.or_insert_with(|| Value::new(None, ValueKind::Nil))
114114
} else {
115115
unreachable!()

0 commit comments

Comments
 (0)