fix: 修复Rust编译警告,优化代码质量
主要修复: - 修复snake_case命名规范问题:projectId -> project_id, templateId -> template_id - 移除未使用的导入:std::sync::Arc - 修复未使用变量参数:添加下划线前缀标记 - 修复未使用的错误变量:在map_err闭包中使用_e前缀 修复的警告类型: - unused_imports: 移除未使用的导入 - unused_variables: 标记未使用的参数 - non_snake_case: 修复命名规范 - 将警告数量从29个减少到10个 剩余的10个警告主要是为未来功能预留的死代码,属于正常情况。
This commit is contained in:
parent
dc61de7cad
commit
6c795a5ddf
|
|
@ -301,10 +301,10 @@ impl CustomTagRepository {
|
|||
let updated_at_str: String = row.get(8)?;
|
||||
|
||||
let created_at = DateTime::parse_from_rfc3339(&created_at_str)
|
||||
.map_err(|e| rusqlite::Error::InvalidColumnType(7, "created_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.map_err(|_e| rusqlite::Error::InvalidColumnType(7, "created_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.with_timezone(&Utc);
|
||||
let updated_at = DateTime::parse_from_rfc3339(&updated_at_str)
|
||||
.map_err(|e| rusqlite::Error::InvalidColumnType(8, "updated_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.map_err(|_e| rusqlite::Error::InvalidColumnType(8, "updated_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.with_timezone(&Utc);
|
||||
|
||||
Ok(CustomTagCategory {
|
||||
|
|
@ -326,10 +326,10 @@ impl CustomTagRepository {
|
|||
let updated_at_str: String = row.get(offset + 8)?;
|
||||
|
||||
let created_at = DateTime::parse_from_rfc3339(&created_at_str)
|
||||
.map_err(|e| rusqlite::Error::InvalidColumnType(offset + 7, "created_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.map_err(|_e| rusqlite::Error::InvalidColumnType(offset + 7, "created_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.with_timezone(&Utc);
|
||||
let updated_at = DateTime::parse_from_rfc3339(&updated_at_str)
|
||||
.map_err(|e| rusqlite::Error::InvalidColumnType(offset + 8, "updated_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.map_err(|_e| rusqlite::Error::InvalidColumnType(offset + 8, "updated_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.with_timezone(&Utc);
|
||||
|
||||
Ok(CustomTagCategory {
|
||||
|
|
@ -351,10 +351,10 @@ impl CustomTagRepository {
|
|||
let updated_at_str: String = row.get(9)?;
|
||||
|
||||
let created_at = DateTime::parse_from_rfc3339(&created_at_str)
|
||||
.map_err(|e| rusqlite::Error::InvalidColumnType(8, "created_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.map_err(|_e| rusqlite::Error::InvalidColumnType(8, "created_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.with_timezone(&Utc);
|
||||
let updated_at = DateTime::parse_from_rfc3339(&updated_at_str)
|
||||
.map_err(|e| rusqlite::Error::InvalidColumnType(9, "updated_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.map_err(|_e| rusqlite::Error::InvalidColumnType(9, "updated_at".to_string(), rusqlite::types::Type::Text))?
|
||||
.with_timezone(&Utc);
|
||||
|
||||
Ok(CustomTag {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ impl MaterialRepository {
|
|||
})?;
|
||||
|
||||
let mut segments = Vec::new();
|
||||
for (index, segment) in segment_iter.enumerate() {
|
||||
for (_index, segment) in segment_iter.enumerate() {
|
||||
let segment = segment?;
|
||||
segments.push(segment);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::sync::Arc;
|
||||
// use std::sync::Arc; // 未使用的导入
|
||||
use tauri::State;
|
||||
|
||||
use crate::app_state::AppState;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ pub async fn get_model_dynamic_stats(
|
|||
/// 重新生成视频命令
|
||||
#[command]
|
||||
pub async fn regenerate_dynamic_video(
|
||||
state: State<'_, AppState>,
|
||||
_state: State<'_, AppState>,
|
||||
dynamic_id: String,
|
||||
video_id: String,
|
||||
) -> Result<(), String> {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::infrastructure::gemini_service::{GeminiService, GeminiConfig};
|
|||
/// 遵循 Tauri 开发规范的命令接口设计原则
|
||||
#[tauri::command]
|
||||
pub async fn analyze_outfit_image(
|
||||
state: State<'_, AppState>,
|
||||
_state: State<'_, AppState>,
|
||||
request: AnalyzeImageRequest,
|
||||
) -> Result<AnalyzeImageResponse, String> {
|
||||
// 创建Gemini服务
|
||||
|
|
@ -44,8 +44,8 @@ pub async fn analyze_outfit_image(
|
|||
/// 搜索相似服装
|
||||
#[tauri::command]
|
||||
pub async fn search_similar_outfits(
|
||||
state: State<'_, AppState>,
|
||||
request: SearchRequest,
|
||||
_state: State<'_, AppState>,
|
||||
_request: SearchRequest,
|
||||
) -> Result<SearchResponse, String> {
|
||||
// TODO: 实现真实的搜索逻辑
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ pub async fn search_similar_outfits(
|
|||
/// LLM问答
|
||||
#[tauri::command]
|
||||
pub async fn ask_llm_outfit_advice(
|
||||
state: State<'_, AppState>,
|
||||
_state: State<'_, AppState>,
|
||||
request: LLMQueryRequest,
|
||||
) -> Result<LLMQueryResponse, String> {
|
||||
// 创建Gemini服务
|
||||
|
|
@ -103,7 +103,7 @@ pub async fn get_outfit_search_suggestions(
|
|||
#[tauri::command]
|
||||
pub async fn generate_search_config_from_analysis(
|
||||
_state: State<'_, AppState>,
|
||||
analysis_result: crate::data::models::gemini_analysis::OutfitAnalysisResult,
|
||||
_analysis_result: crate::data::models::gemini_analysis::OutfitAnalysisResult,
|
||||
) -> Result<crate::data::models::outfit_search::SearchConfig, String> {
|
||||
// TODO: 实现基于分析结果生成搜索配置的逻辑
|
||||
// 暂时返回默认配置
|
||||
|
|
|
|||
|
|
@ -96,12 +96,12 @@ pub async fn list_project_template_bindings(
|
|||
/// 获取项目的模板列表
|
||||
#[tauri::command]
|
||||
pub async fn get_templates_by_project(
|
||||
projectId: String,
|
||||
project_id: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<Vec<ProjectTemplateBindingDetail>, String> {
|
||||
let service = create_service(&state)?;
|
||||
|
||||
service.get_templates_by_project(&projectId)
|
||||
service.get_templates_by_project(&project_id)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
|
@ -109,12 +109,12 @@ pub async fn get_templates_by_project(
|
|||
/// 获取模板的项目列表
|
||||
#[tauri::command]
|
||||
pub async fn get_projects_by_template(
|
||||
templateId: String,
|
||||
template_id: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<Vec<ProjectTemplateBindingDetail>, String> {
|
||||
let service = create_service(&state)?;
|
||||
|
||||
service.get_projects_by_template(&templateId)
|
||||
service.get_projects_by_template(&template_id)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
|
@ -174,12 +174,12 @@ pub async fn deactivate_project_template_binding(
|
|||
/// 获取项目的主要模板绑定
|
||||
#[tauri::command]
|
||||
pub async fn get_primary_template_binding_for_project(
|
||||
projectId: String,
|
||||
project_id: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<Option<ProjectTemplateBinding>, String> {
|
||||
let service = create_service(&state)?;
|
||||
|
||||
service.get_primary_binding_for_project(&projectId)
|
||||
service.get_primary_binding_for_project(&project_id)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
|
@ -187,13 +187,13 @@ pub async fn get_primary_template_binding_for_project(
|
|||
/// 设置项目的主要模板
|
||||
#[tauri::command]
|
||||
pub async fn set_primary_template_for_project(
|
||||
projectId: String,
|
||||
templateId: String,
|
||||
project_id: String,
|
||||
template_id: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<ProjectTemplateBinding, String> {
|
||||
let service = create_service(&state)?;
|
||||
|
||||
service.set_primary_template(&projectId, &templateId)
|
||||
service.set_primary_template(&project_id, &template_id)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue