You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2018/04/09 12:51:34 UTC

[arrow] branch master updated: ARROW-2415: [Rust] Fix clippy ref-match-pats warnings.

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new ca3dbbb  ARROW-2415: [Rust] Fix clippy ref-match-pats warnings.
ca3dbbb is described below

commit ca3dbbb8e909381bfe4f5c66588bf2b85f3af67a
Author: Bruce Mitchener <br...@gmail.com>
AuthorDate: Mon Apr 9 14:51:10 2018 +0200

    ARROW-2415: [Rust] Fix clippy ref-match-pats warnings.
    
    It isn't necessary to use a reference in each pattern in a pattern
    match and it is more readable to just dereference the match value.
    
    Author: Bruce Mitchener <br...@gmail.com>
    
    Closes #1851 from waywardmonkeys/arrow-2415-fix-ref-match-pats and squashes the following commits:
    
    c9ea09d <Bruce Mitchener> Fix clippy ref-match-pats warnings.
---
 rust/src/datatypes.rs | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/rust/src/datatypes.rs b/rust/src/datatypes.rs
index a55ae0f..7b4e3e8 100644
--- a/rust/src/datatypes.rs
+++ b/rust/src/datatypes.rs
@@ -40,8 +40,8 @@ pub enum DataType {
 impl DataType {
     fn from(json: &Value) -> Result<DataType, ArrowError> {
         //println!("DataType::from({:?})", json);
-        match json {
-            &Value::Object(ref map) => match map.get("name") {
+        match *json {
+            Value::Object(ref map) => match map.get("name") {
                 Some(s) if s == "bool" => Ok(DataType::Boolean),
                 Some(s) if s == "utf8" => Ok(DataType::Utf8),
                 Some(s) if s == "floatingpoint" => match map.get("precision") {
@@ -107,21 +107,21 @@ impl DataType {
     }
 
     pub fn to_json(&self) -> Value {
-        match self {
-            &DataType::Boolean => json!({"name": "bool"}),
-            &DataType::Int8 => json!({"name": "int", "bitWidth": 8, "isSigned": true}),
-            &DataType::Int16 => json!({"name": "int", "bitWidth": 16, "isSigned": true}),
-            &DataType::Int32 => json!({"name": "int", "bitWidth": 32, "isSigned": true}),
-            &DataType::Int64 => json!({"name": "int", "bitWidth": 64, "isSigned": true}),
-            &DataType::UInt8 => json!({"name": "int", "bitWidth": 8, "isSigned": false}),
-            &DataType::UInt16 => json!({"name": "int", "bitWidth": 16, "isSigned": false}),
-            &DataType::UInt32 => json!({"name": "int", "bitWidth": 32, "isSigned": false}),
-            &DataType::UInt64 => json!({"name": "int", "bitWidth": 64, "isSigned": false}),
-            &DataType::Float16 => json!({"name": "floatingpoint", "precision": "HALF"}),
-            &DataType::Float32 => json!({"name": "floatingpoint", "precision": "SINGLE"}),
-            &DataType::Float64 => json!({"name": "floatingpoint", "precision": "DOUBLE"}),
-            &DataType::Utf8 => json!({"name": "utf8"}),
-            &DataType::Struct(ref fields) => {
+        match *self {
+            DataType::Boolean => json!({"name": "bool"}),
+            DataType::Int8 => json!({"name": "int", "bitWidth": 8, "isSigned": true}),
+            DataType::Int16 => json!({"name": "int", "bitWidth": 16, "isSigned": true}),
+            DataType::Int32 => json!({"name": "int", "bitWidth": 32, "isSigned": true}),
+            DataType::Int64 => json!({"name": "int", "bitWidth": 64, "isSigned": true}),
+            DataType::UInt8 => json!({"name": "int", "bitWidth": 8, "isSigned": false}),
+            DataType::UInt16 => json!({"name": "int", "bitWidth": 16, "isSigned": false}),
+            DataType::UInt32 => json!({"name": "int", "bitWidth": 32, "isSigned": false}),
+            DataType::UInt64 => json!({"name": "int", "bitWidth": 64, "isSigned": false}),
+            DataType::Float16 => json!({"name": "floatingpoint", "precision": "HALF"}),
+            DataType::Float32 => json!({"name": "floatingpoint", "precision": "SINGLE"}),
+            DataType::Float64 => json!({"name": "floatingpoint", "precision": "DOUBLE"}),
+            DataType::Utf8 => json!({"name": "utf8"}),
+            DataType::Struct(ref fields) => {
                 let field_json_array =
                     Value::Array(fields.iter().map(|f| f.to_json()).collect::<Vec<Value>>());
                 json!({ "fields": field_json_array })
@@ -148,8 +148,8 @@ impl Field {
 
     pub fn from(json: &Value) -> Result<Self, ArrowError> {
         //println!("Field::from({:?}", json);
-        match json {
-            &Value::Object(ref map) => {
+        match *json {
+            Value::Object(ref map) => {
                 let name = match map.get("name") {
                     Some(&Value::String(ref name)) => name.to_string(),
                     _ => {

-- 
To stop receiving notification emails like this one, please contact
apitrou@apache.org.