mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
clippy
This commit is contained in:
@@ -96,10 +96,7 @@ fn get_or<E>(&self, k: K, vacant: impl FnOnce() -> Result<V, E>) -> Result<&V, E
|
||||
|
||||
/// Read-only lookup (avoid read-acquiring the RefCell).
|
||||
fn get(&self, k: K) -> Option<&V> {
|
||||
let val: *const V = match self.0.borrow().get(&k) {
|
||||
Some(v) => &**v,
|
||||
None => return None,
|
||||
};
|
||||
let val: *const V = &**self.0.borrow().get(&k)?;
|
||||
// This is safe because `val` points into a `Box`, that we know will not move and
|
||||
// will also not be dropped as long as the shared reference `self` is live.
|
||||
unsafe { Some(&*val) }
|
||||
|
||||
Reference in New Issue
Block a user