You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "findepi (via GitHub)" <gi...@apache.org> on 2024/11/26 08:57:16 UTC

[PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

findepi opened a new pull request, #6804:
URL: https://github.com/apache/arrow-rs/pull/6804

   # Which issue does this PR close?
   
   Fixes https://github.com/apache/arrow-rs/issues/6796
   
   # Rationale for this change
    
   Removing unused dependencies is expected to improve compile times.
   
   # What changes are included in this PR?
   
   - enable `unused_crate_dependencies` Rust lint for all crates
   - remove unused dependencies flagged by that lint
   
   # Are there any user-facing changes?
   
   no


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#discussion_r1877959841


##########
arrow-flight/Cargo.toml:
##########
@@ -43,11 +43,11 @@ base64 = { version = "0.22", default-features = false, features = ["std"] }
 bytes = { version = "1", default-features = false }
 futures = { version = "0.3", default-features = false, features = ["alloc"] }
 once_cell = { version = "1", optional = true }
-paste = { version = "1.0" }
+paste = { version = "1.0" , optional = true }
 prost = { version = "0.13.1", default-features = false, features = ["prost-derive"] }
 # For Timestamp type
 prost-types = { version = "0.13.1", default-features = false }
-tokio = { version = "1.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"] }
+tokio = { version = "1.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"], optional = true }

Review Comment:
   💯 



##########
.github/workflows/arrow.yml:
##########
@@ -164,36 +164,138 @@ jobs:
       - name: Setup Clippy
         run: rustup component add clippy
       - name: Clippy arrow-buffer with all features
-        run: cargo clippy -p arrow-buffer --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-buffer
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
       - name: Clippy arrow-data with all features
-        run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-schema with all features
-        run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-array with all features
-        run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-data
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-schema

Review Comment:
   Nit- the names are slightly inconsistent:
   
   ```suggestion
         - name: Clippy arrow-schema with all features
   ```



##########
.github/workflows/arrow.yml:
##########
@@ -164,36 +164,138 @@ jobs:
       - name: Setup Clippy
         run: rustup component add clippy
       - name: Clippy arrow-buffer with all features
-        run: cargo clippy -p arrow-buffer --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-buffer
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
       - name: Clippy arrow-data with all features
-        run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-schema with all features
-        run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-array with all features
-        run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-data
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-schema
+        run: |
+          mod=arrow-schema
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-array

Review Comment:
   ```suggestion
         - name: Clippy arrow-array with all features
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2500060122

   The PR is expected to fail because (1) i didn't remove all the dependencies flagged by the lint and (2) there are false-positives. 
   However, it failed in an unexpected way https://github.com/apache/arrow-rs/actions/runs/12027104363/job/33527467696?pr=6804
   
   ```
   Run cargo clippy -- -D warnings
     cargo clippy -- -D warnings
     shell: sh -e {0}
     env:
       RUSTFLAGS: -C debuginfo=1
       RUST_BACKTRACE: 1
   error: failed to parse manifest at `/__w/arrow-rs/arrow-rs/object_store/Cargo.toml`
   
   Caused by:
     error inheriting `lints` from workspace root manifest's `workspace.lints`
   
   Caused by:
     failed to find a workspace root
   ```
   
   Any idea why `failed to find a workspace root`? i am not getting this error when i run
   ```
   cargo clean
   RUSTFLAGS="-C debuginfo=1" RUST_BACKTRACE=1 cargo +stable clippy -- -D warnings
   ```
   
   locally
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2508167772

   Marking this as a draft as there appear to still be unresolved issues


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2531311737

   cc @alamb 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2500326332

   Thanks, that explains why it fails on CI.
   I missed the `working-directory: object_store` when replying CI steps locally.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2531372403

   I'll plan to merge this tomorrow unless there are any other comments. 
   
   I hope to make the RC around Thursday


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint, remove unused dependencies [arrow-rs]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on code in PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#discussion_r1879720855


##########
.github/workflows/arrow.yml:
##########
@@ -164,36 +164,138 @@ jobs:
       - name: Setup Clippy
         run: rustup component add clippy
       - name: Clippy arrow-buffer with all features
-        run: cargo clippy -p arrow-buffer --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-buffer
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
       - name: Clippy arrow-data with all features
-        run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-schema with all features
-        run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-array with all features
-        run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-data
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-schema

Review Comment:
   done



##########
.github/workflows/arrow.yml:
##########
@@ -164,36 +164,138 @@ jobs:
       - name: Setup Clippy
         run: rustup component add clippy
       - name: Clippy arrow-buffer with all features
-        run: cargo clippy -p arrow-buffer --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-buffer
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
       - name: Clippy arrow-data with all features
-        run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-schema with all features
-        run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-array with all features
-        run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-data
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-schema
+        run: |
+          mod=arrow-schema
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-array

Review Comment:
   see https://github.com/apache/arrow-rs/pull/6804#discussion_r1879718116



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2500147179

   > Any idea why failed to find a workspace root? i am not getting this error when i run
   
   object_store is not a member of the crate workspace as it is released separately


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint [arrow-rs]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2511150149

   I changed the approach. Instead of enabling lint in the cargo.toml, i switched to enaling it on specific cargo invocations as part of CI. Why? Because it feels cargo lacks necessary information to make this check work well in all cases. It apparently does not distinguishes dependencies when compiling tests and examples, or tests with different feature flags. I couldn't find a way to make it work, without adding a lot of suppressions (`#allow` or fake imports). Moreover, being very strict about dev/test dependencies isn't probably useful, as it doesn't benefit Arrow's users in any way.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint, remove unused dependencies [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#issuecomment-2536366084

   Thanks again @findepi 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint, remove unused dependencies [arrow-rs]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on code in PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804#discussion_r1879718116


##########
.github/workflows/arrow.yml:
##########
@@ -164,36 +164,138 @@ jobs:
       - name: Setup Clippy
         run: rustup component add clippy
       - name: Clippy arrow-buffer with all features
-        run: cargo clippy -p arrow-buffer --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-buffer
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
       - name: Clippy arrow-data with all features
-        run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-schema with all features
-        run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings
-      - name: Clippy arrow-array with all features
-        run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings
+        run: |
+          mod=arrow-data
+          cargo clippy -p "$mod" --all-targets --all-features -- -D warnings
+          # Dependency checks excluding tests & benches.
+          cargo clippy -p "$mod" -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies
+          cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies
+      - name: Clippy arrow-schema

Review Comment:
   I'd go opposite direction, ie remove "with all features" as now this tests various combinations: "all features", "default features", "no features"



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable unused_crate_dependencies Rust lint, remove unused dependencies [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6804:
URL: https://github.com/apache/arrow-rs/pull/6804


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org