Skip to content

Commit 821a7f2

Browse files
committed
Add CI workflow with check, clippy, fmt, and test
Now that warnings and clippy lints are clean, enable RUSTFLAGS=-Dwarnings to catch regressions.
1 parent a25e40c commit 821a7f2

2 files changed

Lines changed: 66 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUSTFLAGS: "-Dwarnings"
12+
13+
jobs:
14+
check:
15+
name: Check & Clippy
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install protoc
21+
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
22+
23+
- uses: dtolnay/rust-toolchain@stable
24+
with:
25+
components: clippy
26+
27+
- uses: Swatinem/rust-cache@v2
28+
29+
- name: cargo check
30+
run: cargo check --all-targets
31+
32+
- name: cargo clippy
33+
run: cargo clippy --all-targets
34+
35+
fmt:
36+
name: Format
37+
runs-on: ubuntu-24.04
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- uses: dtolnay/rust-toolchain@stable
42+
with:
43+
components: rustfmt
44+
45+
- name: cargo fmt
46+
run: cargo fmt --all -- --check
47+
48+
test:
49+
name: Test
50+
runs-on: ubuntu-24.04
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Install protoc
55+
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
56+
57+
- uses: dtolnay/rust-toolchain@stable
58+
59+
- uses: Swatinem/rust-cache@v2
60+
61+
- name: cargo test (lib)
62+
run: cargo test --lib

src/api/messaging.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,10 @@ pub(super) async fn toggle_platform(
414414
_ => {}
415415
}
416416
}
417-
} else {
418-
if let Some(manager) = manager
419-
&& let Err(error) = manager.remove_adapter(platform).await
420-
{
421-
tracing::warn!(%error, platform = %platform, "failed to shut down adapter on toggle");
422-
}
417+
} else if let Some(manager) = manager
418+
&& let Err(error) = manager.remove_adapter(platform).await
419+
{
420+
tracing::warn!(%error, platform = %platform, "failed to shut down adapter on toggle");
423421
}
424422

425423
let action = if request.enabled {

0 commit comments

Comments
 (0)