chore: upgrade Rust toolchain to 1.97.0#7712
Conversation
Bumps the pinned toolchain from 1.94.0 to 1.97.0 in rust-toolchain.toml (python/ and java/lance-jni/ symlink to it) and fixes the clippy lints newly reported by 1.97 across the workspace: - manual_filter, manual_checked_ops, question_mark - useless_conversion, useless_borrows_in_formatting - collapsible_match, while_let_loop, explicit_counter_loop, unnecessary_sort_by All fixes are behavior-preserving. Clippy is clean with `-D warnings` across the main workspace (all features, all targets), python, and java. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe pull request pins Rust 1.97.0 and applies behavior-preserving Rust idiom updates across encoding, DataFusion, indexing, dataset, I/O, namespace, and test code. It also replaces several manual zero-division guards with checked division. ChangesRust modernization
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust/lance-index/src/scalar/bitmap.rs`:
- Line 894: Remove the intermediate Vec allocation in the
ScalarValue::iter_to_array call by passing self.keys.drain(..) directly,
preserving the existing behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0ab4db73-bb92-422c-be61-2fd0c234d00f
📒 Files selected for processing (36)
rust-toolchain.tomlrust/lance-arrow/src/lib.rsrust/lance-datafusion/src/logical_expr.rsrust/lance-datafusion/src/planner.rsrust/lance-encoding/src/decoder.rsrust/lance-encoding/src/encodings/physical/packed.rsrust/lance-encoding/src/previous/encodings/logical/blob.rsrust/lance-file/src/reader.rsrust/lance-index/src/scalar/bitmap.rsrust/lance-index/src/scalar/btree.rsrust/lance-index/src/scalar/btree/flat.rsrust/lance-index/src/scalar/fmindex.rsrust/lance-index/src/scalar/inverted.rsrust/lance-index/src/scalar/zonemap.rsrust/lance-index/src/vector/bq/storage.rsrust/lance-index/src/vector/flat/index.rsrust/lance-index/src/vector/flat/storage.rsrust/lance-io/src/object_writer.rsrust/lance-namespace-impls/src/dir.rsrust/lance-table/src/rowids.rsrust/lance/benches/s3_file_reader_diagnostics.rsrust/lance/src/dataset.rsrust/lance/src/dataset/blob.rsrust/lance/src/dataset/cleanup.rsrust/lance/src/dataset/fragment/write.rsrust/lance/src/dataset/mem_wal/write.rsrust/lance/src/dataset/optimize.rsrust/lance/src/dataset/refs.rsrust/lance/src/dataset/scanner.rsrust/lance/src/dataset/write/merge_insert.rsrust/lance/src/index/vector/ivf.rsrust/lance/src/index/vector/ivf/v2.rsrust/lance/src/io/commit.rsrust/lance/src/io/exec/count_pushdown.rsrust/lance/src/io/exec/fts.rsrust/lance/src/io/exec/projection.rs
| let keys_array = | ||
| ScalarValue::iter_to_array(self.keys.drain(..).collect::<Vec<_>>().into_iter()) | ||
| .unwrap(); | ||
| ScalarValue::iter_to_array(self.keys.drain(..).collect::<Vec<_>>()).unwrap(); |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n -C 4 'fn iter_to_array|iter_to_array\(' \
rust Cargo.toml Cargo.lock \
"${CARGO_HOME:-$HOME/.cargo}/registry/src" 2>/dev/null || trueRepository: lance-format/lance
Length of output: 9752
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the exact ScalarValue::iter_to_array definition and any nearby iterator bounds.
rg -n -C 6 'pub fn iter_to_array|fn iter_to_array|iter_to_array<|IntoIterator' \
rust "${CARGO_HOME:-$HOME/.cargo}/registry/src" 2>/dev/null | head -n 200
# Show the relevant bitmap writer block for context.
sed -n '880,905p' rust/lance-index/src/scalar/bitmap.rs
# Check whether drain(..) is already used directly with iter_to_array elsewhere in the repo.
rg -n 'iter_to_array\([^)]*drain\(' rust/lance-index rust/lance 2>/dev/null || trueRepository: lance-format/lance
Length of output: 13036
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find the exact definition/signature of ScalarValue::iter_to_array.
rg -n -C 5 'iter_to_array' \
rust "${CARGO_HOME:-$HOME/.cargo}/registry/src" \
-g '*.rs' 2>/dev/null | head -n 200
# Show the surrounding implementation in the repository where the bad allocation occurs.
sed -n '888,900p' rust/lance-index/src/scalar/bitmap.rs
# Show nearby call sites that already pass iterators directly.
sed -n '1268,1305p' rust/lance-index/src/scalar/bitmap.rsRepository: lance-format/lance
Length of output: 11594
Avoid the extra Vec allocation here.
ScalarValue::iter_to_array already accepts an IntoIterator, so self.keys.drain(..) can be passed directly instead of draining into a temporary Vec first.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rust/lance-index/src/scalar/bitmap.rs` at line 894, Remove the intermediate
Vec allocation in the ScalarValue::iter_to_array call by passing
self.keys.drain(..) directly, preserving the existing behavior.
Source: Coding guidelines
Bumps the pinned toolchain from 1.94.0 to 1.97.0 in
rust-toolchain.toml(thepython/andjava/lance-jni/copies are symlinks to it) and fixes the clippy lints newly reported by 1.97 across the workspace.New lints fixed:
manual_filter,manual_checked_ops,question_markuseless_conversion,useless_borrows_in_formattingcollapsible_match,while_let_loop,explicit_counter_loop,unnecessary_sort_byAll fixes are behavior-preserving.
cargo clippy -- -D warningsis clean across the main workspace (all features, all targets),python/, andjava/lance-jni/;cargo fmt --checkpasses on all three.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
NaNvalues in range queries for more conservative, reliable results.Maintenance