Eliminate unuseful block reads/writes.

This commit is contained in:
Yifan Wu 2020-12-19 16:34:18 +08:00
parent 3c1419185d
commit 015a8b6407
2 changed files with 55 additions and 14 deletions

View file

@ -38,7 +38,7 @@ impl<T> Dirty<T> where T: Sized {
pub fn read<V>(&self, f: impl FnOnce(&T) -> V) -> V {
f(self.get_ref())
}
pub fn modify(&mut self, f: impl FnOnce(&mut T)) {
f(self.get_mut());
pub fn modify<V>(&mut self, f: impl FnOnce(&mut T) -> V) -> V {
f(self.get_mut())
}
}