Skip to content

Commit 5fcc7ff

Browse files
committed
Run clippy (#1)
Running clippy in CI to ensure it doesn't break again. Forcing clippy to pass without any warnings. Fixed warnings added by newer rustc.
1 parent 100b002 commit 5fcc7ff

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ jobs:
138138
- name: "Generate Cargo Lockfile"
139139
run: "cargo generate-lockfile"
140140

141+
- name: "Run clippy"
142+
shell: bash
143+
run: "cargo clippy --all --tests -- -D warnings"
144+
141145
# Cache build dependencies
142146
- name: "Cache Build Fragments"
143147
id: "cache-build-fragments"

src/op/data.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ fn get_key(data: &Value, key: KeyType) -> Option<Value> {
216216
KeyType::String(k) => get_str_key(data, k),
217217
KeyType::Number(i) => match data {
218218
Value::Object(_) => get_str_key(data, i.to_string()),
219-
Value::Array(arr) => get(arr, i).map(Value::clone),
219+
Value::Array(arr) => get(arr, i).cloned(),
220220
Value::String(s) => {
221221
let s_vec: Vec<char> = s.chars().collect();
222222
get(&s_vec, i).map(|c| c.to_string()).map(Value::String)
@@ -236,14 +236,12 @@ fn get_str_key<K: AsRef<str>>(data: &Value, key: K) -> Option<Value> {
236236
// Exterior ref in case we need to make a new value in the match.
237237
k.split('.').try_fold(data.clone(), |acc, i| match acc {
238238
// If the current value is an object, try to get the value
239-
Value::Object(map) => map.get(i).map(Value::clone),
239+
Value::Object(map) => map.get(i).cloned(),
240240
// If the current value is an array, we need an integer
241241
// index. If integer conversion fails, return None.
242-
Value::Array(arr) => i
243-
.parse::<i64>()
244-
.ok()
245-
.and_then(|i| get(&arr, i))
246-
.map(Value::clone),
242+
Value::Array(arr) => {
243+
i.parse::<i64>().ok().and_then(|i| get(&arr, i)).cloned()
244+
}
247245
// Same deal if it's a string.
248246
Value::String(s) => {
249247
let s_chars: Vec<char> = s.chars().collect();

0 commit comments

Comments
 (0)