Skip to content

Commit 11a71a4

Browse files
authored
Merge pull request #210 from jeromefroe/jerome/fmt
Format and lint code
2 parents 2bacc3f + ec75f08 commit 11a71a4

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- stable
1717
- beta
1818
- nightly
19-
- 1.65.0 # MSRV
19+
- 1.70.0 # MSRV
2020

2121
steps:
2222
- uses: actions/checkout@v2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ An implementation of a LRU cache. The cache supports `put`, `get`, `get_mut` and
1212
all of which are O(1). This crate was heavily influenced by the [LRU Cache implementation in an
1313
earlier version of Rust's std::collections crate].
1414

15-
The MSRV for this crate is 1.65.0.
15+
The MSRV for this crate is 1.70.0.
1616

1717
## Example
1818

src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
269269
/// let mut cache: LruCache<isize, &str> = LruCache::unbounded_with_hasher(s);
270270
/// ```
271271
pub fn unbounded_with_hasher(hash_builder: S) -> LruCache<K, V, S> {
272-
LruCache::construct(
273-
NonZeroUsize::MAX,
274-
HashMap::with_hasher(hash_builder),
275-
)
272+
LruCache::construct(NonZeroUsize::MAX, HashMap::with_hasher(hash_builder))
276273
}
277274

278275
/// Creates a new LRU Cache with the given capacity.
@@ -1502,7 +1499,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
15021499
fn remove_first(&mut self) -> Option<Box<LruEntry<K, V>>> {
15031500
let next;
15041501
unsafe { next = (*self.head).next }
1505-
if next != self.tail {
1502+
if !core::ptr::eq(next, self.tail) {
15061503
let old_key = KeyRef {
15071504
k: unsafe { &(*(*(*self.head).next).key.as_ptr()) },
15081505
};
@@ -1518,7 +1515,7 @@ impl<K: Hash + Eq, V, S: BuildHasher> LruCache<K, V, S> {
15181515
fn remove_last(&mut self) -> Option<Box<LruEntry<K, V>>> {
15191516
let prev;
15201517
unsafe { prev = (*self.tail).prev }
1521-
if prev != self.head {
1518+
if !core::ptr::eq(prev, self.head) {
15221519
let old_key = KeyRef {
15231520
k: unsafe { &(*(*(*self.tail).prev).key.as_ptr()) },
15241521
};

0 commit comments

Comments
 (0)