From 299088eadd215df60b65c8815daa07e7f095053f Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Sat, 15 Feb 2025 11:45:49 +0100 Subject: [PATCH] Also run clippy on test code --- .github/workflows/tests.yaml | 2 +- .pre-commit-config.yaml | 6 +++--- neo4j/src/driver/config.rs | 2 +- neo4j/src/driver/io/bolt/packstream/tests.rs | 2 +- neo4j/src/value/graph.rs | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4219bcd..5282aa7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,7 +34,7 @@ jobs: - name: cargo fmt run: cargo +nightly fmt --all -- --check - name: clippy all - run: cargo clippy --all --all-features -- -D warnings + run: cargo clippy --all --all-features --tests -- -D warnings - name: clippy driver run: cargo clippy -p neo4j -- -D warnings - name: Check exported dependencies diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fb0809..bab5a7e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,14 +14,14 @@ repos: language: system types: [rust] - id: clippy driver - name: cargo clippy (driver) - entry: cargo clippy -p neo4j -- -D warnings + name: cargo clipcpy (driver) + entry: cargo clippy --tests -p neo4j -- -D warnings language: system types: [rust] pass_filenames: false - id: clippy all name: cargo clippy (all) - entry: cargo clippy --all --all-features -- -D warnings + entry: cargo clippy --all --all-features --tests -- -D warnings language: system types: [rust] pass_filenames: false diff --git a/neo4j/src/driver/config.rs b/neo4j/src/driver/config.rs index 28da3dc..24f1e1e 100644 --- a/neo4j/src/driver/config.rs +++ b/neo4j/src/driver/config.rs @@ -795,7 +795,7 @@ impl ConnectionConfig { } } Some(query) => { - if query == "" { + if query.is_empty() { Some(HashMap::new()) } else { if !routing { diff --git a/neo4j/src/driver/io/bolt/packstream/tests.rs b/neo4j/src/driver/io/bolt/packstream/tests.rs index 9b1851e..08e53e6 100644 --- a/neo4j/src/driver/io/bolt/packstream/tests.rs +++ b/neo4j/src/driver/io/bolt/packstream/tests.rs @@ -39,7 +39,7 @@ fn decode_raw(input: Vec) -> (Result Path { let mut path = get_path(); let rel_len_i: isize = path.relationships.len().try_into().unwrap(); - path.indices[2] = rel_len_i * -1 - 1; + path.indices[2] = -rel_len_i - 1; path } @@ -434,13 +434,13 @@ mod test { #[test] fn test_path_traverse() { let path = get_path(); - let expected_node_ids = vec!["n1", "n2", "n1", "n3"]; - let expected_directions = vec![ + let expected_node_ids = ["n1", "n2", "n1", "n3"]; + let expected_directions = [ RelationshipDirection::From, RelationshipDirection::To, RelationshipDirection::To, ]; - let expected_relationship_ids = vec!["r1", "r2", "r1"]; + let expected_relationship_ids = ["r1", "r2", "r1"]; let (start_node, hops) = path.traverse(); assert_eq!(start_node.element_id, expected_node_ids[0]);