Skip to content

Commit

Permalink
NO-JIRA: Fix clippy errors from Rust 1.78 (#2892)
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
martin-g authored May 7, 2024
1 parent 362aef8 commit 9632b74
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 33 deletions.
2 changes: 1 addition & 1 deletion lang/rust/avro/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ impl Parser {
let name = Name::new(name)?;
let fully_qualified_name = name.fully_qualified_name(enclosing_namespace);

if self.parsed_schemas.get(&fully_qualified_name).is_some() {
if self.parsed_schemas.contains_key(&fully_qualified_name) {
return Ok(Schema::Ref {
name: fully_qualified_name,
});
Expand Down
56 changes: 24 additions & 32 deletions lang/rust/avro/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ impl<'b> ser::Serializer for &'b mut Serializer {
Ok(Value::from(None::<Self::Ok>))
}

fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
fn serialize_some<T>(self, value: &T) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
let v = value.serialize(&mut Serializer::default())?;
Ok(Value::from(Some(v)))
Expand All @@ -206,26 +206,26 @@ impl<'b> ser::Serializer for &'b mut Serializer {
Ok(Value::String(variant.to_string()))
}

fn serialize_newtype_struct<T: ?Sized>(
fn serialize_newtype_struct<T>(
self,
_: &'static str,
value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(self)
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
_: &'static str,
index: u32,
variant: &'static str,
value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Ok(Value::Record(vec![
("type".to_owned(), Value::Enum(index, variant.to_owned())),
Expand Down Expand Up @@ -293,9 +293,9 @@ impl ser::SerializeSeq for SeqSerializer {
type Ok = Value;
type Error = Error;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.items
.push(value.serialize(&mut Serializer::default())?);
Expand All @@ -311,9 +311,9 @@ impl ser::SerializeTuple for SeqSerializer {
type Ok = Value;
type Error = Error;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
ser::SerializeSeq::serialize_element(self, value)
}
Expand All @@ -327,9 +327,9 @@ impl ser::SerializeTupleStruct for SeqSerializer {
type Ok = Value;
type Error = Error;

fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
ser::SerializeSeq::serialize_element(self, value)
}
Expand All @@ -343,9 +343,9 @@ impl<'a> ser::SerializeSeq for SeqVariantSerializer<'a> {
type Ok = Value;
type Error = Error;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.items.push(Value::Union(
self.index,
Expand All @@ -369,9 +369,9 @@ impl<'a> ser::SerializeTupleVariant for SeqVariantSerializer<'a> {
type Ok = Value;
type Error = Error;

fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
ser::SerializeSeq::serialize_element(self, value)
}
Expand All @@ -385,9 +385,9 @@ impl ser::SerializeMap for MapSerializer {
type Ok = Value;
type Error = Error;

fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), Self::Error>
fn serialize_key<T>(&mut self, key: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
let key = key.serialize(&mut Serializer::default())?;

Expand All @@ -399,9 +399,9 @@ impl ser::SerializeMap for MapSerializer {
}
}

fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
fn serialize_value<T>(&mut self, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.values
.push(value.serialize(&mut Serializer::default())?);
Expand All @@ -424,13 +424,9 @@ impl ser::SerializeStruct for StructSerializer {
type Ok = Value;
type Error = Error;

fn serialize_field<T: ?Sized>(
&mut self,
name: &'static str,
value: &T,
) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, name: &'static str, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.fields.push((
name.to_owned(),
Expand All @@ -448,13 +444,9 @@ impl<'a> ser::SerializeStructVariant for StructVariantSerializer<'a> {
type Ok = Value;
type Error = Error;

fn serialize_field<T: ?Sized>(
&mut self,
name: &'static str,
value: &T,
) -> Result<(), Self::Error>
fn serialize_field<T>(&mut self, name: &'static str, value: &T) -> Result<(), Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.fields.push((
name.to_owned(),
Expand Down

0 comments on commit 9632b74

Please sign in to comment.