Skip to content

Commit

Permalink
Address clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
westonpace committed Sep 19, 2024
1 parent 631e310 commit 866182d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions rust/lance-core/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ impl FileMetadataCache {
}

pub fn get<T: Send + Sync + 'static>(&self, path: &Path) -> Option<Arc<T>> {
let Some(cache) = self.cache.as_ref() else {
return None;
};
let cache = self.cache.as_ref()?;
let temp: Path;
let path = if let Some(base_path) = &self.base_path {
temp = base_path.child_path(path);
Expand Down
12 changes: 5 additions & 7 deletions rust/lance-encoding/src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,7 @@ impl DecoderMiddlewareChain {

/// Obtain a cursor into the chain that can be used to create
/// field schedulers
pub(crate) fn cursor<'a>(
&'a self,
io: Arc<dyn EncodingsIo>,
) -> DecoderMiddlewareChainCursor<'a> {
pub(crate) fn cursor(&self, io: Arc<dyn EncodingsIo>) -> DecoderMiddlewareChainCursor<'_> {
DecoderMiddlewareChainCursor {
chain: self,
io,
Expand Down Expand Up @@ -881,6 +878,7 @@ fn root_column(num_rows: u64) -> ColumnInfo {
impl DecodeBatchScheduler {
/// Creates a new decode scheduler with the expected schema and the column
/// metadata of the file.
#[allow(clippy::too_many_arguments)]
pub async fn try_new<'a>(
schema: &'a Schema,
column_indices: &[u32],
Expand All @@ -898,7 +896,7 @@ impl DecodeBatchScheduler {
let root_fields = arrow_schema.fields().clone();
let mut columns = Vec::with_capacity(column_infos.len() + 1);
columns.push(Arc::new(root_column(num_rows)));
columns.extend(column_infos.iter().map(|col| col.clone()));
columns.extend(column_infos.iter().cloned());
let adjusted_column_indices = [0_u32]
.into_iter()
.chain(column_indices.iter().map(|i| *i + 1))
Expand Down Expand Up @@ -1305,8 +1303,8 @@ pub enum RequestedRows {
impl RequestedRows {
pub fn num_rows(&self) -> u64 {
match self {
RequestedRows::Ranges(ranges) => ranges.iter().map(|r| r.end - r.start).sum(),
RequestedRows::Indices(indices) => indices.len() as u64,
Self::Ranges(ranges) => ranges.iter().map(|r| r.end - r.start).sum(),
Self::Indices(indices) => indices.len() as u64,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions rust/lance-encoding/src/encodings/logical/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ fn decode_offsets(
///
/// This task does not wait for the items data. That happens on the main decode loop (unless
/// we have list of list of ... in which case it happens in the outer indirect decode loop)
#[allow(clippy::too_many_arguments)]
async fn indirect_schedule_task(
mut offsets_decoder: Box<dyn LogicalPageDecoder>,
list_requests: Vec<ListRequest>,
Expand Down
1 change: 1 addition & 0 deletions rust/lance-file/src/v2/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ impl FileReader {
)
}

#[allow(clippy::too_many_arguments)]
fn do_take_rows(
column_infos: Vec<Arc<ColumnInfo>>,
io: Arc<dyn EncodingsIo>,
Expand Down
2 changes: 1 addition & 1 deletion rust/lance/src/index/vector/ivf/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl<S: IvfSubIndex + 'static, Q: Quantization> IVFIndex<S, Q> {
let file_metadata_cache = session
.upgrade()
.map(|sess| sess.file_metadata_cache.clone())
.unwrap_or_else(|| FileMetadataCache::no_cache());
.unwrap_or_else(FileMetadataCache::no_cache);
let index_reader = FileReader::try_open(
scheduler
.open_file(&index_dir.child(uuid.as_str()).child(INDEX_FILE_NAME))
Expand Down

0 comments on commit 866182d

Please sign in to comment.