From 6762c5cec857b871cb4dbc0949e4e0b8b8bffb59 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Mon, 6 Apr 2026 13:25:06 +0200 Subject: [PATCH] style: cargo fmt Co-Authored-By: Claude Opus 4.6 (1M context) --- src-tauri/src/vault/getting_started.rs | 5 ++++- src-tauri/src/vault/parsing.rs | 11 +++++++++-- src-tauri/src/vault/rename.rs | 10 +++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/vault/getting_started.rs b/src-tauri/src/vault/getting_started.rs index 4ff0043f..fd0efd7a 100644 --- a/src-tauri/src/vault/getting_started.rs +++ b/src-tauri/src/vault/getting_started.rs @@ -540,7 +540,10 @@ mod tests { let entry = crate::vault::parse_md_file(&vault_path.join("AGENTS.md"), None).unwrap(); // H1 is now the primary title source - assert_eq!(entry.title, "AGENTS.md \u{2014} Vault Instructions for AI Agents"); + assert_eq!( + entry.title, + "AGENTS.md \u{2014} Vault Instructions for AI Agents" + ); // Config files have no frontmatter type field — type is None assert_eq!(entry.is_a, None); } diff --git a/src-tauri/src/vault/parsing.rs b/src-tauri/src/vault/parsing.rs index a053158b..095509dc 100644 --- a/src-tauri/src/vault/parsing.rs +++ b/src-tauri/src/vault/parsing.rs @@ -345,7 +345,10 @@ mod tests { #[test] fn test_extract_h1_title_basic() { - assert_eq!(extract_h1_title("# Hello World\n\nBody."), Some("Hello World".to_string())); + assert_eq!( + extract_h1_title("# Hello World\n\nBody."), + Some("Hello World".to_string()) + ); } #[test] @@ -375,7 +378,11 @@ mod tests { #[test] fn test_extract_title_h1_takes_priority_over_frontmatter() { assert_eq!( - extract_title(Some("FM Title"), "---\ntitle: FM Title\n---\n# H1 Title\n\nBody.", "note.md"), + extract_title( + Some("FM Title"), + "---\ntitle: FM Title\n---\n# H1 Title\n\nBody.", + "note.md" + ), "H1 Title" ); } diff --git a/src-tauri/src/vault/rename.rs b/src-tauri/src/vault/rename.rs index 4a7e49b6..769f3ef0 100644 --- a/src-tauri/src/vault/rename.rs +++ b/src-tauri/src/vault/rename.rs @@ -255,7 +255,11 @@ pub fn rename_note( fn is_untitled_filename(filename: &str) -> bool { let stem = filename.strip_suffix(".md").unwrap_or(filename); // Match: untitled-note-{digits} or untitled-{type}-{digits} - stem.starts_with("untitled-") && stem.rsplit('-').next().is_some_and(|s| s.chars().all(|c| c.is_ascii_digit())) + stem.starts_with("untitled-") + && stem + .rsplit('-') + .next() + .is_some_and(|s| s.chars().all(|c| c.is_ascii_digit())) } /// Auto-rename an untitled note based on its H1 heading. @@ -275,8 +279,8 @@ pub fn auto_rename_untitled( return Ok(None); } - let content = fs::read_to_string(path) - .map_err(|e| format!("Failed to read {}: {}", note_path, e))?; + let content = + fs::read_to_string(path).map_err(|e| format!("Failed to read {}: {}", note_path, e))?; let h1_title = match super::parsing::extract_h1_title(&content) { Some(t) => t,