Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/path-cli/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub(crate) fn list_cached() -> Result<Vec<CacheEntry>> {
modified: meta.modified().unwrap_or(std::time::SystemTime::UNIX_EPOCH),
});
}
out.sort_by(|a, b| b.modified.cmp(&a.modified));
out.sort_by_key(|e| std::cmp::Reverse(e.modified));
Ok(out)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/path-cli/src/cmd_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ fn pick_claude_global(
metas.extend(ms);
}
}
metas.sort_by(|a, b| b.last_activity.cmp(&a.last_activity));
metas.sort_by_key(|m| std::cmp::Reverse(m.last_activity));
if metas.is_empty() {
return Ok(None);
}
Expand Down Expand Up @@ -782,7 +782,7 @@ fn pick_gemini_global(
metas.extend(ms);
}
}
metas.sort_by(|a, b| b.last_activity.cmp(&a.last_activity));
metas.sort_by_key(|m| std::cmp::Reverse(m.last_activity));
if metas.is_empty() {
return Ok(None);
}
Expand Down
8 changes: 4 additions & 4 deletions crates/path-cli/src/cmd_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ fn list_claude_sessions(
.last_activity
.map(|t| t.format("%Y-%m-%d %H:%M").to_string())
.unwrap_or_else(|| "unknown".to_string());
println!(" {} {:>4} msgs {}", &m.session_id, m.message_count, date);
println!(" {} {:>4} msgs {}", m.session_id, m.message_count, date);
}
}
}
Expand All @@ -395,7 +395,7 @@ fn list_claude_sessions_all(manager: &toolpath_claude::ClaudeConvo, fmt: ListFor
Err(_) => continue, // skip unreadable projects rather than aborting
}
}
all.sort_by(|a, b| b.last_activity.cmp(&a.last_activity));
all.sort_by_key(|s| std::cmp::Reverse(s.last_activity));

match fmt {
ListFormat::Json => {
Expand Down Expand Up @@ -547,7 +547,7 @@ fn list_gemini_sessions(
};
println!(
" {} {:>4} msgs{} {}",
&m.session_uuid, m.message_count, sub, date
m.session_uuid, m.message_count, sub, date
);
}
}
Expand All @@ -568,7 +568,7 @@ fn list_gemini_sessions_all(manager: &toolpath_gemini::GeminiConvo, fmt: ListFor
Err(_) => continue,
}
}
all.sort_by(|a, b| b.last_activity.cmp(&a.last_activity));
all.sort_by_key(|s| std::cmp::Reverse(s.last_activity));

match fmt {
ListFormat::Json => {
Expand Down
2 changes: 1 addition & 1 deletion crates/path-cli/src/sync/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn is_unchanged(rec: Option<&SyncRecord>, artifact: &ArtifactRef) -> bool {
/// spent its time on the sessions the user most likely wants.
fn newest_first(artifacts: &[ArtifactRef]) -> Vec<&ArtifactRef> {
let mut order: Vec<&ArtifactRef> = artifacts.iter().collect();
order.sort_by(|a, b| b.modified.cmp(&a.modified));
order.sort_by_key(|a| std::cmp::Reverse(a.modified));
order
}

Expand Down
6 changes: 5 additions & 1 deletion crates/toolpath-pi/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ pub fn list_session_files(resolver: &PathResolver, project: &str) -> Result<Vec<
.unwrap_or(std::time::UNIX_EPOCH);
entries.push((path, mtime));
}
entries.sort_by(|a, b| b.1.cmp(&a.1));
// Newest first. Reverse() rather than a flipped comparator: clippy 1.95+
// rejects the latter as `unnecessary_sort_by`, and the key form says
// "sort by mtime, descending" without the reader having to work out which
// side of the comparison was swapped.
entries.sort_by_key(|e| std::cmp::Reverse(e.1));
Ok(entries.into_iter().map(|(p, _)| p).collect())
}

Expand Down
Loading