From 7720ca44e04ce5ac93a5ac38525180344d50745e Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Fri, 29 Nov 2024 13:51:02 +0100 Subject: [PATCH] Clippy --- swiftide-core/src/query_stream.rs | 6 +++--- .../src/transformers/metadata_keywords.rs | 9 ++++----- swiftide-indexing/src/transformers/metadata_qa_text.rs | 9 ++++----- swiftide-indexing/src/transformers/metadata_summary.rs | 9 ++++----- swiftide-indexing/src/transformers/metadata_title.rs | 10 ++++------ swiftide-integrations/src/aws_bedrock/mod.rs | 2 +- swiftide-integrations/src/pgvector/fixtures.rs | 2 +- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/swiftide-core/src/query_stream.rs b/swiftide-core/src/query_stream.rs index e3cc820c..afa978d6 100644 --- a/swiftide-core/src/query_stream.rs +++ b/swiftide-core/src/query_stream.rs @@ -34,7 +34,7 @@ impl<'stream, STATE: QueryState + 'stream> Default for QueryStream<'stream, STAT } } -impl<'stream, STATE: QueryState> Stream for QueryStream<'stream, STATE> { +impl Stream for QueryStream<'_, STATE> { type Item = Result>; fn poll_next( @@ -46,8 +46,8 @@ impl<'stream, STATE: QueryState> Stream for QueryStream<'stream, STATE> { } } -impl<'stream, STATE: QueryState> From>> + Send>>> - for QueryStream<'stream, STATE> +impl From>> + Send>>> + for QueryStream<'_, STATE> { fn from(val: Pin>> + Send>>) -> Self { QueryStream { diff --git a/swiftide-indexing/src/transformers/metadata_keywords.rs b/swiftide-indexing/src/transformers/metadata_keywords.rs index 1e273097..f5944d1d 100644 --- a/swiftide-indexing/src/transformers/metadata_keywords.rs +++ b/swiftide-indexing/src/transformers/metadata_keywords.rs @@ -1,13 +1,12 @@ //! Extract keywords from a node and add them as metadata +//! This module defines the `MetadataKeywords` struct and its associated methods, +//! which are used for generating metadata in the form of keywords +//! for a given text. It interacts with a client (e.g., `OpenAI`) to generate +//! the keywords based on the text chunk in a `Node`. use anyhow::Result; use async_trait::async_trait; use swiftide_core::{indexing::Node, Transformer}; -/// This module defines the `MetadataKeywords` struct and its associated methods, -/// which are used for generating metadata in the form of keywords -/// for a given text. It interacts with a client (e.g., `OpenAI`) to generate -/// the keywords based on the text chunk in a `Node`. - /// `MetadataKeywords` is responsible for generating keywords /// for a given text chunk. It uses a templated prompt to interact with a client /// that implements the `SimplePrompt` trait. diff --git a/swiftide-indexing/src/transformers/metadata_qa_text.rs b/swiftide-indexing/src/transformers/metadata_qa_text.rs index ef33e438..fd74f237 100644 --- a/swiftide-indexing/src/transformers/metadata_qa_text.rs +++ b/swiftide-indexing/src/transformers/metadata_qa_text.rs @@ -1,14 +1,13 @@ //! Generates questions and answers from a given text chunk and adds them as metadata. +//! This module defines the `MetadataQAText` struct and its associated methods, +//! which are used for generating metadata in the form of questions and answers +//! from a given text. It interacts with a client (e.g., `OpenAI`) to generate +//! these questions and answers based on the text chunk in an `Node`. use anyhow::Result; use async_trait::async_trait; use swiftide_core::{indexing::Node, Transformer}; -/// This module defines the `MetadataQAText` struct and its associated methods, -/// which are used for generating metadata in the form of questions and answers -/// from a given text. It interacts with a client (e.g., `OpenAI`) to generate -/// these questions and answers based on the text chunk in an `Node`. - /// `MetadataQAText` is responsible for generating questions and answers /// from a given text chunk. It uses a templated prompt to interact with a client /// that implements the `SimplePrompt` trait. diff --git a/swiftide-indexing/src/transformers/metadata_summary.rs b/swiftide-indexing/src/transformers/metadata_summary.rs index 687a86c7..6b981e01 100644 --- a/swiftide-indexing/src/transformers/metadata_summary.rs +++ b/swiftide-indexing/src/transformers/metadata_summary.rs @@ -1,14 +1,13 @@ //! Generate a summary and adds it as metadata +//! This module defines the `MetadataSummary` struct and its associated methods, +//! which are used for generating metadata in the form of a summary +//! for a given text. It interacts with a client (e.g., `OpenAI`) to generate +//! the summary based on the text chunk in an `Node`. use anyhow::Result; use async_trait::async_trait; use swiftide_core::{indexing::Node, Transformer}; -/// This module defines the `MetadataSummary` struct and its associated methods, -/// which are used for generating metadata in the form of a summary -/// for a given text. It interacts with a client (e.g., `OpenAI`) to generate -/// the summary based on the text chunk in an `Node`. - /// `MetadataSummary` is responsible for generating a summary /// for a given text chunk. It uses a templated prompt to interact with a client /// that implements the `SimplePrompt` trait. diff --git a/swiftide-indexing/src/transformers/metadata_title.rs b/swiftide-indexing/src/transformers/metadata_title.rs index 07dff784..eb0c1982 100644 --- a/swiftide-indexing/src/transformers/metadata_title.rs +++ b/swiftide-indexing/src/transformers/metadata_title.rs @@ -1,14 +1,12 @@ //! Generate a title and adds it as metadata - +//! This module defines the `MetadataTitle` struct and its associated methods, +//! which are used for generating metadata in the form of a title +//! for a given text. It interacts with a client (e.g., `OpenAI`) to generate +//! these questions and answers based on the text chunk in an `Node`. use anyhow::Result; use async_trait::async_trait; use swiftide_core::{indexing::Node, Transformer}; -/// This module defines the `MetadataTitle` struct and its associated methods, -/// which are used for generating metadata in the form of a title -/// for a given text. It interacts with a client (e.g., `OpenAI`) to generate -/// these questions and answers based on the text chunk in an `Node`. - /// `MetadataTitle` is responsible for generating a title /// for a given text chunk. It uses a templated prompt to interact with a client /// that implements the `SimplePrompt` trait. diff --git a/swiftide-integrations/src/aws_bedrock/mod.rs b/swiftide-integrations/src/aws_bedrock/mod.rs index 9e0c4f2e..48131299 100644 --- a/swiftide-integrations/src/aws_bedrock/mod.rs +++ b/swiftide-integrations/src/aws_bedrock/mod.rs @@ -33,8 +33,8 @@ pub struct AwsBedrock { #[builder(setter(into))] /// The model id or arn of the model to use model_id: String, - #[builder(default = "self.default_client()", setter(custom))] + #[builder(default = self.default_client(), setter(custom))] /// The bedrock runtime client client: Arc, #[builder(default)] diff --git a/swiftide-integrations/src/pgvector/fixtures.rs b/swiftide-integrations/src/pgvector/fixtures.rs index 6508893a..22c31e4b 100644 --- a/swiftide-integrations/src/pgvector/fixtures.rs +++ b/swiftide-integrations/src/pgvector/fixtures.rs @@ -79,7 +79,7 @@ pub(crate) struct PgVectorTestData<'a> { pub vectors: Vec<(indexing::EmbeddedField, Vec)>, } -impl<'a> PgVectorTestData<'a> { +impl PgVectorTestData<'_> { pub(crate) fn to_node(&self) -> indexing::Node { // Create the initial builder let mut base_builder = indexing::Node::builder();