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:
+1
-34
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user