Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 19 additions & 28 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions rust/sbp/src/sbp_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ impl SbpString<Vec<u8>, DoubleNullTerminated> {
data: impl Into<Vec<u8>>,
) -> Result<Self, DoubleNullTerminatedError> {
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)
}
Expand Down
Loading