Skip to content

Commit 85b8bfe

Browse files
committed
Fix lint errors
1 parent f309261 commit 85b8bfe

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

src/jsonpath.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde_json::Value;
88

99
#[derive(Debug)]
1010
pub enum SyntaxError {
11-
Message(String)
11+
Message(String),
1212
}
1313

1414
fn err(message: &str) -> Result<&dyn Path, SyntaxError> {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
* SPDX-License-Identifier: BSD-2-Clause
55
*/
66

7-
pub mod jsonpath;
7+
pub mod jsonpath;

tests/cts.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
#[cfg(test)]
88
mod tests {
9+
use jsonpath_ri::jsonpath;
910
use serde::{Deserialize, Serialize};
1011
use std::fs;
1112
use std::panic;
12-
use jsonpath_ri::jsonpath;
1313

1414
#[derive(Debug, PartialEq, Serialize, Deserialize)]
1515
struct TestSuite {
@@ -41,10 +41,16 @@ mod tests {
4141
as_json(&t.result).expect("invalid result")
4242
);
4343
let path = jsonpath::parse(&t.selector);
44-
assert!(path.is_ok(), "parse failed: {:?}", path.err().expect("should be an error"));
44+
assert!(
45+
path.is_ok(),
46+
"parse failed: {:?}",
47+
path.err().expect("should be an error")
48+
);
4549

4650
if let Ok(p) = path {
47-
if let Ok(result) = p.find(as_json_value(&t.document).expect("invalid document")) {
51+
if let Ok(result) =
52+
p.find(as_json_value(&t.document).expect("invalid document"))
53+
{
4854
if result != as_json_value_array(&t.result).expect("invalid result") {
4955
assert!(false, "incorrect result")
5056
}
@@ -96,7 +102,9 @@ mod tests {
96102

97103
serde_yaml::Value::Bool(b) => Ok(serde_json::Value::Bool(*b)),
98104

99-
serde_yaml::Value::Number(num) => Ok(serde_json::Value::Number(yaml_number_as_json(num.clone()))),
105+
serde_yaml::Value::Number(num) => {
106+
Ok(serde_json::Value::Number(yaml_number_as_json(num.clone())))
107+
}
100108

101109
serde_yaml::Value::String(s) => Ok(serde_json::Value::String(s.clone())),
102110

@@ -109,7 +117,10 @@ mod tests {
109117

110118
serde_yaml::Value::Mapping(map) => {
111119
let object_members = map.iter().map(|(k, v)| {
112-
(serde_yaml::to_string(k).expect("non-string mapping key"), as_json_value(v).expect("invalid map value"))
120+
(
121+
serde_yaml::to_string(k).expect("non-string mapping key"),
122+
as_json_value(v).expect("invalid map value"),
123+
)
113124
});
114125
Ok(serde_json::Value::Object(object_members.collect()))
115126
}
@@ -124,7 +135,7 @@ mod tests {
124135
.map(|v| as_json_value(v).expect("invalid sequence element"));
125136
Ok(array_elements.collect())
126137
}
127-
_ => Err("not a sequence".to_string())
138+
_ => Err("not a sequence".to_string()),
128139
}
129140
}
130141

@@ -134,7 +145,8 @@ mod tests {
134145
} else if n.is_u64() {
135146
serde_json::Number::from(n.as_u64().expect("invalid u64 in YAML"))
136147
} else {
137-
serde_json::Number::from_f64(n.as_f64().expect("invalid f64 in YAML")).expect("invalid f64 for JSON")
148+
serde_json::Number::from_f64(n.as_f64().expect("invalid f64 in YAML"))
149+
.expect("invalid f64 for JSON")
138150
}
139151
}
140152
}

0 commit comments

Comments
 (0)