Skip to content

Commit

Permalink
some clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xMAC94x committed May 17, 2024
1 parent 95b99a8 commit beabd2d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,10 @@ impl<'a, Data: Clone + Debug + Default> JsonPathValue<'a, Data> {
}

impl<'a, Data> JsonPathValue<'a, Data> {
fn only_no_value(input: &Vec<JsonPathValue<'a, Data>>) -> bool {
fn only_no_value(input: &[JsonPathValue<'a, Data>]) -> bool {
!input.is_empty() && input.iter().filter(|v| v.has_value()).count() == 0
}

fn map_vec(data: Vec<(&'a Data, JsPathStr)>) -> Vec<JsonPathValue<'a, Data>> {
data.into_iter()
.map(|(data, pref)| Slice(data, pref))
Expand Down Expand Up @@ -411,7 +412,7 @@ pub fn find_slice<'a>(path: &'a JsonPathInst, json: &'a Value) -> Vec<JsonPathVa
/// finds a slice of data and wrap it with Value::Array by cloning the data.
/// Returns either an array of elements or Json::Null if the match is incorrect.
pub fn find(path: &JsonPathInst, json: &Value) -> Value {
let slice = find_slice(&path, &json);
let slice = find_slice(path, json);
if !slice.is_empty() {
if JsonPathValue::only_no_value(&slice) {
Value::Null
Expand Down

0 comments on commit beabd2d

Please sign in to comment.