Fix multiple Clippy warnings in handlers library

This commit is contained in:
dal 2025-03-21 11:26:57 -06:00
parent 2ea69275a6
commit 63933d6627
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
7 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,6 @@
use agents::tools::categories::file_tools::common::generate_deterministic_uuid; use agents::tools::categories::file_tools::common::generate_deterministic_uuid;
use anyhow::Result; use anyhow::Result;
use serde_json::Value; use serde_json::Value;
use sha2::Digest;
use super::post_chat_handler::{ use super::post_chat_handler::{
BusterFile, BusterFileContent, BusterReasoningFile, BusterReasoningMessage, BusterReasoningText, BusterFile, BusterFileContent, BusterReasoningFile, BusterReasoningMessage, BusterReasoningText,
@ -12,6 +11,12 @@ pub struct StreamingParser {
yml_content_regex: regex::Regex, yml_content_regex: regex::Regex,
} }
impl Default for StreamingParser {
fn default() -> Self {
Self::new()
}
}
impl StreamingParser { impl StreamingParser {
pub fn new() -> Self { pub fn new() -> Self {
StreamingParser { StreamingParser {

View File

@ -227,7 +227,7 @@ pub async fn remove_assets_from_collection_handler(
} }
}; };
if let Some(_) = existing { if existing.is_some() {
// Dashboard is in the collection, soft delete it // Dashboard is in the collection, soft delete it
match diesel::update(collections_to_assets::table) match diesel::update(collections_to_assets::table)
.filter(collections_to_assets::collection_id.eq(collection_id)) .filter(collections_to_assets::collection_id.eq(collection_id))
@ -351,7 +351,7 @@ pub async fn remove_assets_from_collection_handler(
} }
}; };
if let Some(_) = existing { if existing.is_some() {
// Metric is in the collection, soft delete it // Metric is in the collection, soft delete it
match diesel::update(collections_to_assets::table) match diesel::update(collections_to_assets::table)
.filter(collections_to_assets::collection_id.eq(collection_id)) .filter(collections_to_assets::collection_id.eq(collection_id))

View File

@ -38,7 +38,7 @@ pub async fn delete_dashboards_handler(
// Execute each operation and track failures // Execute each operation and track failures
for (id, operation) in operations { for (id, operation) in operations {
if let Err(_) = operation.await { if (operation.await).is_err() {
failed_ids.push(id); failed_ids.push(id);
} }
} }
@ -62,7 +62,7 @@ pub async fn delete_dashboards_handler(
/// Helper function to delete a single dashboard /// Helper function to delete a single dashboard
/// Used internally by delete_dashboards_handler /// Used internally by delete_dashboards_handler
async fn delete_single_dashboard(dashboard_id: Uuid, user_id: &Uuid) -> Result<()> { async fn delete_single_dashboard(dashboard_id: Uuid, _user_id: &Uuid) -> Result<()> {
let mut conn = get_pg_pool().get().await?; let mut conn = get_pg_pool().get().await?;
// Check if the dashboard exists and is not already deleted // Check if the dashboard exists and is not already deleted

View File

@ -46,7 +46,7 @@ pub async fn create_favorite(
}; };
let user_favorite = UserFavorite { let user_favorite = UserFavorite {
asset_type: req.asset_type.clone(), asset_type: req.asset_type,
user_id: user.id, user_id: user.id,
asset_id: req.id, asset_id: req.id,
order_index: index as i32, order_index: index as i32,

View File

@ -6,7 +6,7 @@ use super::favorites_utils::{list_user_favorites, update_favorites as update_fav
pub async fn update_favorites( pub async fn update_favorites(
user: &AuthenticatedUser, user: &AuthenticatedUser,
favorites: &Vec<Uuid>, favorites: &[Uuid],
) -> Result<Vec<FavoriteObject>> { ) -> Result<Vec<FavoriteObject>> {
match update_favorites_util(user, favorites).await { match update_favorites_util(user, favorites).await {
Ok(_) => (), Ok(_) => (),

View File

@ -14,7 +14,7 @@ use uuid::Uuid;
/// ///
/// # Returns /// # Returns
/// * `Result<()>` - Success or error /// * `Result<()>` - Success or error
pub async fn delete_message_handler(user: AuthenticatedUser, message_id: Uuid) -> Result<()> { pub async fn delete_message_handler(_user: AuthenticatedUser, message_id: Uuid) -> Result<()> {
let pool = get_pg_pool(); let pool = get_pg_pool();
let mut conn = pool.get().await?; let mut conn = pool.get().await?;

View File

@ -83,7 +83,7 @@ pub async fn post_metric_dashboard_handler(
match existing { match existing {
Ok(_) => { Ok(_) => {
return Ok(PostMetricDashboardResponse { Ok(PostMetricDashboardResponse {
metric_id: *metric_id, metric_id: *metric_id,
dashboard_id: request.dashboard_id, dashboard_id: request.dashboard_id,
}) })