fix: apply rustfmt formatting to git dates code
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -218,10 +218,7 @@ notes/daily.md
|
||||
// So modified_at > created_at (or equal if commits are same second)
|
||||
assert!(map["first.md"].modified_at >= map["first.md"].created_at);
|
||||
// second.md: only in commit 2
|
||||
assert_eq!(
|
||||
map["second.md"].modified_at,
|
||||
map["second.md"].created_at
|
||||
);
|
||||
assert_eq!(map["second.md"].modified_at, map["second.md"].created_at);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -503,7 +503,8 @@ mod tests {
|
||||
let vault_path = dir.path().join("parse-vault");
|
||||
create_getting_started_vault(vault_path.to_str().unwrap()).unwrap();
|
||||
|
||||
let entries = crate::vault::scan_vault(&vault_path, &std::collections::HashMap::new()).unwrap();
|
||||
let entries =
|
||||
crate::vault::scan_vault(&vault_path, &std::collections::HashMap::new()).unwrap();
|
||||
// SAMPLE_FILES + AGENTS.md
|
||||
assert_eq!(entries.len(), SAMPLE_FILES.len() + 1);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,7 @@ use walkdir::WalkDir;
|
||||
/// If `git_dates` is provided, those timestamps override filesystem metadata
|
||||
/// for `modified_at` and `created_at`. Pass `None` to use filesystem dates
|
||||
/// (appropriate for newly-saved files not yet committed, or non-git vaults).
|
||||
pub fn parse_md_file(
|
||||
path: &Path,
|
||||
git_dates: Option<(u64, u64)>,
|
||||
) -> Result<VaultEntry, String> {
|
||||
pub fn parse_md_file(path: &Path, git_dates: Option<(u64, u64)>) -> Result<VaultEntry, String> {
|
||||
let content = fs::read_to_string(path)
|
||||
.map_err(|e| format!("Failed to read {}: {}", path.display(), e))?;
|
||||
let filename = path
|
||||
@@ -154,9 +151,7 @@ fn lookup_git_dates(
|
||||
.ok()?
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
git_dates
|
||||
.get(&rel)
|
||||
.map(|d| (d.modified_at, d.created_at))
|
||||
git_dates.get(&rel).map(|d| (d.modified_at, d.created_at))
|
||||
}
|
||||
|
||||
fn try_parse_md(
|
||||
|
||||
@@ -196,7 +196,10 @@ fn test_scan_vault_skips_hidden_folders() {
|
||||
|
||||
#[test]
|
||||
fn test_scan_vault_nonexistent_path() {
|
||||
let result = scan_vault(Path::new("/nonexistent/path/that/does/not/exist"), &HashMap::new());
|
||||
let result = scan_vault(
|
||||
Path::new("/nonexistent/path/that/does/not/exist"),
|
||||
&HashMap::new(),
|
||||
);
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user