diff --git a/.cargo/config.toml b/.cargo/config.toml index 8dca69f5..c5958ed0 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -25,6 +25,7 @@ rustflags = [ "-Dclippy::dbg_macro", # not too much we can do to avoid multiple crate versions "-Aclippy::multiple-crate-versions", + "-Aclippy::wildcard_dependencies", ] [target.x86_64-unknown-linux-gnu] diff --git a/rust/ffi/node/src/convert.rs b/rust/ffi/node/src/convert.rs index 3c0ea2f0..d098fc0c 100644 --- a/rust/ffi/node/src/convert.rs +++ b/rust/ffi/node/src/convert.rs @@ -17,10 +17,7 @@ use neon::types::buffer::TypedArray; use crate::error::ResultExt; -pub fn vec_str_to_array<'a, C: Context<'a>>( - vec: &Vec, - cx: &mut C, -) -> JsResult<'a, JsArray> { +pub fn vec_str_to_array<'a, C: Context<'a>>(vec: &[String], cx: &mut C) -> JsResult<'a, JsArray> { let a = JsArray::new(cx, vec.len() as u32); for (i, s) in vec.iter().enumerate() { let v = cx.string(s); diff --git a/rust/vectordb/src/connection.rs b/rust/vectordb/src/connection.rs index 0e29415d..cb2800c5 100644 --- a/rust/vectordb/src/connection.rs +++ b/rust/vectordb/src/connection.rs @@ -422,13 +422,11 @@ mod tests { let tmp_dir = tempdir().unwrap(); let uri = std::fs::canonicalize(tmp_dir.path().to_str().unwrap()).unwrap(); - let mut relative_anacestors = vec![]; let current_dir = std::env::current_dir().unwrap(); - let mut ancestors = current_dir.ancestors(); - while let Some(_) = ancestors.next() { - relative_anacestors.push(".."); - } - let relative_root = std::path::PathBuf::from(relative_anacestors.join("/")); + let ancestors = current_dir.ancestors(); + let relative_ancestors = vec![".."; ancestors.count()]; + + let relative_root = std::path::PathBuf::from(relative_ancestors.join("/")); let relative_uri = relative_root.join(&uri); let db = Database::connect(relative_uri.to_str().unwrap()) diff --git a/rust/vectordb/src/io/object_store.rs b/rust/vectordb/src/io/object_store.rs index 66efefb4..22b7d518 100644 --- a/rust/vectordb/src/io/object_store.rs +++ b/rust/vectordb/src/io/object_store.rs @@ -357,12 +357,14 @@ mod test { let db = Database::connect(dir1.to_str().unwrap()).await.unwrap(); let mut param = WriteParams::default(); - let mut store_params = ObjectStoreParams::default(); - store_params.object_store_wrapper = Some(object_store_wrapper); + let store_params = ObjectStoreParams { + object_store_wrapper: Some(object_store_wrapper), + ..Default::default() + }; param.store_params = Some(store_params); let mut datagen = BatchGenerator::new(); - datagen = datagen.col(Box::new(IncrementingInt32::default())); + datagen = datagen.col(Box::::default()); datagen = datagen.col(Box::new(RandomVector::default().named("vector".into()))); let res = db diff --git a/rust/vectordb/src/query.rs b/rust/vectordb/src/query.rs index 85061167..53765ab5 100644 --- a/rust/vectordb/src/query.rs +++ b/rust/vectordb/src/query.rs @@ -257,7 +257,7 @@ mod tests { assert_eq!(query.query_vector.unwrap(), new_vector); assert_eq!(query.limit.unwrap(), 100); assert_eq!(query.nprobes, 1000); - assert_eq!(query.use_index, true); + assert!(query.use_index); assert_eq!(query.metric_type, Some(MetricType::Cosine)); assert_eq!(query.refine_factor, Some(999)); } diff --git a/rust/vectordb/src/table.rs b/rust/vectordb/src/table.rs index aa9cd129..7c5ac300 100644 --- a/rust/vectordb/src/table.rs +++ b/rust/vectordb/src/table.rs @@ -888,12 +888,12 @@ mod tests { let batches = make_test_batches(); let _ = batches.schema().clone(); - NativeTable::create(&uri, "test", batches, None, None) + NativeTable::create(uri, "test", batches, None, None) .await .unwrap(); let batches = make_test_batches(); - let result = NativeTable::create(&uri, "test", batches, None, None).await; + let result = NativeTable::create(uri, "test", batches, None, None).await; assert!(matches!( result.unwrap_err(), Error::TableAlreadyExists { .. } @@ -906,7 +906,7 @@ mod tests { let uri = tmp_dir.path().to_str().unwrap(); let batches = make_test_batches(); - let table = NativeTable::create(&uri, "test", batches, None, None) + let table = NativeTable::create(uri, "test", batches, None, None) .await .unwrap(); @@ -924,7 +924,7 @@ mod tests { let batches = make_test_batches(); let schema = batches.schema().clone(); - let table = NativeTable::create(&uri, "test", batches, None, None) + let table = NativeTable::create(uri, "test", batches, None, None) .await .unwrap(); assert_eq!(table.count_rows(None).await.unwrap(), 10); @@ -952,7 +952,7 @@ mod tests { // Create a dataset with i=0..10 let batches = merge_insert_test_batches(0, 0); - let table = NativeTable::create(&uri, "test", batches, None, None) + let table = NativeTable::create(uri, "test", batches, None, None) .await .unwrap(); assert_eq!(table.count_rows(None).await.unwrap(), 10); @@ -1149,12 +1149,8 @@ mod tests { Arc::new(LargeStringArray::from_iter_values(vec![ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ])), - Arc::new(Float32Array::from_iter_values( - (0..10).into_iter().map(|i| i as f32), - )), - Arc::new(Float64Array::from_iter_values( - (0..10).into_iter().map(|i| i as f64), - )), + Arc::new(Float32Array::from_iter_values((0..10).map(|i| i as f32))), + Arc::new(Float64Array::from_iter_values((0..10).map(|i| i as f64))), Arc::new(Into::::into(vec![ true, false, true, false, true, false, true, false, true, false, ])), @@ -1163,14 +1159,14 @@ mod tests { Arc::new(TimestampMillisecondArray::from_iter_values(0..10)), Arc::new( create_fixed_size_list( - Float32Array::from_iter_values((0..20).into_iter().map(|i| i as f32)), + Float32Array::from_iter_values((0..20).map(|i| i as f32)), 2, ) .unwrap(), ), Arc::new( create_fixed_size_list( - Float64Array::from_iter_values((0..20).into_iter().map(|i| i as f64)), + Float64Array::from_iter_values((0..20).map(|i| i as f64)), 2, ) .unwrap(), @@ -1307,7 +1303,7 @@ mod tests { original: Arc, ) -> Arc { self.called.store(true, Ordering::Relaxed); - return original; + original } } @@ -1324,8 +1320,10 @@ mod tests { let wrapper = Arc::new(NoOpCacheWrapper::default()); - let mut object_store_params = ObjectStoreParams::default(); - object_store_params.object_store_wrapper = Some(wrapper.clone()); + let object_store_params = ObjectStoreParams { + object_store_wrapper: Some(wrapper.clone()), + ..Default::default() + }; let param = ReadParams { store_options: Some(object_store_params), ..Default::default()