Skip to content

Commit

Permalink
chore: fix warnings on rust 1.83 (#3202)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyxu authored Dec 4, 2024
1 parent 6edb1b8 commit 75d526e
Show file tree
Hide file tree
Showing 32 changed files with 59 additions and 72 deletions.
2 changes: 1 addition & 1 deletion rust/lance-arrow/src/bfloat16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl BFloat16Array {
}
}

impl<'a> ArrayAccessor for &'a BFloat16Array {
impl ArrayAccessor for &BFloat16Array {
type Item = bf16;

fn value(&self, index: usize) -> Self::Item {
Expand Down
1 change: 0 additions & 1 deletion rust/lance-core/src/utils/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ pub fn log_2_ceil(val: u32) -> u32 {
}

#[cfg(test)]

pub mod tests {
use crate::utils::bit::log_2_ceil;

Expand Down
1 change: 0 additions & 1 deletion rust/lance-core/src/utils/deletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ impl Extend<u32> for DeletionVector {
/// pub fn get(i: u32) -> bool { ... }
/// }
/// impl BitAnd for DeletionVector { ... }
impl IntoIterator for DeletionVector {
type IntoIter = Box<dyn Iterator<Item = Self::Item> + Send>;
type Item = u32;
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-core/src/utils/futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'a, T: Clone> SharedStream<'a, T> {
}
}

impl<'a, T: Clone> Stream for SharedStream<'a, T> {
impl<T: Clone> Stream for SharedStream<'_, T> {
type Item = T;

fn poll_next(
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-core/src/utils/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use std::hash::Hasher;
// the equality for this `U8SliceKey` means that the &[u8] contents are equal.
#[derive(Eq)]
pub struct U8SliceKey<'a>(pub &'a [u8]);
impl<'a> PartialEq for U8SliceKey<'a> {
impl PartialEq for U8SliceKey<'_> {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}

impl<'a> std::hash::Hash for U8SliceKey<'a> {
impl std::hash::Hash for U8SliceKey<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-core/src/utils/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl Default for MockClock<'_> {
}
}

impl<'a> MockClock<'a> {
impl MockClock<'_> {
pub fn new() -> Self {
Default::default()
}
Expand All @@ -228,7 +228,7 @@ impl<'a> MockClock<'a> {
}
}

impl<'a> Drop for MockClock<'a> {
impl Drop for MockClock<'_> {
fn drop(&mut self) {
// Reset the clock to the epoch
mock_instant::MockClock::set_system_time(TimeDelta::try_days(0).unwrap().to_std().unwrap());
Expand Down
1 change: 1 addition & 0 deletions rust/lance-encoding/benches/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ fn bench_decode_packed_struct(c: &mut Criterion) {
});
}

#[allow(dead_code)]
fn bench_decode_str_with_fixed_size_binary_encoding(c: &mut Criterion) {
let rt = tokio::runtime::Runtime::new().unwrap();
let mut group = c.benchmark_group("decode_primitive");
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/encodings/logical/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct BinarySchedulingJob<'a> {
inner: Box<dyn SchedulingJob + 'a>,
}

impl<'a> SchedulingJob for BinarySchedulingJob<'a> {
impl SchedulingJob for BinarySchedulingJob<'_> {
fn schedule_next(
&mut self,
context: &mut SchedulerContext,
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/encodings/logical/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct BlobFieldSchedulingJob<'a> {
descriptions_job: Box<dyn SchedulingJob + 'a>,
}

impl<'a> SchedulingJob for BlobFieldSchedulingJob<'a> {
impl SchedulingJob for BlobFieldSchedulingJob<'_> {
fn schedule_next(
&mut self,
context: &mut SchedulerContext,
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/encodings/logical/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ impl<'a> ListFieldSchedulingJob<'a> {
}
}

impl<'a> SchedulingJob for ListFieldSchedulingJob<'a> {
impl SchedulingJob for ListFieldSchedulingJob<'_> {
fn schedule_next(
&mut self,
context: &mut SchedulerContext,
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-encoding/src/encodings/logical/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a> PrimitiveFieldSchedulingJob<'a> {
}
}

impl<'a> SchedulingJob for PrimitiveFieldSchedulingJob<'a> {
impl SchedulingJob for PrimitiveFieldSchedulingJob<'_> {
fn schedule_next(
&mut self,
context: &mut SchedulerContext,
Expand Down Expand Up @@ -1148,7 +1148,7 @@ impl<'a> StructuralPrimitiveFieldSchedulingJob<'a> {
}
}

impl<'a> StructuralSchedulingJob for StructuralPrimitiveFieldSchedulingJob<'a> {
impl StructuralSchedulingJob for StructuralPrimitiveFieldSchedulingJob<'_> {
fn schedule_next(
&mut self,
context: &mut SchedulerContext,
Expand Down
20 changes: 10 additions & 10 deletions rust/lance-encoding/src/encodings/logical/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ struct SchedulingJobWithStatus<'a> {
rows_remaining: u64,
}

impl<'a> PartialEq for SchedulingJobWithStatus<'a> {
impl PartialEq for SchedulingJobWithStatus<'_> {
fn eq(&self, other: &Self) -> bool {
self.col_idx == other.col_idx
}
}

impl<'a> Eq for SchedulingJobWithStatus<'a> {}
impl Eq for SchedulingJobWithStatus<'_> {}

impl<'a> PartialOrd for SchedulingJobWithStatus<'a> {
impl PartialOrd for SchedulingJobWithStatus<'_> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl<'a> Ord for SchedulingJobWithStatus<'a> {
impl Ord for SchedulingJobWithStatus<'_> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
// Note this is reversed to make it min-heap
other.rows_scheduled.cmp(&self.rows_scheduled)
Expand Down Expand Up @@ -106,7 +106,7 @@ impl<'a> SimpleStructSchedulerJob<'a> {
}
}

impl<'a> SchedulingJob for SimpleStructSchedulerJob<'a> {
impl SchedulingJob for SimpleStructSchedulerJob<'_> {
fn schedule_next(
&mut self,
mut context: &mut SchedulerContext,
Expand Down Expand Up @@ -239,21 +239,21 @@ struct StructuralSchedulingJobWithStatus<'a> {
rows_remaining: u64,
}

impl<'a> PartialEq for StructuralSchedulingJobWithStatus<'a> {
impl PartialEq for StructuralSchedulingJobWithStatus<'_> {
fn eq(&self, other: &Self) -> bool {
self.col_idx == other.col_idx
}
}

impl<'a> Eq for StructuralSchedulingJobWithStatus<'a> {}
impl Eq for StructuralSchedulingJobWithStatus<'_> {}

impl<'a> PartialOrd for StructuralSchedulingJobWithStatus<'a> {
impl PartialOrd for StructuralSchedulingJobWithStatus<'_> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl<'a> Ord for StructuralSchedulingJobWithStatus<'a> {
impl Ord for StructuralSchedulingJobWithStatus<'_> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
// Note this is reversed to make it min-heap
other.rows_scheduled.cmp(&self.rows_scheduled)
Expand Down Expand Up @@ -297,7 +297,7 @@ impl<'a> RepDefStructSchedulingJob<'a> {
}
}

impl<'a> StructuralSchedulingJob for RepDefStructSchedulingJob<'a> {
impl StructuralSchedulingJob for RepDefStructSchedulingJob<'_> {
fn schedule_next(
&mut self,
mut context: &mut SchedulerContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub fn compute_compressed_bit_width_for_non_neg(arrays: &[ArrayRef]) -> u64 {
// It outputs an fastlanes bitpacked EncodedArray
macro_rules! encode_fixed_width {
($self:expr, $unpacked:expr, $data_type:ty, $buffer_index:expr) => {{
let num_chunks = ($unpacked.num_values + ELEMS_PER_CHUNK - 1) / ELEMS_PER_CHUNK;
let num_chunks = $unpacked.num_values.div_ceil(ELEMS_PER_CHUNK);
let num_full_chunks = $unpacked.num_values / ELEMS_PER_CHUNK;
let uncompressed_bit_width = std::mem::size_of::<$data_type>() as u64 * 8;

Expand Down
2 changes: 1 addition & 1 deletion rust/lance-file/src/writer/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ fn get_boolean_statistics(arrays: &[&ArrayRef]) -> StatisticsRow {

fn cast_dictionary_arrays<'a, T: ArrowDictionaryKeyType + 'static>(
arrays: &'a [&'a ArrayRef],
) -> Vec<&Arc<dyn Array>> {
) -> Vec<&'a Arc<dyn Array>> {
arrays
.iter()
.map(|x| x.as_dictionary::<T>().values())
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/scalar/label_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl LabelListIndex {
fn search_values<'a>(
&'a self,
values: &'a Vec<ScalarValue>,
) -> BoxStream<Result<RowIdTreeMap>> {
) -> BoxStream<'a, Result<RowIdTreeMap>> {
futures::stream::iter(values)
.then(move |value| {
let value_query = SargableQuery::Equals(value.clone());
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-index/src/vector/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub struct Visited<'a> {
recently_visited: Vec<u32>,
}

impl<'a> Visited<'a> {
impl Visited<'_> {
pub fn insert(&mut self, node_id: u32) {
let node_id_usize = node_id as usize;
if !self.visited[node_id_usize] {
Expand All @@ -171,7 +171,7 @@ impl<'a> Visited<'a> {
}
}

impl<'a> Drop for Visited<'a> {
impl Drop for Visited<'_> {
fn drop(&mut self) {
for node_id in self.recently_visited.iter() {
self.visited.set(*node_id as usize, false);
Expand Down
6 changes: 3 additions & 3 deletions rust/lance-index/src/vector/hnsw/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl<'a> HnswLevelView<'a> {
}
}

impl<'a> Graph for HnswLevelView<'a> {
impl Graph for HnswLevelView<'_> {
fn len(&self) -> usize {
self.nodes.len()
}
Expand All @@ -528,7 +528,7 @@ impl<'a> HnswBottomView<'a> {
}
}

impl<'a> Graph for HnswBottomView<'a> {
impl Graph for HnswBottomView<'_> {
fn len(&self) -> usize {
self.nodes.len()
}
Expand All @@ -544,7 +544,7 @@ pub struct HnswQueryParams {
pub ef: usize,
}

impl<'a> From<&'a Query> for HnswQueryParams {
impl From<&Query> for HnswQueryParams {
fn from(query: &Query) -> Self {
let k = query.k * query.refine_factor.unwrap_or(1) as usize;
Self {
Expand Down
6 changes: 1 addition & 5 deletions rust/lance-index/src/vector/ivf/shuffler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,7 @@ impl IvfShuffler {
continue;
}

let local_start = if start < cur_start {
0
} else {
start - cur_start
};
let local_start = start.saturating_sub(cur_start);
let local_end = std::cmp::min(end - cur_start, *partition_size);

input.push(ShuffleInput {
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-index/src/vector/sq/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl<'a> SQDistCalculator<'a> {
}
}

impl<'a> DistCalculator for SQDistCalculator<'a> {
impl DistCalculator for SQDistCalculator<'_> {
fn distance(&self, id: u32) -> f32 {
let (offset, chunk) = self.storage.chunk(id);
let sq_code = chunk.sq_code_slice(id - offset);
Expand Down
16 changes: 8 additions & 8 deletions rust/lance-io/src/encodings/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<'a> BinaryEncoder<'a> {
}

#[async_trait]
impl<'a> Encoder for BinaryEncoder<'a> {
impl Encoder for BinaryEncoder<'_> {
async fn encode(&mut self, arrs: &[&dyn Array]) -> Result<usize> {
assert!(!arrs.is_empty());
let data_type = arrs[0].data_type();
Expand Down Expand Up @@ -286,7 +286,7 @@ fn plan_take_chunks(
}

#[async_trait]
impl<'a, T: ByteArrayType> Decoder for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> Decoder for BinaryDecoder<'_, T> {
async fn decode(&self) -> Result<ArrayRef> {
self.get(..).await
}
Expand Down Expand Up @@ -394,7 +394,7 @@ impl<'a, T: ByteArrayType> Decoder for BinaryDecoder<'a, T> {
}

#[async_trait]
impl<'a, T: ByteArrayType> AsyncIndex<usize> for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> AsyncIndex<usize> for BinaryDecoder<'_, T> {
type Output = Result<ArrayRef>;

async fn get(&self, index: usize) -> Self::Output {
Expand All @@ -403,7 +403,7 @@ impl<'a, T: ByteArrayType> AsyncIndex<usize> for BinaryDecoder<'a, T> {
}

#[async_trait]
impl<'a, T: ByteArrayType> AsyncIndex<RangeFrom<usize>> for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> AsyncIndex<RangeFrom<usize>> for BinaryDecoder<'_, T> {
type Output = Result<ArrayRef>;

async fn get(&self, index: RangeFrom<usize>) -> Self::Output {
Expand All @@ -412,7 +412,7 @@ impl<'a, T: ByteArrayType> AsyncIndex<RangeFrom<usize>> for BinaryDecoder<'a, T>
}

#[async_trait]
impl<'a, T: ByteArrayType> AsyncIndex<RangeTo<usize>> for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> AsyncIndex<RangeTo<usize>> for BinaryDecoder<'_, T> {
type Output = Result<ArrayRef>;

async fn get(&self, index: RangeTo<usize>) -> Self::Output {
Expand All @@ -421,7 +421,7 @@ impl<'a, T: ByteArrayType> AsyncIndex<RangeTo<usize>> for BinaryDecoder<'a, T> {
}

#[async_trait]
impl<'a, T: ByteArrayType> AsyncIndex<RangeFull> for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> AsyncIndex<RangeFull> for BinaryDecoder<'_, T> {
type Output = Result<ArrayRef>;

async fn get(&self, _: RangeFull) -> Self::Output {
Expand All @@ -430,7 +430,7 @@ impl<'a, T: ByteArrayType> AsyncIndex<RangeFull> for BinaryDecoder<'a, T> {
}

#[async_trait]
impl<'a, T: ByteArrayType> AsyncIndex<ReadBatchParams> for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> AsyncIndex<ReadBatchParams> for BinaryDecoder<'_, T> {
type Output = Result<ArrayRef>;

async fn get(&self, params: ReadBatchParams) -> Self::Output {
Expand All @@ -445,7 +445,7 @@ impl<'a, T: ByteArrayType> AsyncIndex<ReadBatchParams> for BinaryDecoder<'a, T>
}

#[async_trait]
impl<'a, T: ByteArrayType> AsyncIndex<Range<usize>> for BinaryDecoder<'a, T> {
impl<T: ByteArrayType> AsyncIndex<Range<usize>> for BinaryDecoder<'_, T> {
type Output = Result<ArrayRef>;

async fn get(&self, index: Range<usize>) -> Self::Output {
Expand Down
8 changes: 4 additions & 4 deletions rust/lance-io/src/encodings/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a> DictionaryEncoder<'a> {
}

#[async_trait]
impl<'a> Encoder for DictionaryEncoder<'a> {
impl Encoder for DictionaryEncoder<'_> {
async fn encode(&mut self, array: &[&dyn Array]) -> Result<usize> {
use DataType::*;

Expand Down Expand Up @@ -171,7 +171,7 @@ impl<'a> DictionaryDecoder<'a> {
}

#[async_trait]
impl<'a> Decoder for DictionaryDecoder<'a> {
impl Decoder for DictionaryDecoder<'_> {
async fn decode(&self) -> Result<ArrayRef> {
self.decode_impl(..).await
}
Expand All @@ -182,7 +182,7 @@ impl<'a> Decoder for DictionaryDecoder<'a> {
}

#[async_trait]
impl<'a> AsyncIndex<usize> for DictionaryDecoder<'a> {
impl AsyncIndex<usize> for DictionaryDecoder<'_> {
type Output = Result<ArrayRef>;

async fn get(&self, _index: usize) -> Self::Output {
Expand All @@ -196,7 +196,7 @@ impl<'a> AsyncIndex<usize> for DictionaryDecoder<'a> {
}

#[async_trait]
impl<'a> AsyncIndex<ReadBatchParams> for DictionaryDecoder<'a> {
impl AsyncIndex<ReadBatchParams> for DictionaryDecoder<'_> {
type Output = Result<ArrayRef>;

async fn get(&self, params: ReadBatchParams) -> Self::Output {
Expand Down
Loading

0 comments on commit 75d526e

Please sign in to comment.