Skip to content

Commit

Permalink
Fix check workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
trumank committed Nov 27, 2023
1 parent 1fecce1 commit fe9635e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ jobs:
- name: Install packages
run: sudo apt-get update && sudo apt-get install libgtk-3-dev gcc-mingw-w64

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
targets: x86_64-unknown-linux-gnu, x86_64-pc-windows-gnu
components: clippy, rustfmt
target: x86_64-pc-windows-gnu
override: true

- name: Get versions
run: |
cargo fmt --version
cargo clippy --version
- uses: actions-rs/clippy-check@v1
name: Check clippy
Expand Down
11 changes: 7 additions & 4 deletions src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,19 @@ fn read_cache_metadata_or_default(cache_metadata_path: &PathBuf) -> Result<Versi
.as_object_mut()
.context("failed to deserialize cache metadata into object map")?;
let version = obj_map.remove("version");
if let Some(v) = version && let serde_json::Value::String(vs) = v
if let Some(v) = version
&& let serde_json::Value::String(vs) = v
{
match vs.as_str() {
"0.0.0" => {
// HACK: workaround a serde issue relating to flattening with tags
// involving numeric keys in hashmaps, see
// <https://github.com/serde-rs/serde/issues/1183>.
match serde_json::from_slice::<Cache!["0.0.0"]>(&buf) {
Ok(c) => MaybeVersionedCache::Versioned(VersionAnnotatedCache::V0_0_0(c)),
Err(e) => Err(e).context("failed to deserialize cache as v0.0.0")?
Ok(c) => {
MaybeVersionedCache::Versioned(VersionAnnotatedCache::V0_0_0(c))
}
Err(e) => Err(e).context("failed to deserialize cache as v0.0.0")?,
}
}
_ => unimplemented!(),
Expand All @@ -323,7 +326,7 @@ fn read_cache_metadata_or_default(cache_metadata_path: &PathBuf) -> Result<Versi
// numeric keys in hashmaps, see <https://github.com/serde-rs/serde/issues/1183>.
match serde_json::from_slice::<HashMap<String, Box<dyn ModProviderCache>>>(&buf) {
Ok(c) => MaybeVersionedCache::Legacy(Cache_v0_0_0 { cache: c }),
Err(e) => Err(e).context("failed to deserialize legacy cache")?
Err(e) => Err(e).context("failed to deserialize legacy cache")?,
}
}
}
Expand Down

0 comments on commit fe9635e

Please sign in to comment.