From 0c702e4bab5ea213adb8f4ce808718a8681e68c4 Mon Sep 17 00:00:00 2001 From: Jonathan Tran Date: Tue, 17 Jun 2025 14:30:33 -0400 Subject: [PATCH] Use nightly rustfmt in CI (#7509) * Use nightly rustfmt in CI * Fix current code to be nightly formatted --- .github/workflows/cargo-fmt.yml | 6 +++--- .github/workflows/nightly-rust-toolchain.toml | 3 +++ rust/kcl-lib/src/execution/kcl_value.rs | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/nightly-rust-toolchain.toml diff --git a/.github/workflows/cargo-fmt.yml b/.github/workflows/cargo-fmt.yml index 49c3f0aff..7bd67e604 100644 --- a/.github/workflows/cargo-fmt.yml +++ b/.github/workflows/cargo-fmt.yml @@ -31,15 +31,15 @@ jobs: - name: Use correct Rust toolchain shell: bash run: | - [ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./ + cp .github/workflows/nightly-rust-toolchain.toml rust-toolchain.toml - name: Install rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: cache-workspaces: rust components: rustfmt - - name: Run cargo fmt + - name: Run nightly cargo fmt run: | cd rust - cargo fmt -- --check + cargo +nightly fmt -- --check shell: bash diff --git a/.github/workflows/nightly-rust-toolchain.toml b/.github/workflows/nightly-rust-toolchain.toml new file mode 100644 index 000000000..0f4107c29 --- /dev/null +++ b/.github/workflows/nightly-rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly" +components = ["rustfmt"] diff --git a/rust/kcl-lib/src/execution/kcl_value.rs b/rust/kcl-lib/src/execution/kcl_value.rs index 2650e45d8..53456fa2d 100644 --- a/rust/kcl-lib/src/execution/kcl_value.rs +++ b/rust/kcl-lib/src/execution/kcl_value.rs @@ -668,9 +668,8 @@ impl From for KclValue { #[cfg(test)] mod tests { - use crate::exec::UnitType; - use super::*; + use crate::exec::UnitType; #[test] fn test_human_friendly_type() {