Skip to content
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Lint
run: |
cargo fmt -- --check
cargo clippy --all-targets
cargo clippy --all-targets --no-deps

- name: Build Documentation
run: cargo doc --no-deps
Expand All @@ -37,9 +37,9 @@ jobs:
minimum-supported-rust-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.36.0
toolchain: 1.78.0
override: true
- run: cargo check
4 changes: 2 additions & 2 deletions .github/workflows/rustdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -26,7 +26,7 @@ jobs:
run: cargo doc --no-deps

- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
Expand Down
32 changes: 16 additions & 16 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'de> Deserializer<'de> {
Ok(u128::from_le_bytes(le_bytes))
}

#[allow(clippy::integer_arithmetic)]
#[allow(clippy::arithmetic_side_effects)]
fn parse_u32_from_uleb128(&mut self) -> Result<u32> {
let mut value: u64 = 0;
for shift in (0..32).step_by(7) {
Expand Down Expand Up @@ -223,7 +223,7 @@ impl<'de> Deserializer<'de> {
}
}

impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
impl<'de> de::Deserializer<'de> for &mut Deserializer<'de> {
type Error = Error;

// BCS is not a self-describing format so we can't implement `deserialize_any`
Expand Down Expand Up @@ -400,23 +400,23 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
r
}

fn deserialize_seq<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
{
let len = self.parse_length()?;
visitor.visit_seq(SeqDeserializer::new(&mut self, len))
visitor.visit_seq(SeqDeserializer::new(self, len))
}

fn deserialize_tuple<V>(mut self, len: usize, visitor: V) -> Result<V::Value>
fn deserialize_tuple<V>(self, len: usize, visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
{
visitor.visit_seq(SeqDeserializer::new(&mut self, len))
visitor.visit_seq(SeqDeserializer::new(self, len))
}

fn deserialize_tuple_struct<V>(
mut self,
self,
name: &'static str,
len: usize,
visitor: V,
Expand All @@ -425,21 +425,21 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
V: Visitor<'de>,
{
self.enter_named_container(name)?;
let r = visitor.visit_seq(SeqDeserializer::new(&mut self, len));
let r = visitor.visit_seq(SeqDeserializer::new(self, len));
self.leave_named_container();
r
}

fn deserialize_map<V>(mut self, visitor: V) -> Result<V::Value>
fn deserialize_map<V>(self, visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
{
let len = self.parse_length()?;
visitor.visit_map(MapDeserializer::new(&mut self, len))
visitor.visit_map(MapDeserializer::new(self, len))
}

fn deserialize_struct<V>(
mut self,
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V,
Expand All @@ -448,7 +448,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
V: Visitor<'de>,
{
self.enter_named_container(name)?;
let r = visitor.visit_seq(SeqDeserializer::new(&mut self, fields.len()));
let r = visitor.visit_seq(SeqDeserializer::new(self, fields.len()));
self.leave_named_container();
r
}
Expand Down Expand Up @@ -501,7 +501,7 @@ impl<'a, 'de> SeqDeserializer<'a, 'de> {
}
}

impl<'de, 'a> de::SeqAccess<'de> for SeqDeserializer<'a, 'de> {
impl<'de> de::SeqAccess<'de> for SeqDeserializer<'_, 'de> {
type Error = Error;

fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>>
Expand Down Expand Up @@ -537,7 +537,7 @@ impl<'a, 'de> MapDeserializer<'a, 'de> {
}
}

impl<'de, 'a> de::MapAccess<'de> for MapDeserializer<'a, 'de> {
impl<'de> de::MapAccess<'de> for MapDeserializer<'_, 'de> {
type Error = Error;

fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>>
Expand Down Expand Up @@ -577,7 +577,7 @@ impl<'de, 'a> de::MapAccess<'de> for MapDeserializer<'a, 'de> {
}
}

impl<'de, 'a> de::EnumAccess<'de> for &'a mut Deserializer<'de> {
impl<'de> de::EnumAccess<'de> for &mut Deserializer<'de> {
type Error = Error;
type Variant = Self;

Expand All @@ -591,7 +591,7 @@ impl<'de, 'a> de::EnumAccess<'de> for &'a mut Deserializer<'de> {
}
}

impl<'de, 'a> de::VariantAccess<'de> for &'a mut Deserializer<'de> {
impl<'de> de::VariantAccess<'de> for &mut Deserializer<'de> {
type Error = Error;

fn unit_variant(self) -> Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! * provide good performance and concise (binary) representations;
//! * support a rich set of data types commonly used in Rust;
//! * enforce canonical serialization, meaning that every value of a given type should have
//! a single valid representation.
//! a single valid representation.
//!
//! BCS also aims to mitigate the consequence of malicious inputs by enforcing well-defined limits
//! on large or nested containers during (de)serialization.
Expand Down Expand Up @@ -44,7 +44,7 @@
//! applications must carefully plan in advance for adhoc extension points:
//! * Enums may be used for explicit versioning and backward compatibility (e.g. extensible query interfaces).
//! * In some cases, data fields of type `Vec<u8>` may also be added to allow (future) unknown payloads
//! in serialized form.
//! in serialized form.
//!
//! ## Detailed Specifications
//!
Expand Down
14 changes: 7 additions & 7 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ where
}
}

impl<'a, W> ser::SerializeSeq for Serializer<'a, W>
impl<W> ser::SerializeSeq for Serializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand All @@ -425,7 +425,7 @@ where
}
}

impl<'a, W> ser::SerializeTuple for Serializer<'a, W>
impl<W> ser::SerializeTuple for Serializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand All @@ -444,7 +444,7 @@ where
}
}

impl<'a, W> ser::SerializeTupleStruct for Serializer<'a, W>
impl<W> ser::SerializeTupleStruct for Serializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand All @@ -463,7 +463,7 @@ where
}
}

impl<'a, W> ser::SerializeTupleVariant for Serializer<'a, W>
impl<W> ser::SerializeTupleVariant for Serializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand Down Expand Up @@ -499,7 +499,7 @@ impl<'a, W: ?Sized> MapSerializer<'a, W> {
}
}

impl<'a, W> ser::SerializeMap for MapSerializer<'a, W>
impl<W> ser::SerializeMap for MapSerializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand Down Expand Up @@ -560,7 +560,7 @@ where
}
}

impl<'a, W> ser::SerializeStruct for Serializer<'a, W>
impl<W> ser::SerializeStruct for Serializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand All @@ -579,7 +579,7 @@ where
}
}

impl<'a, W> ser::SerializeStructVariant for Serializer<'a, W>
impl<W> ser::SerializeStructVariant for Serializer<'_, W>
where
W: ?Sized + std::io::Write,
{
Expand Down
3 changes: 2 additions & 1 deletion tests/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// For some reason deriving `Arbitrary` results in clippy firing a `unit_arg` violation
#![allow(clippy::unit_arg)]
#![allow(non_local_definitions)]

use std::{
collections::{BTreeMap, BTreeSet},
Expand Down Expand Up @@ -545,7 +546,7 @@ fn serde_known_vector() {
map.insert(vec![20, 21, 89, 105], vec![201, 23, 90]);

let f = Foo {
a: u64::max_value(),
a: u64::MAX,
b: vec![100, 99, 88, 77, 66, 55],
c: b,
d: true,
Expand Down
Loading