From 84286535639daf2d21275f81cc0d46c37619952f Mon Sep 17 00:00:00 2001 From: Matthijs Brobbel Date: Thu, 26 Sep 2024 21:24:17 +0200 Subject: [PATCH] Fix clippy warnings --- arrow-schema/src/datatype.rs | 10 +++++----- arrow-schema/src/field.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arrow-schema/src/datatype.rs b/arrow-schema/src/datatype.rs index 2bf9663ef512..b7a326f605f3 100644 --- a/arrow-schema/src/datatype.rs +++ b/arrow-schema/src/datatype.rs @@ -790,7 +790,7 @@ pub trait ExtensionType: Sized { /// Returns the serialized representation of the metadata of this extension /// type, or `None` if this extension type has no metadata. - fn into_serialized_metadata(&self) -> Option; + fn serialized_metadata(&self) -> Option; /// Deserialize this extension type from the serialized representation of the /// metadata of this extension. An extension type that has no metadata should @@ -842,7 +842,7 @@ impl ExtensionTypeExt for T where T: ExtensionType {} /// the definitions of well-known extension types so as to improve /// interoperability between different systems integrating Arrow columnar data. pub mod canonical_extension_types { - use serde_json::{Map, Value}; + use serde_json::Value; use super::{DataType, ExtensionType}; @@ -905,7 +905,7 @@ pub mod canonical_extension_types { Some(&self.0) } - fn into_serialized_metadata(&self) -> Option { + fn serialized_metadata(&self) -> Option { Some(self.0.to_string()) } @@ -917,7 +917,7 @@ pub mod canonical_extension_types { value => value .parse::() .ok() - .filter(|value| value.as_object().is_some_and(Map::is_empty)) + .filter(|value| matches!(value.as_object(), Some(map) if map.is_empty())) .map(Self), }) } @@ -952,7 +952,7 @@ pub mod canonical_extension_types { None } - fn into_serialized_metadata(&self) -> Option { + fn serialized_metadata(&self) -> Option { None } diff --git a/arrow-schema/src/field.rs b/arrow-schema/src/field.rs index bca3257b4bd6..f16e2f9bbc05 100644 --- a/arrow-schema/src/field.rs +++ b/arrow-schema/src/field.rs @@ -370,7 +370,7 @@ impl Field { self.metadata .insert(EXTENSION_TYPE_NAME_KEY.to_owned(), E::NAME.to_owned()); // Insert the metadata, if any - if let Some(metadata) = extension_type.into_serialized_metadata() { + if let Some(metadata) = extension_type.serialized_metadata() { self.metadata .insert(EXTENSION_TYPE_METADATA_KEY.to_owned(), metadata); }