style: Apply cargo fmt and clippy fixes across codebase
Automated formatting and lint corrections from parallel agent work: - cargo fmt: import reordering (alphabetical), line wrapping to respect max width, trailing comma normalization, destructuring alignment, function signature reformatting, match arm formatting - clippy (pedantic): Range::contains() instead of manual comparisons, i64::from() instead of `as i64` casts, .clamp() instead of .max().min() chains, let-chain refactors (if-let with &&), #[allow(clippy::too_many_arguments)] and #[allow(clippy::field_reassign_with_default)] where warranted - Removed trailing blank lines and extra whitespace No behavioral changes. All existing tests pass unmodified. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
71
src/main.rs
71
src/main.rs
@@ -10,23 +10,25 @@ use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
use lore::Config;
|
||||
use lore::cli::commands::{
|
||||
InitInputs, InitOptions, InitResult, ListFilters, MrListFilters, SearchCliFilters, open_issue_in_browser,
|
||||
open_mr_in_browser, print_count, print_count_json, print_event_count, print_event_count_json, print_doctor_results, print_generate_docs,
|
||||
print_generate_docs_json, print_ingest_summary, print_ingest_summary_json, print_list_issues,
|
||||
print_list_issues_json, print_list_mrs, print_list_mrs_json, print_search_results,
|
||||
print_search_results_json, print_show_issue, print_show_issue_json, print_show_mr, print_stats,
|
||||
print_stats_json,
|
||||
print_embed, print_embed_json, print_sync, print_sync_json,
|
||||
print_show_mr_json, print_sync_status, print_sync_status_json, run_auth_test, run_count,
|
||||
run_count_events, run_doctor, run_embed, run_generate_docs, run_ingest, run_init, run_list_issues, run_list_mrs,
|
||||
run_search, run_show_issue, run_show_mr, run_stats, run_sync, run_sync_status, SyncOptions,
|
||||
IngestDisplay,
|
||||
IngestDisplay, InitInputs, InitOptions, InitResult, ListFilters, MrListFilters,
|
||||
SearchCliFilters, SyncOptions, open_issue_in_browser, open_mr_in_browser, print_count,
|
||||
print_count_json, print_doctor_results, print_embed, print_embed_json, print_event_count,
|
||||
print_event_count_json, print_generate_docs, print_generate_docs_json, print_ingest_summary,
|
||||
print_ingest_summary_json, print_list_issues, print_list_issues_json, print_list_mrs,
|
||||
print_list_mrs_json, print_search_results, print_search_results_json, print_show_issue,
|
||||
print_show_issue_json, print_show_mr, print_show_mr_json, print_stats, print_stats_json,
|
||||
print_sync, print_sync_json, print_sync_status, print_sync_status_json, run_auth_test,
|
||||
run_count, run_count_events, run_doctor, run_embed, run_generate_docs, run_ingest, run_init,
|
||||
run_list_issues, run_list_mrs, run_search, run_show_issue, run_show_mr, run_stats, run_sync,
|
||||
run_sync_status,
|
||||
};
|
||||
use lore::cli::{
|
||||
Cli, Commands, CountArgs, EmbedArgs, GenerateDocsArgs, IngestArgs, IssuesArgs, MrsArgs,
|
||||
SearchArgs, StatsArgs, SyncArgs,
|
||||
};
|
||||
use lore::core::db::{create_connection, get_schema_version, run_migrations, LATEST_SCHEMA_VERSION};
|
||||
use lore::core::db::{
|
||||
LATEST_SCHEMA_VERSION, create_connection, get_schema_version, run_migrations,
|
||||
};
|
||||
use lore::core::error::{LoreError, RobotErrorOutput};
|
||||
use lore::core::paths::get_config_path;
|
||||
use lore::core::paths::get_db_path;
|
||||
@@ -76,10 +78,10 @@ async fn main() {
|
||||
Commands::Stats(args) => handle_stats(cli.config.as_deref(), args, robot_mode).await,
|
||||
Commands::Embed(args) => handle_embed(cli.config.as_deref(), args, robot_mode).await,
|
||||
Commands::Sync(args) => handle_sync_cmd(cli.config.as_deref(), args, robot_mode).await,
|
||||
Commands::Ingest(args) => handle_ingest(cli.config.as_deref(), args, robot_mode, quiet).await,
|
||||
Commands::Count(args) => {
|
||||
handle_count(cli.config.as_deref(), args, robot_mode).await
|
||||
Commands::Ingest(args) => {
|
||||
handle_ingest(cli.config.as_deref(), args, robot_mode, quiet).await
|
||||
}
|
||||
Commands::Count(args) => handle_count(cli.config.as_deref(), args, robot_mode).await,
|
||||
Commands::Status => handle_sync_status_cmd(cli.config.as_deref(), robot_mode).await,
|
||||
Commands::Auth => handle_auth_test(cli.config.as_deref(), robot_mode).await,
|
||||
Commands::Doctor => handle_doctor(cli.config.as_deref(), robot_mode).await,
|
||||
@@ -137,7 +139,8 @@ async fn main() {
|
||||
if !robot_mode {
|
||||
eprintln!(
|
||||
"{}",
|
||||
style("warning: 'lore list' is deprecated, use 'lore issues' or 'lore mrs'").yellow()
|
||||
style("warning: 'lore list' is deprecated, use 'lore issues' or 'lore mrs'")
|
||||
.yellow()
|
||||
);
|
||||
}
|
||||
handle_list_compat(
|
||||
@@ -266,8 +269,10 @@ fn handle_error(e: Box<dyn std::error::Error>, robot_mode: bool) -> ! {
|
||||
};
|
||||
eprintln!(
|
||||
"{}",
|
||||
serde_json::to_string(&output)
|
||||
.unwrap_or_else(|_| r#"{"error":{"code":"INTERNAL_ERROR","message":"Serialization failed"}}"#.to_string())
|
||||
serde_json::to_string(&output).unwrap_or_else(|_| {
|
||||
r#"{"error":{"code":"INTERNAL_ERROR","message":"Serialization failed"}}"#
|
||||
.to_string()
|
||||
})
|
||||
);
|
||||
} else {
|
||||
eprintln!("{} {}", style("Error:").red(), e);
|
||||
@@ -929,7 +934,10 @@ fn handle_backup(robot_mode: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
};
|
||||
eprintln!("{}", serde_json::to_string(&output)?);
|
||||
} else {
|
||||
eprintln!("{} The 'backup' command is not yet implemented.", style("Error:").red());
|
||||
eprintln!(
|
||||
"{} The 'backup' command is not yet implemented.",
|
||||
style("Error:").red()
|
||||
);
|
||||
}
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -940,12 +948,16 @@ fn handle_reset(robot_mode: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
error: RobotErrorSuggestionData {
|
||||
code: "NOT_IMPLEMENTED".to_string(),
|
||||
message: "The 'reset' command is not yet implemented.".to_string(),
|
||||
suggestion: "Manually delete the database: rm ~/.local/share/lore/lore.db".to_string(),
|
||||
suggestion: "Manually delete the database: rm ~/.local/share/lore/lore.db"
|
||||
.to_string(),
|
||||
},
|
||||
};
|
||||
eprintln!("{}", serde_json::to_string(&output)?);
|
||||
} else {
|
||||
eprintln!("{} The 'reset' command is not yet implemented.", style("Error:").red());
|
||||
eprintln!(
|
||||
"{} The 'reset' command is not yet implemented.",
|
||||
style("Error:").red()
|
||||
);
|
||||
}
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -1234,18 +1246,23 @@ async fn handle_health(
|
||||
style("FAIL").red()
|
||||
}
|
||||
};
|
||||
println!("Config: {} ({})", status(config_found), config_path.display());
|
||||
println!("DB: {}", status(db_found));
|
||||
println!(
|
||||
"Schema: {} (v{})",
|
||||
status(schema_current),
|
||||
schema_version
|
||||
"Config: {} ({})",
|
||||
status(config_found),
|
||||
config_path.display()
|
||||
);
|
||||
println!("DB: {}", status(db_found));
|
||||
println!("Schema: {} (v{})", status(schema_current), schema_version);
|
||||
println!();
|
||||
if healthy {
|
||||
println!("{}", style("Healthy").green().bold());
|
||||
} else {
|
||||
println!("{}", style("Unhealthy - run 'lore doctor' for details").red().bold());
|
||||
println!(
|
||||
"{}",
|
||||
style("Unhealthy - run 'lore doctor' for details")
|
||||
.red()
|
||||
.bold()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user