Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI and clippy #747

Merged
merged 3 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
{
"name": "Upload Crash",
"uses": "actions/upload-artifact@v3",
"uses": "actions/upload-artifact@v4",
"if": "failure() && steps.build.outcome == 'success'",
"with": {
"name": "artifacts",
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cross_platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
# "mips64-unknown-linux-muslabi64",
# "mips64el-unknown-linux-muslabi64",
# "mipsel-unknown-linux-musl",
"sparc64-unknown-linux-gnu",
# Could not link to `getrandom`
# "sparc64-unknown-linux-gnu",
# BLOCKEDTODO(https://github.com/cross-rs/cross/issues/975): currently broken
# "sparcv9-sun-solaris",
"thumbv7neon-linux-androideabi",
Expand Down
43 changes: 2 additions & 41 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fi",
"uses": "actions-rs/toolchain@v1",
"with": {
"profile": "minimal",
"toolchain": "stable",
"toolchain": "1.85.0",
"override": true,
"components": "rustfmt, clippy"
},
Expand Down Expand Up @@ -176,7 +176,7 @@ fi",
"uses": "actions-rs/toolchain@v1",
"with": {
"profile": "minimal",
"toolchain": "stable",
"toolchain": "1.85.0",
"override": true,
},
"name": "Install Rust stable"
Expand All @@ -190,45 +190,6 @@ fi",
"name": "Run compatibility tests"
}
]
},
"coverage": {
"name": "Code Coverage",
"runs-on": "ubuntu-latest",
"steps": [
{
"uses": "actions/checkout@v4",
"name": "Checkout"
},
{
"uses": "actions-rs/toolchain@v1",
"with": {
"profile": "minimal",
"toolchain": "nightly",
"override": true
},
"name": "Install Rust nightly"
},
{
"name": "Run cargo-tarpaulin",
"uses": "actions-rs/[email protected]",
"with": {
"version": "0.19.1",
"args": "--all --all-features"
}
},
{
"name": "Upload to codecov.io",
"uses": "codecov/codecov-action@v3"
},
{
"name": "Archive code coverage results",
"uses": "actions/upload-artifact@v3",
"with": {
"name": "code-coverage-report",
"path": "cobertura.xml"
}
}
]
}
}
}
4 changes: 2 additions & 2 deletions src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub trait BorrowDecoder<'de>: Decoder {
fn borrow_reader(&mut self) -> &mut Self::BR;
}

impl<'a, T> Decoder for &'a mut T
impl<T> Decoder for &mut T
where
T: Decoder,
{
Expand All @@ -242,7 +242,7 @@ where
}
}

impl<'a, 'de, T> BorrowDecoder<'de> for &'a mut T
impl<'de, T> BorrowDecoder<'de> for &mut T
where
T: BorrowDecoder<'de>,
{
Expand Down
14 changes: 7 additions & 7 deletions src/enc/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,20 @@ fn encode_utf8(writer: &mut impl Writer, c: char) -> Result<(), EncodeError> {
writer.write(&[c as u8])
} else if code < MAX_TWO_B {
let mut buf = [0u8; 2];
buf[0] = (code >> 6 & 0x1F) as u8 | TAG_TWO_B;
buf[0] = ((code >> 6) & 0x1F) as u8 | TAG_TWO_B;
buf[1] = (code & 0x3F) as u8 | TAG_CONT;
writer.write(&buf)
} else if code < MAX_THREE_B {
let mut buf = [0u8; 3];
buf[0] = (code >> 12 & 0x0F) as u8 | TAG_THREE_B;
buf[1] = (code >> 6 & 0x3F) as u8 | TAG_CONT;
buf[0] = ((code >> 12) & 0x0F) as u8 | TAG_THREE_B;
buf[1] = ((code >> 6) & 0x3F) as u8 | TAG_CONT;
buf[2] = (code & 0x3F) as u8 | TAG_CONT;
writer.write(&buf)
} else {
let mut buf = [0u8; 4];
buf[0] = (code >> 18 & 0x07) as u8 | TAG_FOUR_B;
buf[1] = (code >> 12 & 0x3F) as u8 | TAG_CONT;
buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT;
buf[0] = ((code >> 18) & 0x07) as u8 | TAG_FOUR_B;
buf[1] = ((code >> 12) & 0x3F) as u8 | TAG_CONT;
buf[2] = ((code >> 6) & 0x3F) as u8 | TAG_CONT;
buf[3] = (code & 0x3F) as u8 | TAG_CONT;
writer.write(&buf)
}
Expand Down Expand Up @@ -481,7 +481,7 @@ where
}
}

