From 786b0ac2bc8064ced7ef735216a577f635bbe1a9 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Thu, 3 Oct 2024 18:29:41 +0200 Subject: [PATCH 1/2] ci: run cargo format --check --- .github/workflows/ci.yaml | 13 +++++++++++++ src/main.rs | 6 +----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 58125bb..ac35284 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,6 +15,19 @@ concurrency: cancel-in-progress: true jobs: + format: + name: Format check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + run: rustup toolchain install stable --profile minimal --component rustfmt + + - name: Run rustfmt + run: cargo fmt --all -- --check + build: runs-on: ubuntu-latest outputs: diff --git a/src/main.rs b/src/main.rs index 584575b..97f179d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,11 +31,7 @@ async fn main() { let config_path = match env::var("CONFIG_PATH") { Ok(path) => path, Err(_) => { - if cfg!(debug_assertions) { - "./Config.toml".into() - } else { - "/etc/config/Config.toml".into() - } + if cfg!(debug_assertions) { "./Config.toml".into() } else { "/etc/config/Config.toml".into() } } }; let config = ApiConfig::from_path(&config_path); From 9e1a66e1d27f55b6d725f6a957995ae18ce01d08 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Thu, 3 Oct 2024 18:30:41 +0200 Subject: [PATCH 2/2] refactor: apply cargo fmt --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 97f179d..584575b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,11 @@ async fn main() { let config_path = match env::var("CONFIG_PATH") { Ok(path) => path, Err(_) => { - if cfg!(debug_assertions) { "./Config.toml".into() } else { "/etc/config/Config.toml".into() } + if cfg!(debug_assertions) { + "./Config.toml".into() + } else { + "/etc/config/Config.toml".into() + } } }; let config = ApiConfig::from_path(&config_path);