Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
(Some(replaced), old_node)
} else {
// if the cache is not full allocate a new LruEntry
// Safety: We allocate, turn into raw, and get NonNull all in one step.
(None, unsafe {
NonNull::new_unchecked(Box::into_raw(Box::new(LruEntry::new(k, v))))
})
(
None,
NonNull::from(Box::leak(Box::new(LruEntry::new(k, v)))),
)
Comment thread
Copilot marked this conversation as resolved.
}
}

Expand Down
Loading