[ 
https://issues.apache.org/jira/browse/ARROW-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16430482#comment-16430482
 ] 

ASF GitHub Bot commented on ARROW-2415:
---------------------------------------

pitrou closed pull request #1851: ARROW-2415: [Rust] Fix clippy ref-match-pats 
warnings.
URL: https://github.com/apache/arrow/pull/1851
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/rust/src/datatypes.rs b/rust/src/datatypes.rs
index 85278f7bb..005a13952 100644
--- a/rust/src/datatypes.rs
+++ b/rust/src/datatypes.rs
@@ -41,8 +41,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") {
@@ -106,21 +106,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 })
@@ -147,8 +147,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(),
                     _ => {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Rust] Fix using references in pattern matching
> -----------------------------------------------
>
>                 Key: ARROW-2415
>                 URL: https://issues.apache.org/jira/browse/ARROW-2415
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Rust
>            Reporter: Bruce Mitchener
>            Priority: Major
>              Labels: pull-request-available
>
> Clippy reports 
> [https://rust-lang-nursery.github.io/rust-clippy/v0.0.191/index.html#match_ref_pats]
>  warnings.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to