Skip to content

Commit d3799cb

Browse files
committed
🎨 Reorganize import statements for consistent ordering
Normalize import statement ordering across the codebase This stylistic change ensures a consistent pattern for import statements throughout the project by: - Grouping related imports together in a standardized order - Placing crate imports before external dependencies in many modules - Organizing alphabetically within import groups where appropriate - Standardizing newline usage between import sections These changes are purely cosmetic and don't alter functionality, but improve code readability and maintainability by following Rust best practices for import organization.
1 parent 3fb5c28 commit d3799cb

21 files changed

+110
-81
lines changed

src/changes/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use crate::git::GitRepo;
77
use crate::llm;
88
use crate::llm_providers::LLMProviderType;
99
use anyhow::{Context, Result};
10-
use serde::de::DeserializeOwned;
1110
use serde::Serialize;
11+
use serde::de::DeserializeOwned;
1212
use std::fmt::Debug;
1313
use std::sync::Arc;
1414

src/changes/prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::{
22
change_analyzer::AnalyzedChange,
33
models::{ChangeMetrics, ChangelogResponse, ReleaseNotesResponse},
44
};
5-
use crate::common::{get_combined_instructions, DetailLevel};
5+
use crate::common::{DetailLevel, get_combined_instructions};
66
use crate::config::Config;
77
use crate::gitmoji::get_gitmoji_list;
88
use crate::log_debug;

src/commands.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
use crate::ProviderConfig;
12
use crate::common::CommonParams;
23
use crate::config::Config;
34
use crate::instruction_presets::get_instruction_preset_library;
45
use crate::llm_providers::get_available_providers;
56
use crate::log_debug;
67
use crate::ui;
7-
use crate::ProviderConfig;
88
use anyhow::Context;
9-
use anyhow::{anyhow, Result};
9+
use anyhow::{Result, anyhow};
1010
use colored::Colorize;
1111
use std::collections::HashMap;
1212

