Fix CI and clippy (#747)

* Fix CI and clippy

* Fix CI

* Disable code coverage
This commit is contained in:
Trangar 2025-03-02 16:48:16 +01:00 committed by GitHub
parent 86ca1a44b3
commit f98bc70757
13 changed files with 35 additions and 74 deletions

View File

@ -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",

View File

@ -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",

View File

@ -140,7 +140,7 @@ fi",
"uses": "actions-rs/toolchain@v1",
"with": {
"profile": "minimal",
"toolchain": "stable",
"toolchain": "1.85.0",
"override": true,
"components": "rustfmt, clippy"
},
@ -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"
@ -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/tarpaulin@v0.1",
"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"
}
}
]
}
}
}

View File

@ -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,
{
@ -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>,
{

View File

@ -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)
}
@ -481,7 +481,7 @@ where
}
}
impl<'a, T> Encode for &'a T
impl<T> Encode for &T
where
T: Encode + ?Sized,
{

View File

@ -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>;
@ -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,
{

View File

@ -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() {

View File

@ -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,
@ -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,

View File

@ -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
@ -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)
}

View File

@ -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>
@ -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;
@ -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> {

View File

@ -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>
@ -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;
@ -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> {

View File

@ -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,
{
@ -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;
@ -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;
@ -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;
@ -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;
@ -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;
@ -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;
@ -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;

View File

@ -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 {}