Skip to content

Commit d51bd54

Browse files
committed
fix: remove old watching (path, mode) so insert can update the key
1 parent be14c5c commit d51bd54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/session/depot.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ impl Depot {
180180
}
181181
} else {
182182
// Overwrite old paths as they could be invalidated after reply.
183-
let count = self.watching_paths.get(&(path, mode)).copied().unwrap_or(0) + 1;
183+
// `HashMap::insert` does not update the key in case it is present, so we have to remove it first.
184+
let count = self.watching_paths.remove(&(path, mode)).unwrap_or(0) + 1;
184185
self.watching_paths.insert((path, mode), count);
185186
}
186187
}

0 commit comments

Comments
 (0)