Skip to content

Commit 299088e

Browse files
committed
Also run clippy on test code
1 parent 769f136 commit 299088e

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: cargo fmt
3535
run: cargo +nightly fmt --all -- --check
3636
- name: clippy all
37-
run: cargo clippy --all --all-features -- -D warnings
37+
run: cargo clippy --all --all-features --tests -- -D warnings
3838
- name: clippy driver
3939
run: cargo clippy -p neo4j -- -D warnings
4040
- name: Check exported dependencies

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ repos:
1414
language: system
1515
types: [rust]
1616
- id: clippy driver
17-
name: cargo clippy (driver)
18-
entry: cargo clippy -p neo4j -- -D warnings
17+
name: cargo clipcpy (driver)
18+
entry: cargo clippy --tests -p neo4j -- -D warnings
1919
language: system
2020
types: [rust]
2121
pass_filenames: false
2222
- id: clippy all
2323
name: cargo clippy (all)
24-
entry: cargo clippy --all --all-features -- -D warnings
24+
entry: cargo clippy --all --all-features --tests -- -D warnings
2525
language: system
2626
types: [rust]
2727
pass_filenames: false

neo4j/src/driver/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ impl ConnectionConfig {
795795
}
796796
}
797797
Some(query) => {
798-
if query == "" {
798+
if query.is_empty() {
799799
Some(HashMap::new())
800800
} else {
801801
if !routing {

neo4j/src/driver/io/bolt/packstream/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn decode_raw(input: Vec<u8>) -> (Result<ValueReceive, PackStreamDeserializeErro
3939
let mut reader = input.as_slice();
4040
let mut deserializer = PackStreamDeserializerImpl::new(&mut reader);
4141
let result = deserializer.load(&translator);
42-
let rest = reader.iter().cloned().collect();
42+
let rest = reader.to_vec();
4343
(result, rest)
4444
}
4545

neo4j/src/value/graph.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ mod test {
409409
fn get_invalid_path_even_index_out_of_range_3() -> Path {
410410
let mut path = get_path();
411411
let rel_len_i: isize = path.relationships.len().try_into().unwrap();
412-
path.indices[2] = rel_len_i * -1 - 1;
412+
path.indices[2] = -rel_len_i - 1;
413413
path
414414
}
415415

@@ -434,13 +434,13 @@ mod test {
434434
#[test]
435435
fn test_path_traverse() {
436436
let path = get_path();
437-
let expected_node_ids = vec!["n1", "n2", "n1", "n3"];
438-
let expected_directions = vec![
437+
let expected_node_ids = ["n1", "n2", "n1", "n3"];
438+
let expected_directions = [
439439
RelationshipDirection::From,
440440
RelationshipDirection::To,
441441
RelationshipDirection::To,
442442
];
443-
let expected_relationship_ids = vec!["r1", "r2", "r1"];
443+
let expected_relationship_ids = ["r1", "r2", "r1"];
444444

445445
let (start_node, hops) = path.traverse();
446446
assert_eq!(start_node.element_id, expected_node_ids[0]);

0 commit comments

Comments
 (0)