impl<'a, T> Encode for &'a T
impl<T> Encode for &T
where
T: Encode + ?Sized,
{
Expand Down
3 changes: 1 addition & 2 deletions src/enc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub use self::encoder::EncoderImpl;
/// ```
///
/// From here you can add/remove fields, or add custom logic.

pub trait Encode {
/// Encode a given type.
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError>;
Expand All @@ -68,7 +67,7 @@ pub trait Encoder: Sealed {
fn config(&self) -> &Self::C;
}

impl<'a, T> Encoder for &'a mut T
impl<T> Encoder for &mut T
where
T: Encoder,
{
Expand Down
2 changes: 1 addition & 1 deletion src/enc/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<'storage> SliceWriter<'storage> {
}
}

impl<'storage> Writer for SliceWriter<'storage> {
impl Writer for SliceWriter<'_> {
#[inline(always)]
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError> {
if bytes.len() > self.slice.len() {
Expand Down
4 changes: 2 additions & 2 deletions src/features/impl_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ where
}
}

impl<'cow, T> Decode for Cow<'cow, T>
impl<T> Decode for Cow<'_, T>
where
T: ToOwned + ?Sized,
<T as ToOwned>::Owned: Decode,
Expand All @@ -418,7 +418,7 @@ where
}
}

impl<'cow, T> Encode for Cow<'cow, T>
impl<T> Encode for Cow<'_, T>
where
T: ToOwned + ?Sized,
for<'a> &'a T: Encode,
Expand Down
4 changes: 2 additions & 2 deletions src/features/impl_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'a, W: std::io::Write> IoWriter<'a, W> {
}
}

impl<'storage, W: std::io::Write> Writer for IoWriter<'storage, W> {
impl<W: std::io::Write> Writer for IoWriter<'_, W> {
#[inline(always)]
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError> {
self.writer
Expand All @@ -128,7 +128,7 @@ impl<'storage, W: std::io::Write> Writer for IoWriter<'storage, W> {
}
}

impl<'a> Encode for &'a CStr {
impl Encode for &CStr {
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> {
self.to_bytes().encode(encoder)
}
Expand Down
6 changes: 3 additions & 3 deletions src/features/serde/de_borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(super) struct SerdeDecoder<'a, 'de, DE: BorrowDecoder<'de>> {
pub(super) pd: PhantomData<&'de ()>,
}

impl<'a, 'de, DE: BorrowDecoder<'de>> Deserializer<'de> for SerdeDecoder<'a, 'de, DE> {
impl<'de, DE: BorrowDecoder<'de>> Deserializer<'de> for SerdeDecoder<'_, 'de, DE> {
type Error = DecodeError;

fn deserialize_any<V>(self, _: V) -> Result<V::Value, Self::Error>
Expand Down Expand Up @@ -433,7 +433,7 @@ impl<'a, 'de, DE: BorrowDecoder<'de>> Deserializer<'de> for SerdeDecoder<'a, 'de
}
}

impl<'de, 'a, DE: BorrowDecoder<'de>> EnumAccess<'de> for SerdeDecoder<'a, 'de, DE> {
impl<'de, DE: BorrowDecoder<'de>> EnumAccess<'de> for SerdeDecoder<'_, 'de, DE> {
type Error = DecodeError;
type Variant = Self;

Expand All @@ -447,7 +447,7 @@ impl<'de, 'a, DE: BorrowDecoder<'de>> EnumAccess<'de> for SerdeDecoder<'a, 'de,
}
}

