From 986a6fb81aaf67f0447d36048ac0970d563e45d9 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:14:40 +0000 Subject: [PATCH] fix: apply cargo clippy fixes - Remove unused import (tauri::Manager) - Remove unnecessary reference conversion (&distinct_id.to_string() -> distinct_id) - Collapse nested if-let chains into combined let-chains - Remove unnecessary lifetime annotations - Exclude plugins/cli2 from workspace (missing Cargo.toml) Co-Authored-By: unknown <> --- Cargo.toml | 1 + apps/desktop/src-tauri/src/lib.rs | 1 - crates/analytics/src/posthog.rs | 2 +- crates/tiptap/src/from_ast.rs | 8 +++----- .../v1_0_2_nightly_14_extract_from_sqlite.rs | 7 +++---- .../fs-db/src/migrations/v1_0_2_nightly_1_from_v0.rs | 7 +++---- plugins/fs-db/src/version/macro.rs | 11 ++++------- plugins/listener/src/actors/recorder.rs | 5 ++--- 8 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fa5a7b3730..8b654a0a24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ exclude = [ "apps/api", "apps/bot", "apps/web", + "plugins/cli2", "plugins/db", "plugins/export", ] diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index 76a0c104f7..2b13faf0c4 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -8,7 +8,6 @@ mod supervisor; use ext::*; use store::*; -use tauri::Manager; use tauri_plugin_permissions::{Permission, PermissionsPluginExt}; use tauri_plugin_windows::{AppWindow, WindowsPluginExt}; diff --git a/crates/analytics/src/posthog.rs b/crates/analytics/src/posthog.rs index 090c237a10..8dfa43b212 100644 --- a/crates/analytics/src/posthog.rs +++ b/crates/analytics/src/posthog.rs @@ -42,7 +42,7 @@ impl PosthogClient { distinct_id: &str, payload: &PropertiesPayload, ) -> Result<(), Error> { - let mut e = Event::new("$set", &distinct_id.to_string()); + let mut e = Event::new("$set", distinct_id); e.set_timestamp(chrono::Utc::now().naive_utc()); if !payload.set.is_empty() { diff --git a/crates/tiptap/src/from_ast.rs b/crates/tiptap/src/from_ast.rs index 18dc9e6c0f..029b794e86 100644 --- a/crates/tiptap/src/from_ast.rs +++ b/crates/tiptap/src/from_ast.rs @@ -21,15 +21,13 @@ fn unescape_markdown(md: &str) -> String { let mut chars = md.chars().peekable(); while let Some(c) = chars.next() { - if c == '\\' { - if let Some(&next) = chars.peek() { - if is_markdown_escapable(next) { + if c == '\\' + && let Some(&next) = chars.peek() + && is_markdown_escapable(next) { result.push(next); chars.next(); continue; } - } - } result.push(c); } diff --git a/plugins/fs-db/src/migrations/v1_0_2_nightly_14_extract_from_sqlite.rs b/plugins/fs-db/src/migrations/v1_0_2_nightly_14_extract_from_sqlite.rs index f5b286e11a..3df7083f9c 100644 --- a/plugins/fs-db/src/migrations/v1_0_2_nightly_14_extract_from_sqlite.rs +++ b/plugins/fs-db/src/migrations/v1_0_2_nightly_14_extract_from_sqlite.rs @@ -37,7 +37,7 @@ fn sanitize_filename(name: &str) -> String { .to_string() } -fn group_by_session_id<'a, T, F>(items: &'a [T], get_id: F) -> HashMap<&'a str, Vec<&'a T>> +fn group_by_session_id(items: &[T], get_id: F) -> HashMap<&str, Vec<&T>> where F: Fn(&T) -> &str, { @@ -138,14 +138,13 @@ fn collect_session_ops(base_dir: &Path, data: &Collection) -> Result }); // transcript.json (if exists) - if let Some(transcripts) = transcripts.get(sid) { - if let Some(t) = transcripts.first() { + if let Some(transcripts) = transcripts.get(sid) + && let Some(t) = transcripts.first() { ops.push(FileOp::Write { path: dir.join(files::TRANSCRIPT), content: build_transcript_json(t), }); } - } // _memo.md (if user has notes) ops.extend(build_memo_op(&dir, session)); diff --git a/plugins/fs-db/src/migrations/v1_0_2_nightly_1_from_v0.rs b/plugins/fs-db/src/migrations/v1_0_2_nightly_1_from_v0.rs index 9465ab5ea1..32fcd1f42f 100644 --- a/plugins/fs-db/src/migrations/v1_0_2_nightly_1_from_v0.rs +++ b/plugins/fs-db/src/migrations/v1_0_2_nightly_1_from_v0.rs @@ -32,7 +32,7 @@ fn sanitize_filename(name: &str) -> String { .to_string() } -fn group_by_session_id<'a, T, F>(items: &'a [T], get_id: F) -> HashMap<&'a str, Vec<&'a T>> +fn group_by_session_id(items: &[T], get_id: F) -> HashMap<&str, Vec<&T>> where F: Fn(&T) -> &str, { @@ -135,14 +135,13 @@ fn collect_session_ops(base_dir: &Path, data: &Collection) -> Result content: build_meta_json(session, session_participants, &session_tags), }); - if let Some(transcripts) = transcripts.get(sid) { - if let Some(t) = transcripts.first() { + if let Some(transcripts) = transcripts.get(sid) + && let Some(t) = transcripts.first() { ops.push(FileOp::Write { path: dir.join(files::TRANSCRIPT), content: build_transcript_json(t), }); } - } ops.extend(build_memo_op(&dir, session)); diff --git a/plugins/fs-db/src/version/macro.rs b/plugins/fs-db/src/version/macro.rs index 54e8169ad3..f9fbc12f24 100644 --- a/plugins/fs-db/src/version/macro.rs +++ b/plugins/fs-db/src/version/macro.rs @@ -24,15 +24,12 @@ pub fn parse(name: &str) -> Version { let mut version_str = format!("{major}.{minor}.{patch}"); - if let Some(&tag) = parts.get(3) { - if PRERELEASE_TAGS.contains(&tag) { - if let Some(&num) = parts.get(4) { - if num.chars().all(|c| c.is_ascii_digit()) { + if let Some(&tag) = parts.get(3) + && PRERELEASE_TAGS.contains(&tag) + && let Some(&num) = parts.get(4) + && num.chars().all(|c| c.is_ascii_digit()) { version_str.push_str(&format!("-{tag}.{num}")); } - } - } - } version_str.parse().unwrap() } diff --git a/plugins/listener/src/actors/recorder.rs b/plugins/listener/src/actors/recorder.rs index 7e0f30ad22..eb965cd9b3 100644 --- a/plugins/listener/src/actors/recorder.rs +++ b/plugins/listener/src/actors/recorder.rs @@ -275,9 +275,8 @@ fn sync_file(path: &std::path::Path) { } fn sync_dir(path: &std::path::Path) { - if let Some(parent) = path.parent() { - if let Ok(dir) = File::open(parent) { + if let Some(parent) = path.parent() + && let Ok(dir) = File::open(parent) { let _ = dir.sync_all(); } - } }