Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
msrv: ["1.82.0"] # This should match up with rust-version in Cargo.toml
msrv: ["1.88.0"] # This should match up with rust-version in Cargo.toml
env:
# Need up-to-date compilers for kernels
CC: clang
Expand All @@ -268,8 +268,9 @@ jobs:
- name: Install ${{ matrix.msrv }}
run: |
rustup toolchain install ${{ matrix.msrv }}
rustup default ${{ matrix.msrv }}
- name: cargo +${{ matrix.msrv }} check
env:
RUSTUP_TOOLCHAIN: ${{ matrix.msrv }}
Comment on lines +272 to +273
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tells it to ignore the toolchain file basically?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's higher up in the resolution chain: https://rust-lang.github.io/rustup/overrides.html

run: |
ALL_FEATURES=`cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | .features | keys | .[]' | grep -v -e protoc -e slow_tests | sort | uniq | paste -s -d "," -`
cargo check --profile ci --workspace --tests --benches --features ${ALL_FEATURES}
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ categories = [
"development-tools",
"science",
]
rust-version = "1.82.0"
rust-version = "1.88.0"

[workspace.dependencies]
libc = "0.2.176"
Expand Down
2 changes: 1 addition & 1 deletion java/lance-jni/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "lance-jni"
version = "2.1.0-beta.0"
edition = "2021"
authors = ["Lance Devs <dev@lance.org>"]
rust-version = "1.80"
rust-version = "1.88"
license = "Apache-2.0"
repository = "https://github.com/lance-format/lance"
readme = "../../README.md"
Expand Down
2 changes: 1 addition & 1 deletion java/lance-jni/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub fn get_vector_index_params(
let jarray: JFloatArray = centroids_obj.into();
let length = env.get_array_length(&jarray)?;
if length > 0 {
if (length as usize) % num_partitions != 0 {
if !(length as usize).is_multiple_of(num_partitions) {
return Err(Error::input_error(format!(
"Invalid IVF centroids: length {} is not divisible by num_partitions {}",
length, num_partitions
Expand Down
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pylance"
version = "2.1.0-beta.0"
edition = "2021"
authors = ["Lance Devs <dev@lance.org>"]
rust-version = "1.80"
rust-version = "1.88"
exclude = ["python/lance/conftest.py"]
publish = false

Expand Down
2 changes: 1 addition & 1 deletion rust/examples/src/llm_dataset_creation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl WikiTextBatchReader {
}
token_builder.append(true);
self.cur_samples_cnt += 1;
if self.cur_samples_cnt % 5000 == 0 {
if self.cur_samples_cnt.is_multiple_of(5000) {
println!("Processed {} rows", self.cur_samples_cnt);
}
if self.cur_samples_cnt >= self.num_samples {
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-encoding/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl LanceBuffer {
pub fn borrow_to_typed_slice<T: ArrowNativeType>(&self) -> ScalarBuffer<T> {
let align = std::mem::align_of::<T>();
let is_aligned = self.as_ptr().align_offset(align) == 0;
if self.len() % std::mem::size_of::<T>() != 0 {
if !self.len().is_multiple_of(std::mem::size_of::<T>()) {
panic!("attempt to borrow_to_typed_slice to data type of size {} but we have {} bytes which isn't evenly divisible", std::mem::size_of::<T>(), self.len());
}

Expand Down Expand Up @@ -184,7 +184,7 @@ impl LanceBuffer {
/// carefully reviewed.
pub fn borrow_to_typed_view<T: ArrowNativeType + bytemuck::Pod>(&self) -> Cow<'_, [T]> {
let align = std::mem::align_of::<T>();
if self.len() % std::mem::size_of::<T>() != 0 {
if !self.len().is_multiple_of(std::mem::size_of::<T>()) {
panic!("attempt to view data type of size {} but we have {} bytes which isn't evenly divisible", std::mem::size_of::<T>(), self.len());
}

Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ struct FixedWidthDataBlockBuilder {

impl FixedWidthDataBlockBuilder {
fn new(bits_per_value: u64, estimated_size_bytes: u64) -> Self {
assert!(bits_per_value % 8 == 0);
assert!(bits_per_value.is_multiple_of(8));
Self {
bits_per_value,
bytes_per_value: bits_per_value / 8,
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-encoding/src/encodings/physical/bitpacking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl InlineBitpacking {
}

// Handle the last chunk
let last_chunk_elem_num = if data.num_values % ELEMS_PER_CHUNK == 0 {
let last_chunk_elem_num = if data.num_values.is_multiple_of(ELEMS_PER_CHUNK) {
ELEMS_PER_CHUNK
} else {
data.num_values % ELEMS_PER_CHUNK
Expand Down Expand Up @@ -162,7 +162,7 @@ impl InlineBitpacking {
}

fn chunk_data(&self, data: FixedWidthDataBlock) -> (MiniBlockCompressed, CompressiveEncoding) {
assert!(data.bits_per_value % 8 == 0);
assert!(data.bits_per_value.is_multiple_of(8));
assert_eq!(data.bits_per_value, self.uncompressed_bit_width);
let bits_per_value = data.bits_per_value;
let compressed = match bits_per_value {
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/encodings/physical/rle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ impl RleMiniBlockDecompressor {
}
}

if values_buffer.len() % type_size != 0 || lengths_buffer.is_empty() {
if !values_buffer.len().is_multiple_of(type_size) || lengths_buffer.is_empty() {
return Err(Error::InvalidInput {
location: location!(),
source: format!(
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-encoding/src/encodings/physical/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl ValueEncoder {
// or FSL<boolean> we might have some number of bits per value that isn't
// divisible by 8. In this case, to avoid chunking in the middle of a byte
// we calculate how many 8-value words we can fit in a chunk.
let (bytes_per_word, values_per_word) = if data.bits_per_value % 8 == 0 {
let (bytes_per_word, values_per_word) = if data.bits_per_value.is_multiple_of(8) {
(data.bits_per_value / 8, 1)
} else {
(data.bits_per_value, 8)
Expand Down Expand Up @@ -192,7 +192,7 @@ impl ValueEncoder {
}
// It's an estimate because validity buffers may have some padding bits
let cum_bits_per_value = data.bits_per_value * cum_dim;
let (cum_bytes_per_word, vals_per_word) = if cum_bits_per_value % 8 == 0 {
let (cum_bytes_per_word, vals_per_word) = if cum_bits_per_value.is_multiple_of(8) {
(cum_bits_per_value / 8, 1)
} else {
(cum_bits_per_value, 8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ fn pack_bits(
// we also want to the next location in src, unless we wrote something
// byte-aligned in which case the logic above would have already advanced
let mut to_next_byte = 1;
if num_bits % 8 == 0 {
if num_bits.is_multiple_of(8) {
to_next_byte = 0;
}

Expand Down Expand Up @@ -853,7 +853,7 @@ impl PageScheduler for BitpackedScheduler {
.map(|range| {
let start_byte_offset = range.start * self.bits_per_value / 8;
let mut end_byte_offset = range.end * self.bits_per_value / 8;
if range.end * self.bits_per_value % 8 != 0 {
if !(range.end * self.bits_per_value).is_multiple_of(8) {
// If the end of the range is not byte-aligned, we need to read one more byte
end_byte_offset += 1;

Expand Down Expand Up @@ -1026,7 +1026,7 @@ impl PrimitivePageDecoder for BitpackedPageDecoder {
// unless we wrote something byte-aligned in which case the logic above
// would have already advanced dst_idx
let mut to_next_byte = 1;
if self.bits_per_value % 8 == 0 {
if self.bits_per_value.is_multiple_of(8) {
to_next_byte = 0;
}
let next_dst_idx =
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/scalar/bloomfilter/sbbf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub struct Sbbf {
impl Sbbf {
/// Create a new SBBF from raw bitset data
pub fn new(bitset: &[u8]) -> Result<Self> {
if bitset.len() % 32 != 0 {
if !bitset.len().is_multiple_of(32) {
return Err(SbbfError::InvalidData {
message: format!(
"Bitset length must be a multiple of 32, got {}",
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/scalar/inverted/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ impl DocSet {
max_score = f32::MIN;
}
}
if length % BLOCK_SIZE > 0 {
if !length.is_multiple_of(BLOCK_SIZE) {
max_score *= idf_scale;
block_max_scores.push(max_score);
}
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/vector/pq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl ProductQuantizer {
})?;
let num_sub_vectors = self.num_sub_vectors;
let dim = self.dimension;
if NUM_BITS == 4 && num_sub_vectors % 2 != 0 {
if NUM_BITS == 4 && !num_sub_vectors.is_multiple_of(2) {
return Err(Error::Index {
message: format!(
"PQ: num_sub_vectors must be divisible by 2 for num_bits=4, but got {}",
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/vector/pq/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where
PrimitiveArray<T>: From<Vec<T::Native>>,
{
let dim = fsl.value_length() as usize;
if dim % m != 0 {
if !dim.is_multiple_of(m) {
return Err(Error::invalid_input(
format!(
"num_sub_vectors must divide vector dimension {}, but got {}",
Expand Down
2 changes: 1 addition & 1 deletion rust/lance/src/dataset/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ pub async fn auto_cleanup_hook(
}
};

if interval != 0 && manifest.version % interval != 0 {
if interval != 0 && !manifest.version.is_multiple_of(interval) {
return Ok(None);
}
} else {
Expand Down
Loading