diff --git a/docs/docs/ops/storages.md b/docs/docs/ops/storages.md index 320a76f52..7623c07b1 100644 --- a/docs/docs/ops/storages.md +++ b/docs/docs/ops/storages.md @@ -36,7 +36,7 @@ doc_embeddings.export( "doc_embeddings", cocoindex.storages.Qdrant( collection_name="cocoindex", - grpc_url="http://xyz-example.cloud-region.cloud-provider.cloud.qdrant.io:6334/", + grpc_url="https://xyz-example.cloud-region.cloud-provider.cloud.qdrant.io:6334/", api_key="", ), primary_key_fields=["id_field"], diff --git a/src/execution/live_updater.rs b/src/execution/live_updater.rs index fe3e30fb3..3d825db1b 100644 --- a/src/execution/live_updater.rs +++ b/src/execution/live_updater.rs @@ -202,7 +202,7 @@ impl FlowLiveUpdater { ) .map(|(import_op, stats)| stats::SourceUpdateInfo { source_name: import_op.name.clone(), - stats: (&**stats).clone(), + stats: (**stats).clone(), }) .collect(), } diff --git a/src/execution/memoization.rs b/src/execution/memoization.rs index 923722d17..9d2444ce8 100644 --- a/src/execution/memoization.rs +++ b/src/execution/memoization.rs @@ -112,7 +112,7 @@ impl EvaluationMemory { }), uuids: Mutex::new( (!options.evaluation_only) - .then(|| stored_uuids) + .then_some(stored_uuids) .flatten() .into_iter() .flat_map(|iter| iter.into_iter()) diff --git a/src/execution/row_indexer.rs b/src/execution/row_indexer.rs index d3827cade..96ced938b 100644 --- a/src/execution/row_indexer.rs +++ b/src/execution/row_indexer.rs @@ -502,7 +502,7 @@ pub async fn update_source_row( if existing_version.should_skip(source_version, Some(update_stats)) { return Ok(SkippedOr::Skipped(existing_version)); } - info.memoization_info.map(|info| info.0).flatten() + info.memoization_info.and_then(|info| info.0) } None => Default::default(), }; diff --git a/src/execution/source_indexer.rs b/src/execution/source_indexer.rs index 6c4846dd0..23d29c1dc 100644 --- a/src/execution/source_indexer.rs +++ b/src/execution/source_indexer.rs @@ -177,7 +177,7 @@ impl SourceIndexingContext { row_state.touched_generation = scan_generation; if row_state .source_version - .should_skip(&source_version, Some(&update_stats)) + .should_skip(&source_version, Some(update_stats)) { return None; } diff --git a/src/ops/interface.rs b/src/ops/interface.rs index 9bc791c7a..e9ffc17f2 100644 --- a/src/ops/interface.rs +++ b/src/ops/interface.rs @@ -18,9 +18,9 @@ pub struct FlowInstanceContext { #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct Ordinal(pub i64); -impl Into for Ordinal { - fn into(self) -> i64 { - self.0 +impl From for i64 { + fn from(val: Ordinal) -> Self { + val.0 } } @@ -68,10 +68,10 @@ pub struct SourceExecutorListOptions { #[async_trait] pub trait SourceExecutor: Send + Sync { /// Get the list of keys for the source. - fn list<'a>( - &'a self, + fn list( + &self, options: SourceExecutorListOptions, - ) -> BoxStream<'a, Result>>; + ) -> BoxStream<'_, Result>>; // Get the value for the given key. async fn get_value(&self, key: &KeyValue) -> Result>; diff --git a/src/ops/sdk.rs b/src/ops/sdk.rs index bf814acfb..f135cd7ac 100644 --- a/src/ops/sdk.rs +++ b/src/ops/sdk.rs @@ -76,7 +76,7 @@ impl<'a> StructSchemaBuilder<'a> { } } - pub fn set_description(&mut self, description: impl Into>) { + pub fn _set_description(&mut self, description: impl Into>) { self.target.description = Some(description.into()); } @@ -88,12 +88,12 @@ impl<'a> StructSchemaBuilder<'a> { SchemaBuilderFieldRef(AnalyzedLocalFieldReference { fields_idx }) } - pub fn add_struct_field<'b>( - &'b mut self, + pub fn _add_struct_field( + &mut self, name: impl Into, nullable: bool, attrs: Arc>, - ) -> (StructSchemaBuilder<'b>, SchemaBuilderFieldRef) { + ) -> (StructSchemaBuilder<'_>, SchemaBuilderFieldRef) { let field_schema = FieldSchema::new( name.into(), EnrichedValueType { diff --git a/src/ops/sources/google_drive.rs b/src/ops/sources/google_drive.rs index ff49900ab..da41f5d99 100644 --- a/src/ops/sources/google_drive.rs +++ b/src/ops/sources/google_drive.rs @@ -145,7 +145,7 @@ impl Executor { None } else if is_supported_file_type(&mime_type) { Some(SourceRowMetadata { - key: KeyValue::Str(Arc::from(id)), + key: KeyValue::Str(id), ordinal: file.modified_time.map(|t| t.try_into()).transpose()?, }) } else { @@ -294,10 +294,10 @@ impl ResultExt for google_drive3::Result { #[async_trait] impl SourceExecutor for Executor { - fn list<'a>( - &'a self, + fn list( + &self, options: SourceExecutorListOptions, - ) -> BoxStream<'a, Result>> { + ) -> BoxStream<'_, Result>> { let mut seen_ids = HashSet::new(); let mut folder_ids = self.root_folder_ids.clone(); let fields = format!( diff --git a/src/ops/sources/local_file.rs b/src/ops/sources/local_file.rs index 097c8e97f..224455b85 100644 --- a/src/ops/sources/local_file.rs +++ b/src/ops/sources/local_file.rs @@ -40,10 +40,10 @@ impl Executor { #[async_trait] impl SourceExecutor for Executor { - fn list<'a>( - &'a self, + fn list( + &self, options: SourceExecutorListOptions, - ) -> BoxStream<'a, Result>> { + ) -> BoxStream<'_, Result>> { let root_component_size = self.root_path.components().count(); let mut dirs = Vec::new(); dirs.push(Cow::Borrowed(&self.root_path)); diff --git a/src/ops/storages/neo4j.rs b/src/ops/storages/neo4j.rs index 04d617bb0..17b8bdd14 100644 --- a/src/ops/storages/neo4j.rs +++ b/src/ops/storages/neo4j.rs @@ -149,7 +149,7 @@ struct RelationshipStorageExecutor { fn json_value_to_bolt_value(value: &serde_json::Value) -> Result { let bolt_value = match value { - serde_json::Value::Null => BoltType::Null(neo4rs::BoltNull::default()), + serde_json::Value::Null => BoltType::Null(neo4rs::BoltNull), serde_json::Value::Bool(v) => BoltType::Boolean(neo4rs::BoltBoolean::new(*v)), serde_json::Value::Number(v) => { if let Some(i) = v.as_i64() { @@ -163,7 +163,7 @@ fn json_value_to_bolt_value(value: &serde_json::Value) -> Result { serde_json::Value::String(v) => BoltType::String(neo4rs::BoltString::new(v)), serde_json::Value::Array(v) => BoltType::List(neo4rs::BoltList { value: v - .into_iter() + .iter() .map(json_value_to_bolt_value) .collect::>()?, }), @@ -220,7 +220,7 @@ fn basic_value_to_bolt(value: &BasicValue, schema: &BasicValueType) -> Result { BoltType::Bytes(neo4rs::BoltBytes::new(bytes::Bytes::from_owner(v.clone()))) } - BasicValue::Str(v) => BoltType::String(neo4rs::BoltString::new(&v)), + BasicValue::Str(v) => BoltType::String(neo4rs::BoltString::new(v)), BasicValue::Bool(v) => BoltType::Boolean(neo4rs::BoltBoolean::new(*v)), BasicValue::Int64(v) => BoltType::Integer(neo4rs::BoltInteger::new(*v)), BasicValue::Float64(v) => BoltType::Float(neo4rs::BoltFloat::new(*v)), @@ -242,7 +242,7 @@ fn basic_value_to_bolt(value: &BasicValue, schema: &BasicValueType) -> Result match schema { BasicValueType::Vector(t) => BoltType::List(neo4rs::BoltList { value: v - .into_iter() + .iter() .map(|v| basic_value_to_bolt(v, &t.element_type)) .collect::>()?, }), @@ -255,9 +255,9 @@ fn basic_value_to_bolt(value: &BasicValue, schema: &BasicValueType) -> Result Result { let bolt_value = match value { - Value::Null => BoltType::Null(neo4rs::BoltNull::default()), + Value::Null => BoltType::Null(neo4rs::BoltNull), Value::Basic(v) => match schema { - ValueType::Basic(t) => basic_value_to_bolt(v, &t)?, + ValueType::Basic(t) => basic_value_to_bolt(v, t)?, _ => anyhow::bail!("Non-basic type got basic value: {}", schema), }, Value::Struct(v) => match schema { @@ -267,7 +267,7 @@ fn value_to_bolt(value: &Value, schema: &schema::ValueType) -> Result Value::Collection(v) | Value::List(v) => match schema { ValueType::Collection(t) => BoltType::List(neo4rs::BoltList { value: v - .into_iter() + .iter() .map(|v| field_values_to_bolt(v.0.fields.iter(), t.row.fields.iter())) .collect::>()?, }), @@ -276,7 +276,7 @@ fn value_to_bolt(value: &Value, schema: &schema::ValueType) -> Result Value::Table(v) => match schema { ValueType::Collection(t) => BoltType::List(neo4rs::BoltList { value: v - .into_iter() + .iter() .map(|(k, v)| { field_values_to_bolt( std::iter::once(&Into::::into(k.clone())) @@ -632,7 +632,7 @@ impl RelationshipSetupState { spec: &RelationshipSpec, key_field_names: Vec, index_options: &IndexOptions, - rel_value_fields_info: &Vec, + rel_value_fields_info: &[AnalyzedGraphFieldMapping], src_label_info: &AnalyzedNodeLabelInfo, tgt_label_info: &AnalyzedNodeLabelInfo, ) -> Result { @@ -681,8 +681,7 @@ impl RelationshipSetupState { } else if existing.nodes.iter().any(|(label, existing_node)| { !self .nodes - .get(label) - .map_or(false, |node| node.is_compatible(existing_node)) + .get(label).is_some_and(|node| node.is_compatible(existing_node)) }) { // If any node's key field change of some node label gone, we have to clear relationship. SetupStateCompatibility::NotCompatible @@ -747,7 +746,7 @@ impl SetupStatusCheck { .current .as_ref() .filter(|existing_current| { - desired_state.as_ref().map_or(true, |desired| { + desired_state.as_ref().is_none_or(|desired| { desired.check_compatible(existing_current) == SetupStateCompatibility::NotCompatible }) @@ -793,7 +792,7 @@ impl SetupStatusCheck { for (index_name, vector_index) in desired_state.vector_indexes.into_iter() { old_rel_indexes.shift_remove(&index_name); - if !existing.current.as_ref().map_or(false, |c| { + if !existing.current.as_ref().is_some_and(|c| { Some(&vector_index) == c.vector_indexes.get(&index_name) }) { rel_index_to_create.insert(index_name, vector_index); @@ -807,8 +806,7 @@ impl SetupStatusCheck { .as_ref() .map(|c| { c.nodes - .get(&label) - .map_or(false, |existing_node| node.is_compatible(existing_node)) + .get(&label).is_some_and(|existing_node| node.is_compatible(existing_node)) }) .unwrap_or(false) { @@ -820,8 +818,8 @@ impl SetupStatusCheck { for (index_name, vector_index) in node.vector_indexes.into_iter() { old_node_indexes.shift_remove(&index_name); - if !existing.current.as_ref().map_or(false, |c| { - c.nodes.get(&label).map_or(false, |n| { + if !existing.current.as_ref().is_some_and(|c| { + c.nodes.get(&label).is_some_and(|n| { Some(&vector_index) == n.vector_indexes.get(&index_name) }) }) { @@ -1189,8 +1187,8 @@ impl StorageFactoryBase for RelationshipFactory { let mut tgt_label_analyzer = NodeLabelAnalyzer::new(&spec, &spec.target)?; let mut rel_value_fields_info = vec![]; for (field_idx, field_schema) in value_fields_schema.iter().enumerate() { - if !src_label_analyzer.process_field(field_idx, &field_schema) - && !tgt_label_analyzer.process_field(field_idx, &field_schema) + if !src_label_analyzer.process_field(field_idx, field_schema) + && !tgt_label_analyzer.process_field(field_idx, field_schema) { rel_value_fields_info.push(AnalyzedGraphFieldMapping { field_idx, diff --git a/src/ops/storages/postgres.rs b/src/ops/storages/postgres.rs index 1d1ec4463..431df4018 100644 --- a/src/ops/storages/postgres.rs +++ b/src/ops/storages/postgres.rs @@ -611,7 +611,7 @@ impl SetupStatusCheck { .value_fields_schema .iter() .filter(|(field_name, schema)| { - !existing.current.as_ref().map_or(false, |v| { + !existing.current.as_ref().is_some_and(|v| { v.value_fields_schema .get(*field_name) .map(to_column_type_sql) @@ -641,8 +641,7 @@ impl SetupStatusCheck { .filter(|(name, def)| { !existing .current - .as_ref() - .map_or(false, |v| v.vector_indexes.get(*name) != Some(def)) + .as_ref().is_some_and(|v| v.vector_indexes.get(*name) != Some(def)) }) .map(|(k, v)| (k.clone(), v.clone())) .collect(), diff --git a/src/setup/auth_registry.rs b/src/setup/auth_registry.rs index 50aa3560f..9254bd760 100644 --- a/src/setup/auth_registry.rs +++ b/src/setup/auth_registry.rs @@ -6,6 +6,12 @@ pub struct AuthRegistry { entries: RwLock>, } +impl Default for AuthRegistry { + fn default() -> Self { + Self::new() + } +} + impl AuthRegistry { pub fn new() -> Self { Self { diff --git a/src/setup/states.rs b/src/setup/states.rs index 4e7c98616..a97a6da64 100644 --- a/src/setup/states.rs +++ b/src/setup/states.rs @@ -293,8 +293,7 @@ impl std::fmt::Display for ResourceSetupInfo< impl ResourceSetupInfo { pub fn is_up_to_date(&self) -> bool { self.status_check - .as_ref() - .map_or(true, |c| c.change_type() == SetupChangeType::NoChange) + .as_ref().is_none_or(|c| c.change_type() == SetupChangeType::NoChange) } } diff --git a/src/utils/retriable.rs b/src/utils/retriable.rs index d475184b1..8c25eb892 100644 --- a/src/utils/retriable.rs +++ b/src/utils/retriable.rs @@ -37,9 +37,9 @@ impl From for Error { } } -impl Into for Error { - fn into(self) -> anyhow::Error { - self.error +impl From for anyhow::Error { + fn from(val: Error) -> Self { + val.error } }