diff options
Diffstat (limited to 'src/util/mod.rs')
| -rw-r--r-- | src/util/mod.rs | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs index 84bd1aa1..e42d0664 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -9,7 +9,6 @@ pub use eco_string::EcoString; pub use mac_roman::decode_mac_roman; pub use prehashed::Prehashed; -use std::cell::RefMut; use std::cmp::Ordering; use std::fmt::{self, Debug, Formatter}; use std::ops::Range; @@ -223,23 +222,3 @@ impl PathExt for Path { out } } - -/// Additional methods for [`RefMut`]. -pub trait RefMutExt<'a, T> { - fn try_map<U, F, E>(orig: Self, f: F) -> Result<RefMut<'a, U>, E> - where - F: FnOnce(&mut T) -> Result<&mut U, E>; -} - -impl<'a, T> RefMutExt<'a, T> for RefMut<'a, T> { - fn try_map<U, F, E>(mut orig: Self, f: F) -> Result<RefMut<'a, U>, E> - where - F: FnOnce(&mut T) -> Result<&mut U, E>, - { - // Taken from here: - // https://github.com/rust-lang/rust/issues/27746#issuecomment-172899746 - f(&mut orig) - .map(|new| new as *mut U) - .map(|raw| RefMut::map(orig, |_| unsafe { &mut *raw })) - } -} |
