You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/08/08 16:57:14 UTC

[arrow-rs] branch master updated: Fix object_store lint (#2367)

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

tustvold 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 beaef5ca0 Fix object_store lint (#2367)
beaef5ca0 is described below

commit beaef5ca0bddba40680bc367c715ccff7f21c0ae
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Mon Aug 8 17:57:09 2022 +0100

    Fix object_store lint (#2367)
---
 .github/workflows/object_store.yml | 2 +-
 object_store/src/util.rs           | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/object_store.yml b/.github/workflows/object_store.yml
index bf07a2efa..1f5a06a9f 100644
--- a/.github/workflows/object_store.yml
+++ b/.github/workflows/object_store.yml
@@ -44,7 +44,7 @@ jobs:
           rustup component add clippy
       - name: Run clippy
         run: |
-          cargo clippy -p object_store --all-features
+          cargo clippy -p object_store --all-features -- -D warnings
 
   # test the crate
   linux-test:
diff --git a/object_store/src/util.rs b/object_store/src/util.rs
index 1ef499595..46e9e9ed8 100644
--- a/object_store/src/util.rs
+++ b/object_store/src/util.rs
@@ -84,8 +84,8 @@ pub async fn coalesce_ranges<F, Fut>(
     coalesce: usize,
 ) -> Result<Vec<Bytes>>
 where
-    F: FnMut(std::ops::Range<usize>) -> Fut,
-    Fut: std::future::Future<Output = Result<Bytes>>,
+    F: Send + FnMut(std::ops::Range<usize>) -> Fut,
+    Fut: std::future::Future<Output = Result<Bytes>> + Send,
 {
     let mut ret = Vec::with_capacity(ranges.len());
     let mut start_idx = 0;
@@ -105,8 +105,7 @@ where
         let start = ranges[start_idx].start;
         let end = ranges[end_idx - 1].end;
         let bytes = fetch(start..end).await?;
-        for i in start_idx..end_idx {
-            let range = ranges[i].clone();
+        for range in ranges.iter().take(end_idx).skip(start_idx) {
             ret.push(bytes.slice(range.start - start..range.end - start))
         }
         start_idx = end_idx;