Skip to content

Commit

Permalink
tests: Fix build without std (#1134)
Browse files Browse the repository at this point in the history
The crate `tests-no-std` was never build without std in CI. Therefore the build was broken.

Use the `no_std` compatible `anyhow` calls and run `no-std-check` on the crate.
  • Loading branch information
caspermeijn committed Aug 23, 2024
1 parent e773f5f commit ee59dd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ jobs:
# prost's default features to compile.
- name: prost-build check
run: cargo check --manifest-path prost-build/Cargo.toml
- name: tests-no-std cargo-no-std-check
run: cargo no-std-check --manifest-path tests-no-std/Cargo.toml

check-readme:
name: Check README
Expand Down
6 changes: 3 additions & 3 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ where

let mut buf1 = Vec::new();
if let Err(error) = all_types.encode(&mut buf1) {
return RoundtripResult::Error(error.into());
return RoundtripResult::Error(anyhow!(error));
}
let buf1 = buf1;
if encoded_len != buf1.len() {
Expand All @@ -217,12 +217,12 @@ where

let roundtrip = match M::decode(buf1.as_slice()) {
Ok(roundtrip) => roundtrip,
Err(error) => return RoundtripResult::Error(anyhow::Error::new(error)),
Err(error) => return RoundtripResult::Error(anyhow!(error)),
};

let mut buf2 = Vec::new();
if let Err(error) = roundtrip.encode(&mut buf2) {
return RoundtripResult::Error(error.into());
return RoundtripResult::Error(anyhow!(error));
}
let buf2 = buf2;
let buf3 = roundtrip.encode_to_vec();
Expand Down

0 comments on commit ee59dd5

Please sign in to comment.