Simplify undo_to_transaction and redo_to_transaction

We don't need to mutate the history anymore now that we render pending renames
with a block decoration.
This commit is contained in:
Antonio Scandurra
2022-02-19 10:52:21 +01:00
parent b573a39cbc
commit cf7cc83f85
4 changed files with 29 additions and 141 deletions
+1 -34
View File
@@ -3,9 +3,8 @@ pub mod test;
use futures::Future;
use std::{
borrow::{Borrow, BorrowMut},
cmp::Ordering,
ops::{AddAssign, Deref, DerefMut},
ops::AddAssign,
pin::Pin,
task::{Context, Poll},
};
@@ -124,38 +123,6 @@ where
}
}
pub enum CowMut<'a, T: ?Sized + ToOwned> {
Borrowed(&'a mut T),
Owned(T::Owned),
}
impl<'a, T> Deref for CowMut<'a, T>
where
T: ?Sized + ToOwned,
{
type Target = T;
fn deref(&self) -> &Self::Target {
match self {
CowMut::Borrowed(value) => value,
CowMut::Owned(value) => value.borrow(),
}
}
}
impl<'a, T> DerefMut for CowMut<'a, T>
where
T: ?Sized + ToOwned,
T::Owned: BorrowMut<T>,
{
fn deref_mut(&mut self) -> &mut Self::Target {
match self {
CowMut::Borrowed(value) => value,
CowMut::Owned(value) => value.borrow_mut(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;