aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_daemon/components
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-13 01:36:41 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-13 01:36:41 +0200
commit47b76481e51451827530714512b30882d85e3a9a (patch)
tree3e64edfa304e11e4dff506683dd0a7ea7929123e /crates/turtle/src/atuin_daemon/components
parentchore(treewide): Fix some of `clippy`'s error (diff)
downloadatuin-47b76481e51451827530714512b30882d85e3a9a.zip
chore(treewide): Also fix all `clippy` warnings
Diffstat (limited to 'crates/turtle/src/atuin_daemon/components')
-rw-r--r--crates/turtle/src/atuin_daemon/components/search.rs23
-rw-r--r--crates/turtle/src/atuin_daemon/components/semantic.rs8
-rw-r--r--crates/turtle/src/atuin_daemon/components/sync.rs1
3 files changed, 18 insertions, 14 deletions
diff --git a/crates/turtle/src/atuin_daemon/components/search.rs b/crates/turtle/src/atuin_daemon/components/search.rs
index bcb18865..bcd60cc4 100644
--- a/crates/turtle/src/atuin_daemon/components/search.rs
+++ b/crates/turtle/src/atuin_daemon/components/search.rs
@@ -60,6 +60,7 @@ impl SearchComponent {
}
/// Rebuild the entire search index from the database.
+ #[expect(clippy::significant_drop_tightening, reason = "false positive")]
async fn rebuild_index(&self) -> Result<()> {
let handle_guard = self.handle.read().await;
let handle = handle_guard
@@ -114,6 +115,7 @@ impl Component for SearchComponent {
"search"
}
+ #[expect(clippy::significant_drop_tightening, reason = "false positive")]
async fn start(&mut self, handle: DaemonHandle) -> Result<()> {
*self.handle.write().await = Some(handle.clone());
@@ -179,6 +181,7 @@ impl Component for SearchComponent {
Ok(())
}
+ #[expect(clippy::significant_drop_tightening, reason = "false positive")]
async fn handle_event(&mut self, event: &DaemonEvent) -> Result<()> {
match event {
DaemonEvent::RecordsAdded(records) => {
@@ -314,7 +317,7 @@ impl SearchSvc for SearchGrpcService {
);
// Convert proto FilterMode + context to IndexFilterMode
- let index_filter = convert_filter_mode(filter_mode, &proto_context);
+ let index_filter = convert_filter_mode(filter_mode, proto_context.as_ref());
// Build QueryContext from proto context
let query_context = proto_context
@@ -368,21 +371,21 @@ impl SearchSvc for SearchGrpcService {
/// Convert proto `FilterMode` and context to `IndexFilterMode`.
fn convert_filter_mode(
mode: FilterMode,
- context: &Option<search::SearchContext>,
+ context: Option<&search::SearchContext>,
) -> IndexFilterMode {
+ #[expect(
+ clippy::match_same_arms,
+ reason = "wildcard pattern used in second one"
+ )]
match (mode, context) {
(FilterMode::Global, _) => IndexFilterMode::Global,
(FilterMode::Directory, Some(ctx)) => {
IndexFilterMode::Directory(with_trailing_slash(&ctx.cwd))
}
- (FilterMode::Workspace, Some(ctx)) => {
- if let Some(ref git_root) = ctx.git_root {
- IndexFilterMode::Workspace(with_trailing_slash(git_root))
- } else {
- // Fall back to directory if no git root
- IndexFilterMode::Directory(with_trailing_slash(&ctx.cwd))
- }
- }
+ (FilterMode::Workspace, Some(ctx)) => ctx.git_root.as_ref().map_or_else(
+ || IndexFilterMode::Directory(with_trailing_slash(&ctx.cwd)),
+ |git_root| IndexFilterMode::Workspace(with_trailing_slash(git_root)),
+ ),
(FilterMode::Host, Some(ctx)) => IndexFilterMode::Host(ctx.hostname.clone()),
(FilterMode::Session, Some(ctx)) => IndexFilterMode::Session(ctx.session_id.clone()),
(FilterMode::SessionPreload, Some(ctx)) => {
diff --git a/crates/turtle/src/atuin_daemon/components/semantic.rs b/crates/turtle/src/atuin_daemon/components/semantic.rs
index 69ffc134..e1d376de 100644
--- a/crates/turtle/src/atuin_daemon/components/semantic.rs
+++ b/crates/turtle/src/atuin_daemon/components/semantic.rs
@@ -197,7 +197,7 @@ impl SemanticState {
let record = SemanticCommandRecord { capture, history };
log_record(&record, "recorded semantic command capture");
- self.push_record(session_id, history_id, record);
+ self.push_record(&session_id, history_id, record);
true
}
@@ -271,11 +271,11 @@ impl SemanticState {
fn push_record(
&mut self,
- session_id: SessionId,
+ session_id: &SessionId,
history_id: HistoryId,
record: SemanticCommandRecord,
) {
- self.touch_session(&session_id);
+ self.touch_session(session_id);
let (capture_id, evicted) = {
let session = self.sessions.entry(session_id.clone()).or_default();
@@ -290,7 +290,7 @@ impl SemanticState {
for evicted in evicted {
self.remove_history_index_if_matches(
- &session_id,
+ session_id,
&evicted.history_id,
evicted.capture_id,
);
diff --git a/crates/turtle/src/atuin_daemon/components/sync.rs b/crates/turtle/src/atuin_daemon/components/sync.rs
index 933d5ae1..20d49839 100644
--- a/crates/turtle/src/atuin_daemon/components/sync.rs
+++ b/crates/turtle/src/atuin_daemon/components/sync.rs
@@ -112,6 +112,7 @@ impl Component for SyncComponent {
///
/// This runs in a spawned task and handles periodic sync as well as
/// force sync requests.
+#[expect(clippy::significant_drop_tightening, reason = "false positive")]
async fn sync_loop(handle: DaemonHandle, mut cmd_rx: mpsc::Receiver<SyncCommand>) {
tracing::info!("sync loop starting");