style: cargo fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-04-06 13:25:06 +02:00
parent d284befd5f
commit 6762c5cec8
3 changed files with 20 additions and 6 deletions

View File

@@ -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);
}

View File

@@ -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"
);
}

View File

@@ -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,