From 5692e116c493b9ab565ca1eabd25af9ccf953374 Mon Sep 17 00:00:00 2001 From: Shahar Samocha Date: Thu, 20 Jun 2024 16:46:29 +0300 Subject: [PATCH] Rust fmt and clippy --- .github/workflows/cairo-ci.yaml | 24 +++++++++++++++++++++++- scripts/clippy.sh | 4 ++++ scripts/rust_fmt.sh | 3 +++ stwo_cairo_prover/rust-toolchain.toml | 2 ++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 scripts/clippy.sh create mode 100755 scripts/rust_fmt.sh create mode 100644 stwo_cairo_prover/rust-toolchain.toml diff --git a/.github/workflows/cairo-ci.yaml b/.github/workflows/cairo-ci.yaml index d848312c..41d43c85 100644 --- a/.github/workflows/cairo-ci.yaml +++ b/.github/workflows/cairo-ci.yaml @@ -42,4 +42,26 @@ jobs: profile: minimal toolchain: nightly-2024-01-04 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2024-01-04 test --release \ No newline at end of file + - run: cargo +nightly-2024-01-04 test --release + + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + with: + components: rustfmt + toolchain: nightly-2024-01-04 + - uses: Swatinem/rust-cache@v2 + - run: scripts/rust_fmt.sh --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@master + with: + components: clippy + toolchain: nightly-2024-01-04 + - uses: Swatinem/rust-cache@v2 + - run: scripts/clippy.sh diff --git a/scripts/clippy.sh b/scripts/clippy.sh new file mode 100755 index 00000000..14a78448 --- /dev/null +++ b/scripts/clippy.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cargo +nightly-2024-01-04 clippy "$@" --all-targets --all-features -- -D warnings \ + -D future-incompatible -D nonstandard-style -D rust-2018-idioms -D unused diff --git a/scripts/rust_fmt.sh b/scripts/rust_fmt.sh new file mode 100755 index 00000000..e4223f99 --- /dev/null +++ b/scripts/rust_fmt.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cargo +nightly-2024-01-04 fmt --all -- "$@" diff --git a/stwo_cairo_prover/rust-toolchain.toml b/stwo_cairo_prover/rust-toolchain.toml new file mode 100644 index 00000000..a0f1a930 --- /dev/null +++ b/stwo_cairo_prover/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly-2024-01-04"