Skip to content

Commit

Permalink
Fix bug in Stats::update()
Browse files Browse the repository at this point in the history
Files where no replacement take place should not
contribute to the stats
  • Loading branch information
dmerejkowsky committed Feb 28, 2022
1 parent 5cca234 commit 1385585
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub struct Stats {

impl Stats {
pub(crate) fn update(&mut self, lines: usize, replacements: usize) {
if replacements == 0 {
return;
}
self.matching_files += 1;
self.matching_lines += lines;
self.total_replacements += replacements;
Expand Down

0 comments on commit 1385585

Please sign in to comment.