gaoxinge commented on code in PR #5102:
URL: https://github.com/apache/arrow-datafusion/pull/5102#discussion_r1090136767


##########
datafusion/core/src/physical_plan/metrics/mod.rs:
##########
@@ -161,8 +161,8 @@ impl Metric {
     }
 
     /// return a reference to the partition
-    pub fn partition(&self) -> &Option<usize> {
-        &self.partition
+    pub fn partition(&self) -> Option<&usize> {
+        self.partition.as_ref()
     }

Review Comment:
   I remove the `.clone()` to pass the ci, because it will cause [the clippy 
error](https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy):
   
   ```
   error: using `clone` on type `std::option::Option<usize>` which implements 
the `Copy` trait
      --> datafusion/core/src/physical_plan/metrics/mod.rs:165:9
       |
   165 |         self.partition.clone()
       |         ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: 
`self.partition`
       |
       = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
       = note: `-D clippy::clone-on-copy` implied by `-D warnings`
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to