From ddecbeeb41a754088593e7aee9dd9b53b015d4d9 Mon Sep 17 00:00:00 2001 From: Jade Date: Mon, 2 Sep 2024 17:46:16 +0800 Subject: [PATCH] [ci] Run clippy (#10) --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ src-tauri/src/main.rs | 11 +++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e751ba..5179880 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,3 +49,25 @@ jobs: run: pnpm install - name: Build run: pnpm tauri build + + clippy: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Install Linux dependencies + run: | + sudo apt-get update -q + sudo apt-get install -y \ + build-essential \ + curl \ + file \ + libayatana-appindicator3-dev \ + libgtk-3-dev \ + librsvg2-dev \ + libssl-dev \ + libwebkit2gtk-4.0-dev \ + libudev-dev \ + wget + - name: Run cargo clippy + working-directory: src-tauri + run: cargo clippy --all diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6992024..0b52e9c 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -223,7 +223,10 @@ fn main() { let team_num: u32 = match team_num_string { Ok(string) => string.parse().unwrap(), Err(_) => { - File::create_new(&location).unwrap().write(b"4788").unwrap(); + File::create_new(&location) + .unwrap() + .write_all(b"4788") + .unwrap(); 4788 } }; @@ -240,14 +243,14 @@ fn main() { let mut out: Vec> = vec![]; for (_id, gamepad) in gilrs.gamepads() { let mut values: Vec = vec![]; - for i in BUTTONS.clone() { + for i in BUTTONS { values.push(JoystickValue::Button { id: i as u8, pressed: gamepad.is_pressed(i), }) } - for i in AXIS.clone() { + for i in AXIS { values.push(JoystickValue::Axis { id: i as u8, value: gamepad.value(i), @@ -256,7 +259,7 @@ fn main() { out.push(values); } - return out; + out }); }