Skip to content

Commit 4341734

Browse files
authored
Appease clippy and fix CI using a better-supported big endian arch. (#90)
* Appease clippy. * Switch CI to a big endian arch that has rust-std component. * Remove unstable error number from test.
1 parent 76e5998 commit 4341734

File tree

9 files changed

+16
-15
lines changed

9 files changed

+16
-15
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ jobs:
1717
- uses: actions-rs/toolchain@v1
1818
with:
1919
# Nightly toolchain must ship the `rust-std` component for
20-
# `i686-unknown-linux-gnu` and `mips64-unknown-linux-gnuabi64`.
20+
# `i686-unknown-linux-gnu` and powerpc64-unknown-linux-gnu (or `mips64-unknown-linux-gnuabi64`).
2121
# In practice, `rust-std` almost always ships for
22-
# `i686-unknown-linux-gnu` so we just need to check this page for a
22+
# `i686-unknown-linux-gnu` so we just need to check either of these pages for a
2323
# compatible nightly:
24+
# https://rust-lang.github.io/rustup-components-history/powerpc64-unknown-linux-gnu
2425
# https://rust-lang.github.io/rustup-components-history/mips64-unknown-linux-gnuabi64.html
25-
toolchain: nightly-2023-04-25
26+
toolchain: nightly-2025-10-10
2627
override: true
2728
components: rustfmt, miri
2829
- name: Lint
@@ -48,9 +49,9 @@ jobs:
4849
- name: Test (miri all-features)
4950
run: cargo miri test --all-features
5051
- name: Setup Miri (big-endian)
51-
run: rustup target add mips64-unknown-linux-gnuabi64 && cargo miri setup --target mips64-unknown-linux-gnuabi64
52+
run: rustup target add powerpc64-unknown-linux-gnu && cargo miri setup --target powerpc64-unknown-linux-gnu
5253
- name: Test (miri big-endian)
53-
run: cargo miri test --target mips64-unknown-linux-gnuabi64
54+
run: cargo miri test --target powerpc64-unknown-linux-gnu
5455
msrv:
5556
runs-on: ubuntu-latest
5657
steps:

bitcode_derive/src/encode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl crate::shared::Item for Item {
156156
})
157157
.collect();
158158
quote! {
159-
#[allow(unused_variables)]
159+
#[allow(unused_variables, unused_assignments)]
160160
self.variants.encode(&match v {
161161
#variants
162162
});
@@ -300,15 +300,15 @@ impl crate::shared::Derive<{ Item::COUNT }> for Encode {
300300

301301
// #[cfg_attr(not(debug_assertions), inline(always))]
302302
// #[inline(never)]
303-
fn encode_vectored<'__v>(&mut self, i: impl Iterator<Item = &'__v #input_ty> + Clone) where #input_ty: '__v {
303+
fn encode_vectored<'__v>(&mut self, #[allow(unused)] i: impl Iterator<Item = &'__v #input_ty> + Clone) where #input_ty: '__v {
304304
#[allow(unused_imports)]
305305
use #private::Buffer as _;
306306
#encode_vectored_body
307307
}
308308
}
309309

310310
impl #encoder_impl_generics #private::Buffer for #encoder_ty #encoder_where_clause {
311-
fn collect_into(&mut self, out: &mut #private::Vec<u8>) {
311+
fn collect_into(&mut self, #[allow(unused)] out: &mut #private::Vec<u8>) {
312312
#collect_into_body
313313
}
314314

src/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a> View<'a> for BoolDecoder<'a> {
4242

4343
impl<'a> Decoder<'a, bool> for BoolDecoder<'a> {
4444
#[inline(always)]
45-
fn as_primitive(&mut self) -> Option<&mut SliceImpl<Unaligned<bool>>> {
45+
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<bool>>> {
4646
// Safety: `Unaligned<bool>` is equivalent to bool since it's a `#[repr(C, packed)]` wrapper
4747
// around bool and both have size/align of 1.
4848
unsafe { Some(core::mem::transmute(self.0.mut_slice())) }

src/coder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub trait Decoder<'a, T>: View<'a> + Default + Send + Sync {
7171
/// Returns a `&mut SliceImpl<Unaligned<T>>` if `T` is a type that can be decoded by copying.
7272
/// Uses `Unaligned<T>` so `IntDecoder` can borrow from input `[u8]`.
7373
#[inline(always)]
74-
fn as_primitive(&mut self) -> Option<&mut SliceImpl<Unaligned<T>>> {
74+
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<T>>> {
7575
None
7676
}
7777

src/derive/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a, T: Decode<'a>, const N: usize> View<'a> for ArrayDecoder<'a, T, N> {
7676
}
7777

7878
impl<'a, T: Decode<'a>, const N: usize> Decoder<'a, [T; N]> for ArrayDecoder<'a, T, N> {
79-
fn as_primitive(&mut self) -> Option<&mut FastSlice<Unaligned<[T; N]>>> {
79+
fn as_primitive(&mut self) -> Option<&mut FastSlice<'_, Unaligned<[T; N]>>> {
8080
self.0.as_primitive().map(|s| {
8181
// Safety: FastSlice doesn't have a length unlike slice, so casting to FastSlice<[T; N]>
8282
// is safe. N == 0 case is also safe for the same reason.

src/derive/impls.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ macro_rules! impl_both {
2828
}
2929
};
3030
}
31-
pub(crate) use impl_both;
3231
impl_both!(bool, BoolEncoder, BoolDecoder);
3332
impl_both!(f32, F32Encoder, F32Decoder);
3433
impl_both!(String, StrEncoder, StrDecoder);

src/derive/vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ macro_rules! unsafe_wild_copy {
7777
}
7878
}
7979
}
80+
#[allow(unused_imports)]
8081
pub(crate) use unsafe_wild_copy;
8182

8283
impl<T: Encode> VecEncoder<T> {

src/int.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'a, T: Int> View<'a> for IntDecoder<'a, T> {
6161
// Makes IntDecoder<u32> able to decode i32/f32 (but not char since it can fail).
6262
impl<'a, T: Int, P: Pod> Decoder<'a, P> for IntDecoder<'a, T> {
6363
#[inline(always)]
64-
fn as_primitive(&mut self) -> Option<&mut SliceImpl<Unaligned<P>>> {
64+
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<P>>> {
6565
Some(self.0.mut_slice().cast())
6666
}
6767

@@ -107,7 +107,7 @@ where
107107
<C as CheckedBitPattern>::Bits: Pod,
108108
{
109109
#[inline(always)]
110-
fn as_primitive(&mut self) -> Option<&mut SliceImpl<Unaligned<C>>> {
110+
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<C>>> {
111111
self.0
112112
.as_primitive()
113113
.map(|p: &mut SliceImpl<'_, Unaligned<I>>| {

src/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ mod tests {
254254
#[doc(hidden)]
255255
pub fn _cant_decode_static_from_non_static_buffer() {}
256256

257-
/// ```compile_fail,E0495
257+
/// ```compile_fail
258258
/// use bitcode::{encode, decode, Encode, Decode};
259259
///
260260
/// type StaticStr = &'static str;

0 commit comments

Comments
 (0)