impl<'de, 'a, DE: BorrowDecoder<'de>> VariantAccess<'de> for SerdeDecoder<'a, 'de, DE> {
impl<'de, DE: BorrowDecoder<'de>> VariantAccess<'de> for SerdeDecoder<'_, 'de, DE> {
type Error = DecodeError;

fn unit_variant(self) -> Result<(), Self::Error> {
Expand Down
6 changes: 3 additions & 3 deletions src/features/serde/de_owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) struct SerdeDecoder<'a, DE: Decoder> {
pub(crate) de: &'a mut DE,
}

impl<'a, 'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'a, DE> {
impl<'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'_, DE> {
type Error = DecodeError;

fn deserialize_any<V>(self, _: V) -> Result<V::Value, Self::Error>
Expand Down Expand Up @@ -438,7 +438,7 @@ impl<'a, 'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'a, DE> {
}
}

impl<'de, 'a, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'a, DE> {
impl<'de, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'_, DE> {
type Error = DecodeError;
type Variant = Self;

Expand All @@ -452,7 +452,7 @@ impl<'de, 'a, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'a, DE> {
}
}

impl<'de, 'a, DE: Decoder> VariantAccess<'de> for SerdeDecoder<'a, DE> {
impl<'de, DE: Decoder> VariantAccess<'de> for SerdeDecoder<'_, DE> {
type Error = DecodeError;

fn unit_variant(self) -> Result<(), Self::Error> {
Expand Down
16 changes: 8 additions & 8 deletions src/features/serde/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub(super) struct SerdeEncoder<'a, ENC: Encoder> {
pub(super) enc: &'a mut ENC,
}

impl<'a, ENC> Serializer for SerdeEncoder<'a, ENC>
impl<ENC> Serializer for SerdeEncoder<'_, ENC>
where
ENC: Encoder,
{
Expand Down Expand Up @@ -286,7 +286,7 @@ where

type Compound<'a, ENC> = SerdeEncoder<'a, ENC>;

impl<'a, ENC: Encoder> SerializeSeq for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeSeq for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand All @@ -302,7 +302,7 @@ impl<'a, ENC: Encoder> SerializeSeq for Compound<'a, ENC> {
}
}

impl<'a, ENC: Encoder> SerializeTuple for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeTuple for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand All @@ -318,7 +318,7 @@ impl<'a, ENC: Encoder> SerializeTuple for Compound<'a, ENC> {
}
}

impl<'a, ENC: Encoder> SerializeTupleStruct for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeTupleStruct for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand All @@ -334,7 +334,7 @@ impl<'a, ENC: Encoder> SerializeTupleStruct for Compound<'a, ENC> {
}
}

impl<'a, ENC: Encoder> SerializeTupleVariant for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeTupleVariant for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand All @@ -350,7 +350,7 @@ impl<'a, ENC: Encoder> SerializeTupleVariant for Compound<'a, ENC> {
}
}

impl<'a, ENC: Encoder> SerializeMap for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeMap for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand All @@ -373,7 +373,7 @@ impl<'a, ENC: Encoder> SerializeMap for Compound<'a, ENC> {
}
}

impl<'a, ENC: Encoder> SerializeStruct for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeStruct for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand All @@ -389,7 +389,7 @@ impl<'a, ENC: Encoder> SerializeStruct for Compound<'a, ENC> {
}
}

impl<'a, ENC: Encoder> SerializeStructVariant for Compound<'a, ENC> {
impl<ENC: Encoder> SerializeStructVariant for Compound<'_, ENC> {
type Ok = ();
type Error = EncodeError;

Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub trait Sealed {}

impl<'a, T> Sealed for &'a mut T where T: Sealed {}
impl<T> Sealed for &mut T where T: Sealed {}
Loading