From 9864f9a8aa6b88f2611f9a630026895bb58200d8 Mon Sep 17 00:00:00 2001 From: Joseph Shearer Date: Tue, 10 Oct 2023 12:26:20 -0400 Subject: [PATCH] Update to address PR feedback --- crates/doc/src/ptr.rs | 7 +++---- crates/doc/src/shape/limits.rs | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/doc/src/ptr.rs b/crates/doc/src/ptr.rs index 4b252ad28f..53a27f946e 100644 --- a/crates/doc/src/ptr.rs +++ b/crates/doc/src/ptr.rs @@ -215,8 +215,7 @@ impl Pointer { arr.last_mut().unwrap() } // Cannot match (attempt to query property of an array). - Token::Property(_) => return None, - Token::NextProperty => return None, + Token::Property(_) | Token::NextProperty => return None, }, Value::Number(_) | Value::Bool(_) | Value::String(_) => { return None; // Cannot match (attempt to take child of scalar). @@ -275,8 +274,7 @@ impl Pointer { arr.last_mut().unwrap() } // Cannot match (attempt to query property of an array). - Token::Property(_) => return None, - Token::NextProperty => return None, + Token::Property(_) | Token::NextProperty => return None, }, HeapNode::Bool(_) | HeapNode::Bytes(_) @@ -517,6 +515,7 @@ mod test { for case in [ "/foo/2/a/3", // Attempt to index string scalar. "/foo/bar", // Attempt to take property of array. + "/foo/-", // Attempt to take property of array ] .iter() { diff --git a/crates/doc/src/shape/limits.rs b/crates/doc/src/shape/limits.rs index 2274843768..aaa0160c2c 100644 --- a/crates/doc/src/shape/limits.rs +++ b/crates/doc/src/shape/limits.rs @@ -27,9 +27,7 @@ fn squash_location_inner(shape: &mut Shape, name: &Token) { match name { // Squashing of `additional*` fields is not possible here because we don't // have access to the parent shape - Token::NextIndex => unreachable!(), - Token::NextProperty => unreachable!(), - + Token::NextIndex | Token::NextProperty => unreachable!(), Token::Index(_) => { // Pop the last element from the array tuple shape to avoid // shifting the indexes of any other tuple shapes