Skip to content

Commit 73792aa

Browse files
committed
Apply clippy --fix
1 parent 13d89c2 commit 73792aa

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

src/cache_padded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::ops::{Deref, DerefMut};
2121
not(any(target_arch = "x86_64", target_arch = "aarch64")),
2222
repr(align(64))
2323
)]
24-
#[derive(Default, PartialEq)]
24+
#[derive(Default, PartialEq, Eq)]
2525
pub struct CachePadded<T> {
2626
value: T,
2727
}

src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl Db {
143143

144144
let mut tenants = self.tenants.write();
145145

146-
let tree = if let Some(tree) = tenants.remove(&*name_ref) {
146+
let tree = if let Some(tree) = tenants.remove(name_ref) {
147147
tree
148148
} else {
149149
return Ok(false);

src/ebr/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub struct Iter<'g, T, C: IsElement<T>> {
8383
}
8484

8585
/// An error that occurs during iteration over the list.
86-
#[derive(Debug, Clone, Copy, PartialEq)]
86+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8787
pub enum IterError {
8888
/// A concurrent thread modified the state of the list at the same place that this iterator
8989
/// was inspecting. Subsequent iteration will restart from the beginning of the list.

src/ivec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ mod qc {
327327
fn ivec_as_mut_identity() {
328328
let initial = &[1];
329329
let mut iv = IVec::from(initial);
330-
assert_eq!(&*initial, &*iv);
331-
assert_eq!(&*initial, &mut *iv);
332-
assert_eq!(&*initial, iv.as_mut());
330+
assert_eq!(initial, &*iv);
331+
assert_eq!(initial, &mut *iv);
332+
assert_eq!(initial, iv.as_mut());
333333
}
334334

335335
fn prop_identity(ivec: &IVec) -> bool {

src/node.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<'a> Iterator for Iter<'a> {
413413
log::trace!("src/node.rs:114");
414414
log::trace!("iterator returning {:?}", self.next_a);
415415
return self.next_a.take().map(|(k, v)| {
416-
(KeyRef::Slice(&*k), v.unwrap().as_ref())
416+
(KeyRef::Slice(k), v.unwrap().as_ref())
417417
});
418418
}
419419
(Some((k_a, v_a_opt)), Some((k_b, _))) => {
@@ -425,7 +425,7 @@ impl<'a> Iterator for Iter<'a> {
425425
log::trace!("src/node.rs:133");
426426
log::trace!("iterator returning {:?}", self.next_a);
427427
return self.next_a.take().map(|(k, v)| {
428-
(KeyRef::Slice(&*k), v.unwrap().as_ref())
428+
(KeyRef::Slice(k), v.unwrap().as_ref())
429429
});
430430
}
431431
(Equal, None) => {
@@ -437,7 +437,7 @@ impl<'a> Iterator for Iter<'a> {
437437
(Less, Some(_)) => {
438438
log::trace!("iterator returning {:?}", self.next_a);
439439
return self.next_a.take().map(|(k, v)| {
440-
(KeyRef::Slice(&*k), v.unwrap().as_ref())
440+
(KeyRef::Slice(k), v.unwrap().as_ref())
441441
});
442442
}
443443
(Less, None) => {
@@ -512,7 +512,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
512512
log::trace!("src/node.rs:483");
513513
log::trace!("iterator returning {:?}", self.next_back_a);
514514
return self.next_back_a.take().map(|(k, v)| {
515-
(KeyRef::Slice(&*k), v.unwrap().as_ref())
515+
(KeyRef::Slice(k), v.unwrap().as_ref())
516516
});
517517
}
518518
(Some((k_a, Some(_))), Some((k_b, _))) if k_b > *k_a => {
@@ -523,7 +523,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
523523
(Some((k_a, Some(_))), Some((k_b, _))) if k_b < *k_a => {
524524
log::trace!("iterator returning {:?}", self.next_back_a);
525525
return self.next_back_a.take().map(|(k, v)| {
526-
(KeyRef::Slice(&*k), v.unwrap().as_ref())
526+
(KeyRef::Slice(k), v.unwrap().as_ref())
527527
});
528528
}
529529
(Some((k_a, Some(_))), Some((k_b, _))) if k_b == *k_a => {
@@ -532,7 +532,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
532532
log::trace!("src/node.rs:520");
533533
log::trace!("iterator returning {:?}", self.next_back_a);
534534
return self.next_back_a.take().map(|(k, v)| {
535-
(KeyRef::Slice(&*k), v.unwrap().as_ref())
535+
(KeyRef::Slice(k), v.unwrap().as_ref())
536536
});
537537
}
538538
_ => unreachable!(
@@ -713,10 +713,10 @@ impl Node {
713713
for (k, v) in &self.overlay {
714714
length_and_stride_matches &=
715715
v.is_some() && v.as_ref().unwrap().is_empty();
716-
length_and_stride_matches &= KeyRef::Slice(&*k) > prev
717-
&& is_linear(&prev, &KeyRef::Slice(&*k), stride);
716+
length_and_stride_matches &= KeyRef::Slice(k) > prev
717+
&& is_linear(&prev, &KeyRef::Slice(k), stride);
718718

719-
prev = KeyRef::Slice(&*k);
719+
prev = KeyRef::Slice(k);
720720

721721
if !length_and_stride_matches {
722722
break;
@@ -2398,8 +2398,8 @@ impl Inner {
23982398
pub(crate) fn contains_upper_bound(&self, bound: &Bound<IVec>) -> bool {
23992399
if let Some(hi) = self.hi() {
24002400
match bound {
2401-
Bound::Excluded(b) if hi >= &*b => true,
2402-
Bound::Included(b) if hi > &*b => true,
2401+
Bound::Excluded(b) if hi >= b => true,
2402+
Bound::Included(b) if hi > b => true,
24032403
_ => false,
24042404
}
24052405
} else {
@@ -2414,8 +2414,8 @@ impl Inner {
24142414
) -> bool {
24152415
let lo = self.lo();
24162416
match bound {
2417-
Bound::Excluded(b) if lo < &*b || (is_forward && *b == lo) => true,
2418-
Bound::Included(b) if lo <= &*b => true,
2417+
Bound::Excluded(b) if lo < b || (is_forward && *b == lo) => true,
2418+
Bound::Included(b) if lo <= b => true,
24192419
Bound::Unbounded if !is_forward => self.hi().is_none(),
24202420
_ => lo.is_empty(),
24212421
}
@@ -2630,7 +2630,7 @@ mod test {
26302630

26312631
let key_ref = KeyRef::Computed { base: &[2, 253], distance: 8 };
26322632
let mut buf = &mut [0, 0][..];
2633-
key_ref.write_into(&mut buf);
2633+
key_ref.write_into(buf);
26342634
assert_eq!(buf, &[3, 5]);
26352635
}
26362636

@@ -2730,7 +2730,7 @@ mod test {
27302730
.collect();
27312731

27322732
let mut ret =
2733-
Inner::new(&lo, hi.map(|h| &*h), 0, false, None, &children_ref);
2733+
Inner::new(&lo, hi.map(|h| h), 0, false, None, &children_ref);
27342734

27352735
ret.activity_sketch = g.gen();
27362736

src/pagecache/disk_pointer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::{HeapId, LogOffset};
44
use crate::*;
55

66
/// A pointer to a location on disk or an off-log heap item.
7-
#[derive(Debug, Clone, Copy, PartialEq)]
7+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
88
pub enum DiskPtr {
99
/// Points to a value stored in the single-file log.
1010
Inline(LogOffset),

src/pagecache/logger.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl Drop for Log {
534534
}
535535

536536
/// All log messages are prepended with this header
537-
#[derive(Debug, Copy, Clone, PartialEq)]
537+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
538538
pub struct MessageHeader {
539539
pub crc32: u32,
540540
pub kind: MessageKind,
@@ -544,7 +544,7 @@ pub struct MessageHeader {
544544
}
545545

546546
/// A number representing a segment number.
547-
#[derive(Copy, Clone, PartialEq, Debug)]
547+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
548548
#[repr(transparent)]
549549
pub struct SegmentNumber(pub u64);
550550

src/pagecache/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'g> Deref for PageView<'g> {
290290
}
291291
}
292292

293-
#[derive(Clone, Copy, Debug, PartialEq)]
293+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
294294
pub struct CacheInfo {
295295
pub ts: u64,
296296
pub lsn: Lsn,
@@ -1523,7 +1523,7 @@ impl PageCacheInner {
15231523

15241524
loop {
15251525
let mut page_ptr = new_page.take().unwrap();
1526-
let log_reservation = match &*page_ptr.update.as_ref().unwrap() {
1526+
let log_reservation = match page_ptr.update.as_ref().unwrap() {
15271527
Update::Counter(ref c) => {
15281528
self.log.reserve(log_kind, pid, c, guard)?
15291529
}

src/pagecache/snapshot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct Snapshot {
2323
pub pt: Vec<PageState>,
2424
}
2525

26-
#[derive(Clone, Debug, PartialEq)]
26+
#[derive(Clone, Debug, PartialEq, Eq)]
2727
pub enum PageState {
2828
/// Present signifies a page that has some data.
2929
///
@@ -611,7 +611,7 @@ pub(in crate::pagecache) fn write_snapshot(
611611
let candidates = config.get_snapshot_files()?;
612612
for path in candidates {
613613
let path_str = path.file_name().unwrap().to_str().unwrap();
614-
if !path_2.to_string_lossy().ends_with(&*path_str) {
614+
if !path_2.to_string_lossy().ends_with(path_str) {
615615
debug!("removing old snapshot file {:?}", path);
616616

617617
io_fail!(config, "snap write rm old");

src/transaction.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub struct TransactionalTree {
9999

100100
/// An error type that is returned from the closure
101101
/// passed to the `transaction` method.
102-
#[derive(Debug, Clone, Copy, PartialEq)]
102+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
103103
pub enum UnabortableTransactionError {
104104
/// An internal conflict has occurred and the `transaction` method will
105105
/// retry the passed-in closure until it succeeds. This should never be
@@ -155,7 +155,7 @@ impl<E> From<UnabortableTransactionError> for ConflictableTransactionError<E> {
155155

156156
/// An error type that is returned from the closure
157157
/// passed to the `transaction` method.
158-
#[derive(Debug, Clone, PartialEq)]
158+
#[derive(Debug, Clone, PartialEq, Eq)]
159159
pub enum ConflictableTransactionError<T = Error> {
160160
/// A user-provided error type that indicates the transaction should abort.
161161
/// This is passed into the return value of `transaction` as a direct Err
@@ -198,7 +198,7 @@ impl<E: std::error::Error> std::error::Error
198198

199199
/// An error type that is returned from the closure
200200
/// passed to the `transaction` method.
201-
#[derive(Debug, Clone, PartialEq)]
201+
#[derive(Debug, Clone, PartialEq, Eq)]
202202
pub enum TransactionError<T = Error> {
203203
/// A user-provided error type that indicates the transaction should abort.
204204
/// This is passed into the return value of `transaction` as a direct Err
@@ -266,7 +266,7 @@ impl TransactionalTree {
266266
{
267267
let old = self.get(key.as_ref())?;
268268
let mut writes = self.writes.borrow_mut();
269-
let _last_write = writes.insert(key, value.into());
269+
writes.insert(key, value.into());
270270
Ok(old)
271271
}
272272

@@ -280,7 +280,7 @@ impl TransactionalTree {
280280
{
281281
let old = self.get(key.as_ref());
282282
let mut writes = self.writes.borrow_mut();
283-
let _last_write = writes.remove(key);
283+
writes.remove(key);
284284
old
285285
}
286286

0 commit comments

Comments
 (0)