Skip to content

Commit cce60c5

Browse files
authored
Apply new cargo fmt rules & remove deprecated actions (#1509)
# Description @swift-nav/algint-team This PR should make no meaningful change to the codebase contained in libsbp. All changes to the rust code simply are the result of running `cargo fmt` & `cargo clippy --fix` with the latest version of stable rust. This should make it so the CI passes. I also changed the github actions using actions-rs as it is deprecated # API compatibility Does this change introduce a API compatibility risk? No ## API compatibility plan If the above is "Yes", please detail the compatibility (or migration) plan: <!-- Provide a short explanation plan here --> # JIRA Reference N/A #no_auto_pr
1 parent 020d8df commit cce60c5

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

.github/workflows/rust.yaml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,16 @@ jobs:
2525
- run: ./scripts/ci_prepare_rust.bash
2626
shell: bash
2727

28-
- uses: actions-rs/toolchain@v1
28+
- name: Install rust stable latest
29+
uses: dtolnay/rust-toolchain@stable
2930
with:
30-
profile: minimal
31-
toolchain: stable
32-
override: true
33-
components: rustfmt
31+
components: rustfmt,clippy
3432

35-
- uses: actions-rs/cargo@v1
36-
name: Format Check
37-
with:
38-
command: fmt
39-
args: -- --check
33+
- name: Format Check
34+
run: cargo fmt -- --check
4035

41-
- uses: actions-rs/cargo@v1
42-
name: Lint Check
43-
with:
44-
command: clippy
45-
args: --all-features --all-targets -- -D warnings
36+
- name: Lint Check
37+
run : cargo clippy --all-features --all-targets -- -D warnings
4638

4739
test:
4840
name: Tests
@@ -53,11 +45,8 @@ jobs:
5345
- run: ./scripts/ci_prepare_rust.bash
5446
shell: bash
5547

56-
- uses: actions-rs/toolchain@v1
57-
with:
58-
profile: minimal
59-
toolchain: stable
60-
override: true
48+
- name: Install Rust
49+
uses: dtolnay/rust-toolchain@stable
6150

6251
- name: Run tests
6352
run: make test-rust
@@ -67,10 +56,13 @@ jobs:
6756
needs: [lint, test]
6857
strategy:
6958
matrix:
70-
os:
71-
- ubuntu-24.04
72-
- macos-13
73-
- windows-2022
59+
include:
60+
- os: ubuntu-24.04
61+
target: x86_64-unknown-linux-musl
62+
- os: macos-13
63+
target: x86_64-apple-darwin
64+
- os: windows-2022
65+
target: x86_64-pc-windows-msvc
7466
runs-on: ${{ matrix.os }}
7567
steps:
7668
- uses: actions/checkout@v5
@@ -83,11 +75,10 @@ jobs:
8375
- run: ./scripts/ci_prepare_rust.bash
8476
shell: bash
8577

86-
- uses: actions-rs/toolchain@v1
78+
- name: Install rust
79+
uses: dtolnay/rust-toolchain@stable
8780
with:
88-
profile: minimal
89-
toolchain: stable
90-
override: true
81+
targets: ${{ matrix.target }}
9182

9283
- name: Fetch Tags
9384
run: git fetch --tags --prune --force

rust/sbp/src/sbp_string.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ impl SbpString<Vec<u8>, DoubleNullTerminated> {
101101
data: impl Into<Vec<u8>>,
102102
) -> Result<Self, DoubleNullTerminatedError> {
103103
let vec = data.into();
104-
if let [.., two, one] = vec.as_slice() {
105-
if two == &0 && one == &0 {
106-
return Ok(SbpString::new(vec));
107-
}
104+
if let [.., two, one] = vec.as_slice()
105+
&& two == &0
106+
&& one == &0
107+
{
108+
return Ok(SbpString::new(vec));
108109
};
109110
Err(DoubleNullTerminatedError)
110111
}

0 commit comments

Comments
 (0)