Skip to content

Commit bcfcf66

Browse files
haasonsaasclaude
andcommitted
Run cargo fmt to fix formatting across codebase
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ceff927 commit bcfcf66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1297
-738
lines changed

.claude/worktrees/agent-a85b36dc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 41717c3cf1d84d80b850946c956e3f32d1c9a3c3

src/adapters/anthropic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ impl AnthropicAdapter {
8181
retry_config,
8282
})
8383
}
84-
8584
}
8685

8786
#[async_trait]
@@ -407,4 +406,3 @@ mod tests {
407406
assert!(result.is_ok());
408407
}
409408
}
410-

src/adapters/common.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ where
4747
let status = response.status();
4848
let body = response.text().await.unwrap_or_default();
4949
if is_retryable_status(status) && attempt < max_retries {
50-
sleep(Duration::from_millis(base_delay_ms.saturating_mul(attempt as u64 + 1))).await;
50+
sleep(Duration::from_millis(
51+
base_delay_ms.saturating_mul(attempt as u64 + 1),
52+
))
53+
.await;
5154
continue;
5255
}
5356

@@ -62,7 +65,10 @@ where
6265
}
6366
Err(err) => {
6467
if attempt < max_retries {
65-
sleep(Duration::from_millis(base_delay_ms.saturating_mul(attempt as u64 + 1))).await;
68+
sleep(Duration::from_millis(
69+
base_delay_ms.saturating_mul(attempt as u64 + 1),
70+
))
71+
.await;
6672
continue;
6773
}
6874
return Err(err.into());
@@ -126,7 +132,7 @@ fn is_private_or_loopback(ip: IpAddr) -> bool {
126132
v4.is_loopback() // 127.0.0.0/8
127133
|| v4.is_unspecified() // 0.0.0.0
128134
|| v4.is_private() // 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
129-
|| v4.is_link_local() // 169.254.0.0/16
135+
|| v4.is_link_local() // 169.254.0.0/16
130136
}
131137
IpAddr::V6(v6) => {
132138
v6.is_loopback() // ::1

src/adapters/ollama.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,13 @@ impl OllamaAdapter {
138138
name: self.model_name_bare().to_string(),
139139
};
140140

141-
let response = self.client.post(&url).json(&show_request).send().await.ok()?;
141+
let response = self
142+
.client
143+
.post(&url)
144+
.json(&show_request)
145+
.send()
146+
.await
147+
.ok()?;
142148

143149
if !response.status().is_success() {
144150
return None;
@@ -296,7 +302,12 @@ mod tests {
296302
.mock("POST", "/api/chat")
297303
.with_status(200)
298304
.with_header("content-type", "application/json")
299-
.with_body(chat_response_body_with_usage("test response", "codellama", 10, 5))
305+
.with_body(chat_response_body_with_usage(
306+
"test response",
307+
"codellama",
308+
10,
309+
5,
310+
))
300311
.create_async()
301312
.await;
302313

@@ -328,8 +339,7 @@ mod tests {
328339
.create_async()
329340
.await;
330341

331-
let adapter =
332-
OllamaAdapter::new(test_config(&server.url(), "ollama:codellama")).unwrap();
342+
let adapter = OllamaAdapter::new(test_config(&server.url(), "ollama:codellama")).unwrap();
333343
let result = adapter.complete(test_request()).await;
334344

335345
assert!(result.is_ok());
@@ -599,8 +609,7 @@ mod tests {
599609
.create_async()
600610
.await;
601611

602-
let adapter =
603-
OllamaAdapter::new(test_config(&server.url(), "ollama:codellama")).unwrap();
612+
let adapter = OllamaAdapter::new(test_config(&server.url(), "ollama:codellama")).unwrap();
604613
let result = adapter.detect_context_window().await;
605614

606615
assert_eq!(result, Some(8192));
@@ -723,10 +732,7 @@ mod tests {
723732

724733
#[test]
725734
fn test_parse_num_ctx_missing() {
726-
assert_eq!(
727-
parse_num_ctx(Some("temperature 0.8\nstop [INST]")),
728-
None
729-
);
735+
assert_eq!(parse_num_ctx(Some("temperature 0.8\nstop [INST]")), None);
730736
}
731737

732738
#[test]

src/adapters/openai.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ impl OpenAIAdapter {
125125
retry_config,
126126
})
127127
}
128-
129128
}
130129

131130
#[async_trait]

src/commands/doctor.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ pub async fn doctor_command(config: Config) -> Result<()> {
4343

4444
// Endpoint reachability
4545
print!("Checking endpoint {}... ", base_url);
46-
let client = Client::builder()
47-
.timeout(Duration::from_secs(5))
48-
.build()?;
46+
let client = Client::builder().timeout(Duration::from_secs(5)).build()?;
4947

5048
// Try Ollama /api/tags first
5149
let ollama_url = format!("{}/api/tags", base_url);
@@ -136,7 +134,10 @@ pub async fn doctor_command(config: Config) -> Result<()> {
136134
if let Some(ctx_size) =
137135
detect_model_context_window(&client, &base_url, &recommended.name).await
138136
{
139-
println!(" Context window: {} tokens (detected from model)", ctx_size);
137+
println!(
138+
" Context window: {} tokens (detected from model)",
139+
ctx_size
140+
);
140141
}
141142
}
142143

@@ -154,9 +155,7 @@ pub async fn doctor_command(config: Config) -> Result<()> {
154155
// Test inference
155156
let recommended_name = recommended.name.clone();
156157
print!("\nTesting model {}... ", recommended_name);
157-
let test_client = Client::builder()
158-
.timeout(Duration::from_secs(10))
159-
.build()?;
158+
let test_client = Client::builder().timeout(Duration::from_secs(10)).build()?;
160159
let test_start = std::time::Instant::now();
161160
let test_result =
162161
test_model_inference(&test_client, &base_url, &recommended_name, endpoint_type)
@@ -165,8 +164,7 @@ pub async fn doctor_command(config: Config) -> Result<()> {
165164

166165
match test_result {
167166
Ok(response) => {
168-
let tokens_per_sec =
169-
estimate_tokens(&response) as f64 / elapsed.as_secs_f64();
167+
let tokens_per_sec = estimate_tokens(&response) as f64 / elapsed.as_secs_f64();
170168
println!(
171169
"OK ({:.1}s, ~{:.0} tok/s)",
172170
elapsed.as_secs_f64(),
@@ -369,7 +367,10 @@ fn check_system_resources() {
369367
let cpu = String::from_utf8_lossy(&output.stdout);
370368
let cpu = cpu.trim();
371369
if cpu.contains("Apple") {
372-
println!(" Chip: {} (unified memory, GPU acceleration available)", cpu);
370+
println!(
371+
" Chip: {} (unified memory, GPU acceleration available)",
372+
cpu
373+
);
373374
}
374375
}
375376
}
@@ -592,7 +593,8 @@ mod tests {
592593
#[tokio::test]
593594
async fn test_detect_context_window_from_parameters() {
594595
// Simulate Ollama /api/show response with parameters field
595-
let json = r#"{"parameters":"stop [INST]\nstop [/INST]\nnum_ctx 4096\nrepeat_penalty 1.1"}"#;
596+
let json =
597+
r#"{"parameters":"stop [INST]\nstop [/INST]\nnum_ctx 4096\nrepeat_penalty 1.1"}"#;
596598
let value: serde_json::Value = serde_json::from_str(json).unwrap();
597599
let mut result = None;
598600
if let Some(params) = value.get("parameters").and_then(|p| p.as_str()) {

src/commands/eval.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,21 @@ impl EvalPattern {
779779
}
780780

781781
if let Some(severity) = &self.severity {
782-
if !comment.severity.to_string().eq_ignore_ascii_case(severity.trim()) {
782+
if !comment
783+
.severity
784+
.to_string()
785+
.eq_ignore_ascii_case(severity.trim())
786+
{
783787
return false;
784788
}
785789
}
786790

787791
if let Some(category) = &self.category {
788-
if !comment.category.to_string().eq_ignore_ascii_case(category.trim()) {
792+
if !comment
793+
.category
794+
.to_string()
795+
.eq_ignore_ascii_case(category.trim())
796+
{
789797
return false;
790798
}
791799
}

src/commands/misc.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,7 @@ pub async fn feedback_command(
211211
Ok(())
212212
}
213213

214-
fn apply_feedback_accept(
215-
store: &mut review::FeedbackStore,
216-
comments: &[core::Comment],
217-
) -> usize {
214+
fn apply_feedback_accept(store: &mut review::FeedbackStore, comments: &[core::Comment]) -> usize {
218215
let mut updated = 0;
219216
for comment in comments {
220217
let is_new = store.accept.insert(comment.id.clone());
@@ -229,10 +226,7 @@ fn apply_feedback_accept(
229226
updated
230227
}
231228

232-
fn apply_feedback_reject(
233-
store: &mut review::FeedbackStore,
234-
comments: &[core::Comment],
235-
) -> usize {
229+
fn apply_feedback_reject(store: &mut review::FeedbackStore, comments: &[core::Comment]) -> usize {
236230
let mut updated = 0;
237231
for comment in comments {
238232
let is_new = store.suppress.insert(comment.id.clone());
@@ -428,7 +422,9 @@ mod tests {
428422
apply_feedback_accept(&mut store, &comments);
429423
}
430424

431-
let key = review::classify_comment_type(&comments[0]).as_str().to_string();
425+
let key = review::classify_comment_type(&comments[0])
426+
.as_str()
427+
.to_string();
432428
let stats = &store.by_comment_type[&key];
433429
assert_eq!(
434430
stats.accepted, 1,

src/commands/mod.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
mod review;
2-
mod smart_review;
3-
mod git;
4-
mod pr;
1+
mod doctor;
52
mod eval;
3+
mod git;
64
mod misc;
7-
mod doctor;
5+
mod pr;
6+
mod review;
7+
mod smart_review;
88

9-
pub use review::{review_command, check_command, compare_command};
10-
pub use smart_review::smart_review_command;
9+
pub use doctor::doctor_command;
10+
pub use eval::{eval_command, EvalRunOptions};
1111
pub use git::{git_command, GitCommands};
12+
pub use misc::{changelog_command, discuss_command, feedback_command, lsp_check_command};
1213
pub use pr::pr_command;
13-
pub use eval::{eval_command, EvalRunOptions};
14-
pub use misc::{
15-
changelog_command, feedback_command, discuss_command, lsp_check_command,
16-
};
17-
pub use doctor::doctor_command;
14+
pub use review::{check_command, compare_command, review_command};
15+
pub use smart_review::smart_review_command;

src/commands/pr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ pub async fn pr_command(
9999
return Ok(());
100100
}
101101

102-
let comments = review::review_diff_content_raw(&diff_content, config.clone(), &repo_root).await?;
102+
let comments =
103+
review::review_diff_content_raw(&diff_content, config.clone(), &repo_root).await?;
103104

104105
if post_comments {
105106
info!("Posting {} comments to PR", comments.len());

0 commit comments

Comments
 (0)