diff --git a/src/lib.rs b/src/lib.rs index 0e5f020..8859bd7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1228,7 +1228,7 @@ mod tests { } #[test] - fn logical_not_exp_test(){ + fn logical_not_exp_test() { let json: Box = Box::new(json!({"first":{"second":{"active":1}}})); let path: Box = Box::from( JsonPathInst::from_str("$.first[?(!@.does_not_exist >= 1.0)]") @@ -1236,7 +1236,13 @@ mod tests { ); let finder = JsonPathFinder::new(json.clone(), path); let v = finder.find_slice(); - assert_eq!(v, vec![Slice(&json!({"second":{"active": 1}}), "$.['first']".to_string())]); + assert_eq!( + v, + vec![Slice( + &json!({"second":{"active": 1}}), + "$.['first']".to_string() + )] + ); let path: Box = Box::from( JsonPathInst::from_str("$.first[?(!(@.does_not_exist >= 1.0))]") @@ -1244,7 +1250,13 @@ mod tests { ); let finder = JsonPathFinder::new(json.clone(), path); let v = finder.find_slice(); - assert_eq!(v, vec![Slice(&json!({"second":{"active": 1}}), "$.['first']".to_string())]); + assert_eq!( + v, + vec![Slice( + &json!({"second":{"active": 1}}), + "$.['first']".to_string() + )] + ); let path: Box = Box::from( JsonPathInst::from_str("$.first[?(!(@.second.active == 1) || @.second.active == 1)]") @@ -1252,7 +1264,13 @@ mod tests { ); let finder = JsonPathFinder::new(json.clone(), path); let v = finder.find_slice(); - assert_eq!(v, vec![Slice(&json!({"second":{"active": 1}}), "$.['first']".to_string())]); + assert_eq!( + v, + vec![Slice( + &json!({"second":{"active": 1}}), + "$.['first']".to_string() + )] + ); let path: Box = Box::from( JsonPathInst::from_str("$.first[?(!@.second.active == 1 && !@.second.active == 1 || !@.second.active == 2)]") @@ -1260,7 +1278,13 @@ mod tests { ); let finder = JsonPathFinder::new(json, path); let v = finder.find_slice(); - assert_eq!(v, vec![Slice(&json!({"second":{"active": 1}}), "$.['first']".to_string())]); + assert_eq!( + v, + vec![Slice( + &json!({"second":{"active": 1}}), + "$.['first']".to_string() + )] + ); } // #[test] diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 5324914..b7d5c51 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -148,8 +148,6 @@ fn parse_filter_index(pair: Pair) -> Result) -> Result { let mut expr: Option = None; let error_message = format!("Failed to parse logical expression: {:?}", pairs); diff --git a/src/path/index.rs b/src/path/index.rs index c26f8b0..cabf9d7 100644 --- a/src/path/index.rs +++ b/src/path/index.rs @@ -207,7 +207,7 @@ pub enum FilterPath<'a> { }, Not { exp: PathInstance<'a>, - } + }, } impl<'a> FilterPath<'a> { @@ -228,7 +228,7 @@ impl<'a> FilterPath<'a> { }, FilterExpression::Not(exp) => FilterPath::Not { exp: Box::new(FilterPath::new(exp, root)), - } + }, } } fn compound(