style: rustfmt formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -676,7 +676,11 @@ mod tests {
|
||||
let (_lock, _cache_tmp, dir) = setup_git_vault();
|
||||
let vault = dir.path();
|
||||
|
||||
create_test_file(vault, "existing.md", "---\ntitle: Existing\n---\n# Existing\n");
|
||||
create_test_file(
|
||||
vault,
|
||||
"existing.md",
|
||||
"---\ntitle: Existing\n---\n# Existing\n",
|
||||
);
|
||||
git_add_commit(vault, "init");
|
||||
|
||||
// Prime cache
|
||||
|
||||
@@ -326,10 +326,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_extract_title_fallback_to_filename() {
|
||||
assert_eq!(
|
||||
extract_title(None, "fallback-title.md"),
|
||||
"Fallback Title"
|
||||
);
|
||||
assert_eq!(extract_title(None, "fallback-title.md"), "Fallback Title");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -42,8 +42,8 @@ fn extract_raw_title(content: &str) -> Option<String> {
|
||||
/// - If `title` is present but its slug doesn't match the filename stem → overwrite
|
||||
/// - If both are in sync → no-op
|
||||
pub fn sync_title_on_open(path: &Path) -> Result<SyncAction, String> {
|
||||
let content =
|
||||
fs::read_to_string(path).map_err(|e| format!("Failed to read {}: {}", path.display(), e))?;
|
||||
let content = fs::read_to_string(path)
|
||||
.map_err(|e| format!("Failed to read {}: {}", path.display(), e))?;
|
||||
let filename = path
|
||||
.file_name()
|
||||
.map(|f| f.to_string_lossy().to_string())
|
||||
@@ -136,7 +136,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_sync_adds_frontmatter_when_none_exists() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let path = write_note(dir.path(), "plain-note.md", "# Plain Note\n\nSome content.\n");
|
||||
let path = write_note(
|
||||
dir.path(),
|
||||
"plain-note.md",
|
||||
"# Plain Note\n\nSome content.\n",
|
||||
);
|
||||
let result = sync_title_on_open(&path).unwrap();
|
||||
assert_eq!(
|
||||
result,
|
||||
|
||||
Reference in New Issue
Block a user