Chris Morgan
›
Git
›
anymap
› blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
commit
grep
author
committer
pickaxe
?
search:
re
chmod +x test
[anymap]
/
src
/
lib.rs
diff --git
a/src/lib.rs
b/src/lib.rs
index 79a45615b60169f5d877b521831ac61b05e80b76..17427011dfb8ffce8a868c5551a852299011a9ae 100644
(file)
--- a/
src/lib.rs
+++ b/
src/lib.rs
@@
-221,10
+221,8
@@
impl<A: ?Sized + UncheckedAnyExt> Map<A> {
/// Otherwise, `None` is returned.
#[inline]
pub fn insert<T: IntoBox<A>>(&mut self, value: T) -> Option<T> {
/// Otherwise, `None` is returned.
#[inline]
pub fn insert<T: IntoBox<A>>(&mut self, value: T) -> Option<T> {
- unsafe {
- self.raw.insert(TypeId::of::<T>(), value.into_box())
- .map(|any| *any.downcast_unchecked::<T>())
- }
+ self.raw.insert(TypeId::of::<T>(), value.into_box())
+ .map(|any| unsafe { *any.downcast_unchecked::<T>() })
}
// rustc 1.60.0-nightly has another method try_insert that would be nice to add when stable.
}
// rustc 1.60.0-nightly has another method try_insert that would be nice to add when stable.