Skip to content

Commit

Permalink
refactor(cache): Pretty print JSON to cache files for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
klausi committed May 17, 2020
1 parent 323652a commit 7ba0bf9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn load_dates_from_cache(cache_file: &str) -> Result<Option<BTreeMap<DateTim
}

pub fn save_dates_to_cache(cache_file: &str, dates: &BTreeMap<DateTime<Utc>, u64>) -> Result<()> {
let json = serde_json::to_string(&dates)?;
let json = serde_json::to_string_pretty(&dates)?;
fs::write(cache_file, json.as_bytes())?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async fn run() -> Result<()> {

// Write out the cache file if necessary.
if !args.dry_run && cache_changed {
let json = serde_json::to_string(&post_cache)?;
let json = serde_json::to_string_pretty(&post_cache)?;
fs::write(post_cache_file, json.as_bytes())?;
}

Expand Down

0 comments on commit 7ba0bf9

Please sign in to comment.