Skip to content

Commit

Permalink
edit: skip out early on no change
Browse files Browse the repository at this point in the history
  • Loading branch information
euank committed Jun 25, 2018
1 parent d427cc4 commit 8a80df7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ pub fn edit(data: &Vec<(String, f64)>) -> Result<PathFrecencyDiff, String> {
tmpf.read_to_string(&mut new_contents)
.map_err(|e| format!("error reading file: {}", e))?;

if new_contents.trim() == serialized_data.trim() {
debug!("identical data read; shortcutting out");
return Ok(PathFrecencyDiff::new(Vec::new(), Vec::new()));
}

let mut new_map = deserialize(&new_contents)?;

let mut removals = Vec::new();
Expand Down

0 comments on commit 8a80df7

Please sign in to comment.