Elide superfluous lifetimes.
This commit is contained in:
parent
a2560a090f
commit
b836d28a13
1 changed files with 2 additions and 2 deletions
|
@ -122,12 +122,12 @@ impl AnyMap {
|
||||||
|
|
||||||
impl AnyMap {
|
impl AnyMap {
|
||||||
/// Retrieve the value stored in the map for the type `T`, if it exists.
|
/// Retrieve the value stored in the map for the type `T`, if it exists.
|
||||||
pub fn find<'a, T: 'static>(&'a self) -> Option<&'a T> {
|
pub fn find<T: 'static>(&self) -> Option<&T> {
|
||||||
self.data.find(&TypeId::of::<T>()).map(|any| unsafe { any.as_ref_unchecked::<T>() })
|
self.data.find(&TypeId::of::<T>()).map(|any| unsafe { any.as_ref_unchecked::<T>() })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieve a mutable reference to the value stored in the map for the type `T`, if it exists.
|
/// Retrieve a mutable reference to the value stored in the map for the type `T`, if it exists.
|
||||||
pub fn find_mut<'a, T: 'static>(&'a mut self) -> Option<&'a mut T> {
|
pub fn find_mut<T: 'static>(&mut self) -> Option<&mut T> {
|
||||||
self.data.find_mut(&TypeId::of::<T>()).map(|any| unsafe { any.as_mut_unchecked::<T>() })
|
self.data.find_mut(&TypeId::of::<T>()).map(|any| unsafe { any.as_mut_unchecked::<T>() })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue