diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2637d52..706693f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,11 +10,9 @@ env: permissions: contents: read - pages: write - id-token: write concurrency: - group: pages + group: docs cancel-in-progress: true jobs: @@ -29,19 +27,3 @@ jobs: run: cargo doc --no-deps --all-features env: RUSTDOCFLAGS: --cfg docsrs - - name: redirect root to crate - run: echo '' > target/doc/index.html - - uses: actions/upload-pages-artifact@v3 - with: - path: target/doc - - deploy: - name: deploy to pages - needs: build - runs-on: ubuntu-24.04 - environment: - name: github-pages - url: ${{ steps.deploy.outputs.page_url }} - steps: - - id: deploy - uses: actions/deploy-pages@v4 diff --git a/src/fdt.rs b/src/fdt.rs index bfb1070..12caed9 100644 --- a/src/fdt.rs +++ b/src/fdt.rs @@ -328,10 +328,13 @@ pub(crate) fn value_as_u32s(value: &[u8]) -> Option + if !value.len().is_multiple_of(4) { return None; } - Some(value.chunks_exact(4).map(|c| { - let arr: [u8; 4] = c.try_into().unwrap_or([0; 4]); - u32::from_be_bytes(arr) - })) + Some( + value + .as_chunks::<4>() + .0 + .iter() + .map(|c| u32::from_be_bytes(*c)), + ) } /// NUL-separated UTF-8 stringlist (FDT `stringlist` encoding). Strict: must diff --git a/src/overlay.rs b/src/overlay.rs index 84b7e53..6c9ac72 100644 --- a/src/overlay.rs +++ b/src/overlay.rs @@ -525,9 +525,8 @@ fn walk_local_fixups<'a>( if !raw.len().is_multiple_of(4) { return Err(MalformedKind::BadFixupEntry.into()); } - for chunk in raw.chunks_exact(4) { - let arr: [u8; 4] = chunk.try_into().map_err(|_| MalformedKind::BadFixupEntry)?; - let byte_offset = u32::from_be_bytes(arr); + for chunk in raw.as_chunks::<4>().0 { + let byte_offset = u32::from_be_bytes(*chunk); check_rewrite_in_bounds(byte_offset, target_len)?; push_rewrite( rewrites, diff --git a/tests/error_display.rs b/tests/error_display.rs index 3204f6a..61a3b21 100644 --- a/tests/error_display.rs +++ b/tests/error_display.rs @@ -35,7 +35,7 @@ fn every_limit_variant_renders_nonempty() { #[test] fn buffer_too_small_renders_nonempty() { let s = render(Error::BufferTooSmall { needed: 0 }); - assert!(!s.is_empty()); + assert_ne!(s, ""); assert!(s.starts_with("destination buffer"), "{s:?}"); }