Skip to content

Commit 098b297

Browse files
committed
fix lint warnings
1 parent e5e2e52 commit 098b297

File tree

9 files changed

+63
-52
lines changed

9 files changed

+63
-52
lines changed

src/commands/checkpoint_agent/agent_preset.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ impl CursorPreset {
693693
Ok(None)
694694
}
695695

696-
fn explore_database_for_model_info(
696+
fn _explore_database_for_model_info(
697697
global_db_path: &Path,
698698
composer_id: &str,
699699
) -> Result<(), GitAiError> {
@@ -807,7 +807,7 @@ impl CursorPreset {
807807
// Check toolFormerData for model information
808808
if let Some(tool_former_data) = bubble_content.get("toolFormerData") {
809809
// Look for model information in the toolFormerData
810-
if let Some(model_call_id) = tool_former_data.get("modelCallId") {
810+
if let Some(_model_call_id) = tool_former_data.get("modelCallId") {
811811
// The presence of modelCallId suggests this is an AI interaction
812812
// We can infer the model from other context or use a default
813813
return Ok("claude-3.5-sonnet".to_string()); // Default for Cursor AI interactions

src/commands/install_hooks.rs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::GitAiError;
22
use indicatif::{ProgressBar, ProgressStyle};
3-
use serde_json::{json, Value};
3+
use serde_json::{Value, json};
44
use std::fs;
55
use std::io::Write;
66
use std::path::{Path, PathBuf};
@@ -50,7 +50,7 @@ fn check_claude_code() -> bool {
5050

5151
// Sometimes the binary won't be in the PATH, but the dotfiles will be
5252
let home = std::env::var("HOME").unwrap_or_else(|_| ".".to_string());
53-
return Path::new(&home).join(".claude").exists()
53+
return Path::new(&home).join(".claude").exists();
5454
}
5555

5656
fn check_cursor() -> bool {
@@ -63,7 +63,7 @@ fn check_cursor() -> bool {
6363

6464
// Sometimes the binary won't be in the PATH, but the dotfiles will be
6565
let home = std::env::var("HOME").unwrap_or_else(|_| ".".to_string());
66-
return Path::new(&home).join(".cursor").exists()
66+
return Path::new(&home).join(".cursor").exists();
6767
}
6868

6969
// Shared utilities
@@ -190,10 +190,7 @@ fn install_cursor_hooks() -> Result<(), GitAiError> {
190190
}
191191

192192
// Merge hooks object
193-
let mut hooks_obj = merged
194-
.get("hooks")
195-
.cloned()
196-
.unwrap_or_else(|| json!({}));
193+
let mut hooks_obj = merged.get("hooks").cloned().unwrap_or_else(|| json!({}));
197194

198195
// AfterEdit desired entries
199196
let desired_after = desired
@@ -245,13 +242,18 @@ fn install_cursor_hooks() -> Result<(), GitAiError> {
245242

246243
fn merge_hooks(existing: Option<&Value>, desired: Option<&Value>) -> Option<Value> {
247244
let mut result = existing.cloned().unwrap_or_else(|| json!({}));
248-
let desired = match desired { Some(v) => v, None => return Some(result) };
245+
let desired = match desired {
246+
Some(v) => v,
247+
None => return Some(result),
248+
};
249249

250250
// Merge arrays by matcher for PreToolUse and PostToolUse. Append missing hooks, avoid duplicates.
251251
if let Some(obj) = result.as_object_mut() {
252252
for key in ["PreToolUse", "PostToolUse"].iter() {
253253
let desired_arr = desired.get(*key).and_then(|v| v.as_array());
254-
if desired_arr.is_none() { continue; }
254+
if desired_arr.is_none() {
255+
continue;
256+
}
255257
let desired_arr = desired_arr.unwrap();
256258

257259
let mut existing_arr = obj
@@ -271,7 +273,9 @@ fn merge_hooks(existing: Option<&Value>, desired: Option<&Value>) -> Option<Valu
271273

272274
for desired_item in desired_arr {
273275
let desired_matcher = desired_item.get("matcher").and_then(|m| m.as_str());
274-
if desired_matcher.is_none() { continue; }
276+
if desired_matcher.is_none() {
277+
continue;
278+
}
275279
let desired_matcher = desired_matcher.unwrap();
276280

277281
// Find or create the block for this matcher
@@ -297,10 +301,15 @@ fn merge_hooks(existing: Option<&Value>, desired: Option<&Value>) -> Option<Valu
297301
if let Some(desired_hooks) = desired_hooks {
298302
for d in desired_hooks {
299303
let duplicate = target_hooks.iter().any(|e| {
300-
if e == d { return true; }
304+
if e == d {
305+
return true;
306+
}
301307
let dc = d.get("command").and_then(|c| c.as_str());
302308
let ec = e.get("command").and_then(|c| c.as_str());
303-
match (dc, ec) { (Some(a), Some(b)) => a == b, _ => false }
309+
match (dc, ec) {
310+
(Some(a), Some(b)) => a == b,
311+
_ => false,
312+
}
304313
});
305314
if !duplicate {
306315
target_hooks.push(d.clone());
@@ -370,11 +379,11 @@ impl Spinner {
370379
// Spinner starts automatically when created
371380
}
372381

373-
fn update_message(&self, message: &str) {
382+
fn _update_message(&self, message: &str) {
374383
self.pb.set_message(message.to_string());
375384
}
376385

377-
async fn wait_for(&self, duration_ms: u64) {
386+
async fn _wait_for(&self, duration_ms: u64) {
378387
smol::Timer::after(std::time::Duration::from_millis(duration_ms)).await;
379388
}
380389

src/log_fmt/authorship_log_serialization.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl AuthorshipLog {
119119
}
120120

121121
/// Merge overlapping and adjacent line ranges
122-
fn merge_line_ranges(ranges: &[LineRange]) -> Vec<LineRange> {
122+
fn _merge_line_ranges(ranges: &[LineRange]) -> Vec<LineRange> {
123123
if ranges.is_empty() {
124124
return Vec::new();
125125
}
@@ -140,8 +140,8 @@ impl AuthorshipLog {
140140
let mut merged = Vec::new();
141141
for current in sorted_ranges {
142142
if let Some(last) = merged.last_mut() {
143-
if Self::ranges_can_merge(last, &current) {
144-
*last = Self::merge_ranges(last, &current);
143+
if Self::_ranges_can_merge(last, &current) {
144+
*last = Self::_merge_ranges(last, &current);
145145
} else {
146146
merged.push(current);
147147
}
@@ -154,7 +154,7 @@ impl AuthorshipLog {
154154
}
155155

156156
/// Check if two ranges can be merged (overlapping or adjacent)
157-
fn ranges_can_merge(range1: &LineRange, range2: &LineRange) -> bool {
157+
fn _ranges_can_merge(range1: &LineRange, range2: &LineRange) -> bool {
158158
let (start1, end1) = match range1 {
159159
LineRange::Single(line) => (*line, *line),
160160
LineRange::Range(start, end) => (*start, *end),
@@ -169,7 +169,7 @@ impl AuthorshipLog {
169169
}
170170

171171
/// Merge two ranges into one
172-
fn merge_ranges(range1: &LineRange, range2: &LineRange) -> LineRange {
172+
fn _merge_ranges(range1: &LineRange, range2: &LineRange) -> LineRange {
173173
let (start1, end1) = match range1 {
174174
LineRange::Single(line) => (*line, *line),
175175
LineRange::Range(start, end) => (*start, *end),
@@ -344,7 +344,7 @@ impl AuthorshipLog {
344344
}
345345

346346
/// Write to a writer in the new format
347-
pub fn serialize_to_writer<W: Write>(&self, mut writer: W) -> std::io::Result<()> {
347+
pub fn _serialize_to_writer<W: Write>(&self, mut writer: W) -> std::io::Result<()> {
348348
let content = self
349349
.serialize_to_string()
350350
.map_err(|_| std::io::Error::new(std::io::ErrorKind::Other, "Serialization failed"))?;
@@ -378,7 +378,7 @@ impl AuthorshipLog {
378378
}
379379

380380
/// Read from a reader in the new format
381-
pub fn deserialize_from_reader<R: BufRead>(
381+
pub fn _deserialize_from_reader<R: BufRead>(
382382
reader: R,
383383
) -> Result<Self, Box<dyn std::error::Error>> {
384384
let content: Result<String, _> = reader.lines().collect();

src/log_fmt/transcript.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl AiTranscript {
190190
}
191191

192192
/// Parse a Claude Code JSONL file into a transcript
193-
pub fn from_claude_code_jsonl(jsonl_content: &str) -> Result<Self, serde_json::Error> {
193+
pub fn _from_claude_code_jsonl(jsonl_content: &str) -> Result<Self, serde_json::Error> {
194194
let mut transcript = AiTranscript::new();
195195

196196
for line in jsonl_content.lines() {
@@ -299,7 +299,7 @@ mod tests {
299299
.expect("Failed to read example JSONL file");
300300

301301
let transcript =
302-
AiTranscript::from_claude_code_jsonl(&jsonl_content).expect("Failed to parse JSONL");
302+
AiTranscript::_from_claude_code_jsonl(&jsonl_content).expect("Failed to parse JSONL");
303303

304304
// Verify we parsed some messages
305305
assert!(!transcript.messages().is_empty());

src/main.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
mod commands;
2+
mod config;
23
mod error;
34
mod git;
45
mod log_fmt;
56
mod utils;
6-
mod config;
7-
87

98
use clap::Parser;
109
use git::find_repository;
@@ -134,7 +133,7 @@ fn handle_checkpoint(args: &[String]) {
134133
let mut reset = false;
135134
let mut model = None;
136135
let mut _prompt_json = None;
137-
let mut prompt_path = None;
136+
let mut _prompt_path = None;
138137
let mut prompt_id = None;
139138
let mut hook_input = None;
140139

@@ -178,7 +177,7 @@ fn handle_checkpoint(args: &[String]) {
178177
}
179178
"--prompt-path" => {
180179
if i + 1 < args.len() {
181-
prompt_path = Some(args[i + 1].clone());
180+
_prompt_path = Some(args[i + 1].clone());
182181
i += 2;
183182
} else {
184183
eprintln!("Error: --prompt-path requires a value");
@@ -506,7 +505,9 @@ fn handle_push(args: &[String]) {
506505

507506
// Helper to run a git command and optionally forward output, returning exit code
508507
fn run_git_and_forward(args: &[String], quiet: bool) -> i32 {
509-
let output = Command::new(config::Config::get().git_cmd()).args(args).output();
508+
let output = Command::new(config::Config::get().git_cmd())
509+
.args(args)
510+
.output();
510511
match output {
511512
Ok(output) => {
512513
if !quiet {
@@ -599,7 +600,9 @@ fn get_default_remote(repo: &git2::Repository) -> Option<String> {
599600

600601
fn proxy_to_git(args: &[String]) {
601602
// Use spawn for interactive commands
602-
let child = Command::new(config::Config::get().git_cmd()).args(args).spawn();
603+
let child = Command::new(config::Config::get().git_cmd())
604+
.args(args)
605+
.spawn();
603606

604607
match child {
605608
Ok(mut child) => {

src/tmp_repo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl TmpRepo {
380380
// Run the post-commit hook for all commits (including initial commit)
381381
let post_commit_result = post_commit(&self.repo, false)?; // false = not force
382382

383-
Ok((post_commit_result.1))
383+
Ok(post_commit_result.1)
384384
}
385385

386386
/// Creates a new branch and switches to it

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn debug_log(msg: &str) {
2424
/// * `diff` - The git diff object to print
2525
/// * `old_label` - Label for the "old" side (e.g., commit SHA or description)
2626
/// * `new_label` - Label for the "new" side (e.g., commit SHA or description)
27-
pub fn print_diff(diff: &Diff, old_label: &str, new_label: &str) {
27+
pub fn _print_diff(diff: &Diff, old_label: &str, new_label: &str) {
2828
println!("Diff between {} and {}:", old_label, new_label);
2929

3030
let mut file_count = 0;

0 commit comments

Comments
 (0)