You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by vi...@apache.org on 2022/11/25 19:54:06 UTC
[arrow-rs] branch master updated: Use self capture in DataType (#3190)
This is an automated email from the ASF dual-hosted git repository.
viirya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new ddaab1dba Use self capture in DataType (#3190)
ddaab1dba is described below
commit ddaab1dbab2bf776348dd974a21965e6753bf4c2
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Fri Nov 25 19:54:01 2022 +0000
Use self capture in DataType (#3190)
---
arrow-schema/src/datatype.rs | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/arrow-schema/src/datatype.rs b/arrow-schema/src/datatype.rs
index 6e0f626ef..f1d13aefd 100644
--- a/arrow-schema/src/datatype.rs
+++ b/arrow-schema/src/datatype.rs
@@ -264,16 +264,16 @@ impl fmt::Display for DataType {
impl DataType {
/// Returns true if the type is primitive: (numeric, temporal).
#[inline]
- pub fn is_primitive(t: &DataType) -> bool {
- Self::is_numeric(t) || Self::is_temporal(t)
+ pub fn is_primitive(&self) -> bool {
+ self.is_numeric() || self.is_temporal()
}
/// Returns true if this type is numeric: (UInt*, Int*, Float*, Decimal*).
#[inline]
- pub fn is_numeric(t: &DataType) -> bool {
+ pub fn is_numeric(&self) -> bool {
use DataType::*;
matches!(
- t,
+ self,
UInt8
| UInt16
| UInt32
@@ -292,10 +292,10 @@ impl DataType {
/// Returns true if this type is temporal: (Date*, Time*, Duration, or Interval).
#[inline]
- pub fn is_temporal(t: &DataType) -> bool {
+ pub fn is_temporal(&self) -> bool {
use DataType::*;
matches!(
- t,
+ self,
Date32
| Date64
| Timestamp(_, _)
@@ -308,19 +308,19 @@ impl DataType {
/// Returns true if this type is valid as a dictionary key
#[inline]
- pub fn is_dictionary_key_type(t: &DataType) -> bool {
+ pub fn is_dictionary_key_type(&self) -> bool {
use DataType::*;
matches!(
- t,
+ self,
UInt8 | UInt16 | UInt32 | UInt64 | Int8 | Int16 | Int32 | Int64
)
}
/// Returns true if this type is nested (List, FixedSizeList, LargeList, Struct, Union,
/// or Map), or a dictionary of a nested type
- pub fn is_nested(t: &DataType) -> bool {
+ pub fn is_nested(&self) -> bool {
use DataType::*;
- match t {
+ match self {
Dictionary(_, v) => DataType::is_nested(v.as_ref()),
List(_)
| FixedSizeList(_, _)