diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 87882e33c5..2dcfed5c7e 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -25,24 +25,16 @@ jobs: - run: ./scripts/ci_prepare_rust.bash shell: bash - - uses: actions-rs/toolchain@v1 + - name: Install rust stable latest + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - components: rustfmt + components: rustfmt,clippy - - uses: actions-rs/cargo@v1 - name: Format Check - with: - command: fmt - args: -- --check + - name: Format Check + run: cargo fmt -- --check - - uses: actions-rs/cargo@v1 - name: Lint Check - with: - command: clippy - args: --all-features --all-targets -- -D warnings + - name: Lint Check + run : cargo clippy --all-features --all-targets -- -D warnings test: name: Tests @@ -53,11 +45,8 @@ jobs: - run: ./scripts/ci_prepare_rust.bash shell: bash - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - name: Install Rust + uses: dtolnay/rust-toolchain@stable - name: Run tests run: make test-rust @@ -67,10 +56,13 @@ jobs: needs: [lint, test] strategy: matrix: - os: - - ubuntu-24.04 - - macos-13 - - windows-2022 + include: + - os: ubuntu-24.04 + target: x86_64-unknown-linux-musl + - os: macos-13 + target: x86_64-apple-darwin + - os: windows-2022 + target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v5 @@ -83,11 +75,10 @@ jobs: - run: ./scripts/ci_prepare_rust.bash shell: bash - - uses: actions-rs/toolchain@v1 + - name: Install rust + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true + targets: ${{ matrix.target }} - name: Fetch Tags run: git fetch --tags --prune --force diff --git a/rust/sbp/src/sbp_string.rs b/rust/sbp/src/sbp_string.rs index 0256b46ab7..a80e61f9f8 100644 --- a/rust/sbp/src/sbp_string.rs +++ b/rust/sbp/src/sbp_string.rs @@ -101,10 +101,11 @@ impl SbpString, DoubleNullTerminated> { data: impl Into>, ) -> Result { let vec = data.into(); - if let [.., two, one] = vec.as_slice() { - if two == &0 && one == &0 { - return Ok(SbpString::new(vec)); - } + if let [.., two, one] = vec.as_slice() + && two == &0 + && one == &0 + { + return Ok(SbpString::new(vec)); }; Err(DoubleNullTerminatedError) }