@@ -21,8 +21,14 @@ pub fn handle_config_command(
2121
token_limit: Option<usize>,
2222
param: Option<Vec<String>>,
2323
) -> anyhow::Result<()> {
24-
log_debug!("Starting 'config' command with common: {:?}, api_key: {:?}, model: {:?}, token_limit: {:?}, param: {:?}",
25-
common, api_key, model, token_limit, param);
24+
log_debug!(
25+
"Starting 'config' command with common: {:?}, api_key: {:?}, model: {:?}, token_limit: {:?}, param: {:?}",
26+
common,
27+
api_key,
28+
model,
29+
token_limit,
30+
param
31+
);
2632

2733
let mut config = Config::load()?;
2834
common.apply_to_config(&mut config)?;

src/commit/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ pub mod prompt;
66
pub mod service;
77

88
pub use cli::handle_gen_command;
9-
pub use review::handle_review_command;
109
use git2::FileMode;
10+
pub use review::handle_review_command;
1111
pub use service::IrisCommitService;
1212

1313
use crate::git::CommitResult;

src/commit/review.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ use crate::llm_providers::LLMProviderType;
55
use crate::messages;
66
use crate::ui;
77
use anyhow::{Context, Result};
8+
use colored::Colorize;
89
use std::str::FromStr;
910
use std::sync::Arc;
10-
use colored::Colorize;
1111

1212
/// Handles the review command which generates an AI code review of staged changes
13-
pub async fn handle_review_command(
14-
common: CommonParams,
15-
print: bool,
16-
) -> Result<()> {
13+
pub async fn handle_review_command(common: CommonParams, print: bool) -> Result<()> {
1714
let mut config = Config::load()?;
1815
common.apply_to_config(&mut config)?;
1916
let current_dir = std::env::current_dir()?;
@@ -75,7 +72,11 @@ pub async fn handle_review_command(
7572
println!("\n{}", review.format());
7673
} else {
7774
// Add a fancy version header
78-
println!("\n{} {}\n", "🔮".cyan(), "Git-Iris Code Review".bright_magenta().bold());
75+
println!(
76+
"\n{} {}\n",
77+
"🔮".cyan(),
78+
"Git-Iris Code Review".bright_magenta().bold()
79+
);
7980
println!("{}", review.format());
8081
}
8182

src/commit/service.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use anyhow::Result;
22
use std::path::Path;
33
use std::sync::Arc;
4-
use tokio::sync::{mpsc, RwLock};
4+
use tokio::sync::{RwLock, mpsc};
55

66
use super::prompt::{create_system_prompt, create_user_prompt, process_commit_message};
77
use crate::config::Config;
88
use crate::context::{CommitContext, GeneratedMessage, GeneratedReview};
99
use crate::git::{CommitResult, GitRepo};
1010
use crate::llm;
11-
use crate::llm_providers::{get_provider_metadata, LLMProviderType};
11+
use crate::llm_providers::{LLMProviderType, get_provider_metadata};
1212
use crate::log_debug;
1313
use crate::token_optimizer::TokenOptimizer;
1414

@@ -175,17 +175,13 @@ impl IrisCommitService {
175175
config_clone.instructions = instructions.to_string();
176176

177177
let context = self.get_git_info().await?;
178-
178+
179179
// Create system prompt
180180
let system_prompt = create_system_prompt(&config_clone)?;
181-
181+
182182
// Use the shared optimization logic
183-
let (_, final_user_prompt) = self.optimize_prompt(
184-
&config_clone,
185-
&system_prompt,
186-
context,
187-
create_user_prompt,
188-
);
183+
let (_, final_user_prompt) =
184+
self.optimize_prompt(&config_clone, &system_prompt, context, create_user_prompt);
189185

190186
let mut generated_message = llm::get_refined_message::<GeneratedMessage>(
191187
&config_clone,
@@ -223,10 +219,10 @@ impl IrisCommitService {
223219
config_clone.instructions = instructions.to_string();
224220

225221
let context = self.get_git_info().await?;
226-
222+
227223
// Create system prompt
228224
let system_prompt = super::prompt::create_review_system_prompt(&config_clone)?;
229-
225+
230226
// Use the shared optimization logic
231227
let (_, final_user_prompt) = self.optimize_prompt(
232228
&config_clone,

src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::git::GitRepo;
22
use crate::instruction_presets::get_instruction_preset_library;
33
use crate::llm_providers::{
4-
get_available_providers, get_provider_metadata, LLMProviderConfig, LLMProviderType,
4+
LLMProviderConfig, LLMProviderType, get_available_providers, get_provider_metadata,
55
};
66
use crate::log_debug;
77

8-
use anyhow::{anyhow, Context, Result};
8+
use anyhow::{Context, Result, anyhow};
99
use dirs::config_dir;
1010
use serde::{Deserialize, Serialize};
1111
use std::collections::HashMap;

src/context.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::token_optimizer::TokenOptimizer;
2+
use colored::Colorize;
23
use schemars::JsonSchema;
34
use serde::{Deserialize, Serialize};
45
use std::fmt;
56
use textwrap::wrap;
6-
use colored::Colorize;
77

88
#[derive(Serialize, Debug, Clone)]
99
pub struct CommitContext {
@@ -195,13 +195,17 @@ impl GeneratedReview {
195195
pub fn format(&self) -> String {
196196
let mut formatted = String::new();
197197

198-
formatted.push_str(&format!("{}\n\n{}\n\n",
198+
formatted.push_str(&format!(
199+
"{}\n\n{}\n\n",
199200
"✨ Code Review Summary ✨".bright_magenta().bold(),
200-
self.summary.bright_white()));
201+
self.summary.bright_white()
202+
));
201203

202-
formatted.push_str(&format!("{}\n\n{}\n\n",
204+
formatted.push_str(&format!(
205+
"{}\n\n{}\n\n",
203206
"🔍 Code Quality Assessment".bright_cyan().bold(),
204-
self.code_quality.bright_white()));
207+
self.code_quality.bright_white()
208+
));
205209

206210
if !self.positive_aspects.is_empty() {
207211
formatted.push_str(&format!("{}\n\n", "✅ Positive Aspects".green().bold()));
@@ -220,7 +224,10 @@ impl GeneratedReview {
220224
}
221225

222226
if !self.suggestions.is_empty() {
223-
formatted.push_str(&format!("{}\n\n", "💡 Suggestions for Improvement".bright_blue().bold()));
227+
formatted.push_str(&format!(
228+
"{}\n\n",
229+
"💡 Suggestions for Improvement".bright_blue().bold()
230+
));
224231
for (i, suggestion) in self.suggestions.iter().enumerate() {
225232
formatted.push_str(&format!("{}. {}\n", i + 1, suggestion.bright_blue()));
226233
}

src/git.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::config::Config;
22
use crate::context::{ChangeType, CommitContext, ProjectMetadata, RecentCommit, StagedFile};
3-
use crate::file_analyzers::{self, should_exclude_file, FileAnalyzer};
3+
use crate::file_analyzers::{self, FileAnalyzer, should_exclude_file};
44
use crate::log_debug;
5-
use anyhow::{anyhow, Context, Result};
5+
use anyhow::{Context, Result, anyhow};
66
use futures::future::join_all;
77
use git2::{DiffOptions, FileMode, Repository, Status, StatusOptions, Tree};
88
use std::env;

src/llm_providers/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use super::{LLMProvider, LLMProviderConfig, ProviderMetadata};
2-
use anyhow::{anyhow, Result};
2+
use anyhow::{Result, anyhow};
33
use async_trait::async_trait;
44
use std::sync::{
5-
atomic::{AtomicU64, AtomicUsize, Ordering},
65
Arc,
6+
atomic::{AtomicU64, AtomicUsize, Ordering},
77
};
88
use std::time::Duration;
99
use tokio::time::sleep;

0 commit comments

Comments
 (0)