From 69757386c6812944ee3417b2a245f85afc686898 Mon Sep 17 00:00:00 2001 From: juanbono Date: Mon, 10 Jun 2024 17:14:27 -0300 Subject: [PATCH 1/4] add clippy and fmt --- .github/workflows/ci.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b5c43ed0f82..c9497508095 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,6 +21,7 @@ jobs: uses: dtolnay/rust-toolchain@stable with: toolchain: stable + components: rustfmt, clippy - name: Set up cargo cache uses: Swatinem/rust-cache@v2 @@ -31,6 +32,14 @@ jobs: - name: Run cargo build run: | cargo build + + - name: Run cargo clippy + run: | + cargo clippy --all-targets --all-features -- -D warnings + + - name: Run cargo fmt + run: | + cargo fmt --all -- --check docker-build: name: Build Docker image From 8f0e775f5688e90dfea8c069bdf7042eb33988ad Mon Sep 17 00:00:00 2001 From: juanbono Date: Mon, 10 Jun 2024 17:17:45 -0300 Subject: [PATCH 2/4] add cargo test --- .github/workflows/ci.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9497508095..1debc383ab9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,7 +40,11 @@ jobs: - name: Run cargo fmt run: | cargo fmt --all -- --check - + + - name: Run cargo test + run: | + cargo test + docker-build: name: Build Docker image runs-on: ubuntu-latest From 025319d0fea6b7ef3ca92b77bc93972ab810983a Mon Sep 17 00:00:00 2001 From: juanbono Date: Mon, 10 Jun 2024 17:21:18 -0300 Subject: [PATCH 3/4] fix clippy warnings --- crates/rpc/src/lib.rs | 6 +++--- crates/rpc/src/utils.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 07580dbe223..1935a1c0f52 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -79,15 +79,15 @@ where { match res { Ok(result) => Json( - serde_json::to_value(&RpcSuccessResponse { + serde_json::to_value(RpcSuccessResponse { id: req.id, jsonrpc: "2.0".to_string(), - result: result, + result, }) .unwrap(), ), Err(error) => Json( - serde_json::to_value(&RpcErrorResponse { + serde_json::to_value(RpcErrorResponse { id: req.id, jsonrpc: "2.0".to_string(), error: error.into(), diff --git a/crates/rpc/src/utils.rs b/crates/rpc/src/utils.rs index be9b56aed0e..8da4bfe4847 100644 --- a/crates/rpc/src/utils.rs +++ b/crates/rpc/src/utils.rs @@ -5,9 +5,9 @@ pub enum RpcErr { MethodNotFound, } -impl Into for RpcErr { - fn into(self) -> RpcErrorMetadata { - match self { +impl From for RpcErrorMetadata { + fn from(value: RpcErr) -> Self { + match value { RpcErr::MethodNotFound => RpcErrorMetadata { code: -32601, message: "Method not found".to_string(), From 663bfe1a7953add46eed02b11c13b74c2db78be3 Mon Sep 17 00:00:00 2001 From: juanbono Date: Mon, 10 Jun 2024 18:48:52 -0300 Subject: [PATCH 4/4] add --workspace --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1debc383ab9..d0e0dc6ea01 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,7 @@ jobs: - name: Run cargo clippy run: | - cargo clippy --all-targets --all-features -- -D warnings + cargo clippy --all-targets --all-features --workspace -- -D warnings - name: Run cargo fmt run: |