Skip to content

Commit

Permalink
[sdk] Make clippy happy
Browse files Browse the repository at this point in the history
It seems that a recent Rust update introduced more warnings, and since
we didn't force an explicit Rust version, things broke.
  • Loading branch information
paw-hub authored and charlag committed Dec 5, 2024
1 parent 9df7693 commit 1ce6036
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
14 changes: 7 additions & 7 deletions tuta-sdk/rust/sdk/src/instance_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ struct ElementValueDeserializer<'s> {
value: ElementValue,
}

impl<'s> ElementValueDeserializer<'s> {
impl ElementValueDeserializer<'_> {
fn wrong_type_err(&self, expected: &str) -> DeError {
DeError::wrong_type(self.key, &self.value, expected)
}
}

impl<'de, 's> Deserializer<'de> for ElementValueDeserializer<'s> {
impl<'de> Deserializer<'de> for ElementValueDeserializer<'_> {
type Error = DeError;

serde::forward_to_deserialize_any! {
Expand Down Expand Up @@ -277,12 +277,12 @@ impl<'de, 's> Deserializer<'de> for ElementValueDeserializer<'s> {
where
V: Visitor<'de>,
{
return match self.value {
match self.value {
ElementValue::String(str) => visitor.visit_string(str),
ElementValue::IdGeneratedId(GeneratedId(id))
| ElementValue::IdCustomId(CustomId(id)) => visitor.visit_string(id),
_ => Err(self.wrong_type_err("string")),
};
}
}

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error>
Expand Down Expand Up @@ -432,7 +432,7 @@ impl<'de, 's> Deserializer<'de> for ElementValueDeserializer<'s> {
}
}

impl<'de, 's> EnumAccess<'de> for ElementValueDeserializer<'s> {
impl<'de> EnumAccess<'de> for ElementValueDeserializer<'_> {
type Error = DeError;
type Variant = Self;

Expand All @@ -446,7 +446,7 @@ impl<'de, 's> EnumAccess<'de> for ElementValueDeserializer<'s> {
}
}

impl<'de, 's> VariantAccess<'de> for ElementValueDeserializer<'s> {
impl<'de> VariantAccess<'de> for ElementValueDeserializer<'_> {
type Error = DeError;

fn unit_variant(self) -> Result<(), Self::Error> {
Expand Down Expand Up @@ -512,7 +512,7 @@ where
}
}

impl<'de, 's, I> de::SeqAccess<'de> for ArrayDeserializer<'s, I>
impl<'de, I> de::SeqAccess<'de> for ArrayDeserializer<'_, I>
where
I: Iterator<Item = ElementValue>,
{
Expand Down
13 changes: 6 additions & 7 deletions tuta-sdk/rust/sdk/src/services/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ macro_rules! __service_handle_response {
/// // but respond with `NewsOut`
/// service_impl!(GET, NewsService, (), NewsOut);
/// ```
// we don't want to generate the rust code for services from the JS directly because it's harder to maintain and
// largely unreadable.
//
// since services can either take an arg or not and return something or not, we need a trampoline implementation
// for each service that can decode and return the response or just return Ok(()) immediately after receiving a 200.
// this trampoline is implemented in the last branch below.
#[macro_export]
macro_rules! service_impl {
// we don't want to generate the rust code for services from the JS directly because it's harder to maintain and
// largely unreadable.
//
// since services can either take an arg or not and return something or not, we need a trampoline implementation
// for each service that can decode and return the response or just return Ok(()) immediately after receiving a 200.
// this trampoline is implemented in the last branch below.
(declare, $service_name: ty, $service_path: expr, $service_version: expr) => {
// mark the type as Service
// This implementation is required to be able to implement any HTTP method
Expand Down

0 comments on commit 1ce6036

Please sign in to comment.