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