You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "james-willis (via GitHub)" <gi...@apache.org> on 2026/04/22 22:32:48 UTC

[I] clippy --all-features fails on main: vec_init_then_push in python/sedonadb/src/lib.rs [sedona-db]

james-willis opened a new issue, #779:
URL: https://github.com/apache/sedona-db/issues/779

   ## Summary
   
   `cargo clippy --workspace --all-targets --all-features -- -Dwarnings` fails
   on `main` with:
   
       error: calls to `push` immediately after creation
         --> python/sedonadb/src/lib.rs:59:5
   
   The offending block:
   
   ```rust
   let mut features = vec![];
   
   #[cfg(feature = "s2geography")]
   features.push("s2geography".to_string());
   
   #[cfg(feature = "gpu")]
   features.push("gpu".to_string());
   ```
   
   ## Why
   
   Rust 1.95's `clippy::vec_init_then_push` was tightened and now fires on this
   construction regardless of which features are active — with both features
   on, both features off, or any combination, the code still matches the
   vec-init-then-push pattern clippy wants you to rewrite as a single
   initializer expression.
   
   ## Provenance
   
   Introduced in `a991238a` ("feat(python/sedonadb): Enable GPU feature in
   python package and add spatial join tests", #768).
   
   ## Reproduction
   
       cargo clippy --workspace --all-targets --all-features -- -Dwarnings
   
   ## Observed on
   
   https://github.com/apache/sedona-db/actions/runs/24683986166/job/72188509313
   
   ## Suggested fix
   
   Either rewrite as a single initializer:
   
   ```rust
   let features: Vec<String> = [
       #[cfg(feature = "s2geography")]
       "s2geography".to_string(),
       #[cfg(feature = "gpu")]
       "gpu".to_string(),
   ]
   .into_iter()
   .collect();
   ```
   
   …or add `#[allow(clippy::vec_init_then_push)]` on the `let` line.


-- 
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: issues-unsubscribe@sedona.apache.org.apache.org

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


Re: [I] clippy --all-features fails on main: vec_init_then_push in python/sedonadb/src/lib.rs [sedona-db]

Posted by "james-willis (via GitHub)" <gi...@apache.org>.
james-willis closed issue #779: clippy --all-features fails on main: vec_init_then_push in python/sedonadb/src/lib.rs
URL: https://github.com/apache/sedona-db/issues/779


-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [I] clippy --all-features fails on main: vec_init_then_push in python/sedonadb/src/lib.rs [sedona-db]

Posted by "james-willis (via GitHub)" <gi...@apache.org>.
james-willis commented on issue #779:
URL: https://github.com/apache/sedona-db/issues/779#issuecomment-4300437898

   Already fixed on main in bcb47d8a (part of #708). The function was refactored to use `Ok(vec![...])` with `#[cfg]` attributes on individual elements — cleaner than adding `#[allow(clippy::vec_init_then_push)]`. Closing as resolved.


-- 
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: issues-unsubscribe@sedona.apache.org

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