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 anyhow::Result;
use serde_json::Value;
use sha2::Digest;
use super::post_chat_handler::{
BusterFile, BusterFileContent, BusterReasoningFile, BusterReasoningMessage, BusterReasoningText,
@ -12,6 +11,12 @@ pub struct StreamingParser {
yml_content_regex: regex::Regex,
}
impl Default for StreamingParser {
fn default() -> Self {
Self::new()
}
}
impl StreamingParser {
pub fn new() -> Self {
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
match diesel::update(collections_to_assets::table)
.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
match diesel::update(collections_to_assets::table)
.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
for (id, operation) in operations {
if let Err(_) = operation.await {
if (operation.await).is_err() {
failed_ids.push(id);
}
}
@ -62,7 +62,7 @@ pub async fn delete_dashboards_handler(
/// Helper function to delete a single dashboard
/// 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?;
// 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 {
asset_type: req.asset_type.clone(),
asset_type: req.asset_type,
user_id: user.id,
asset_id: req.id,
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(
user: &AuthenticatedUser,
favorites: &Vec<Uuid>,
favorites: &[Uuid],
) -> Result<Vec<FavoriteObject>> {
match update_favorites_util(user, favorites).await {
Ok(_) => (),

View File

@ -14,7 +14,7 @@ use uuid::Uuid;
///
/// # Returns
/// * `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 mut conn = pool.get().await?;

View File

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