Skip to content

Commit 06bb305

Browse files
committed
remove unnecessary impls
1 parent a3a45dc commit 06bb305

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

src/table/index_block/block_handle.rs

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::io::{Cursor, Seek};
1717
use varint_rs::{VarintReader, VarintWriter};
1818

1919
/// Points to a block on file
20-
#[derive(Copy, Clone, Debug, Default, Eq)]
20+
#[derive(Copy, Clone, Debug, Default)]
2121
pub struct BlockHandle {
2222
/// Position of block in file
2323
offset: BlockOffset,
@@ -43,24 +43,6 @@ impl BlockHandle {
4343
}
4444
}
4545

46-
impl PartialEq for BlockHandle {
47-
fn eq(&self, other: &Self) -> bool {
48-
self.offset == other.offset
49-
}
50-
}
51-
52-
impl Ord for BlockHandle {
53-
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
54-
self.offset.cmp(&other.offset)
55-
}
56-
}
57-
58-
impl PartialOrd for BlockHandle {
59-
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
60-
Some(self.cmp(other))
61-
}
62-
}
63-
6446
impl Encode for BlockHandle {
6547
fn encode_into<W: std::io::Write>(&self, writer: &mut W) -> Result<(), crate::Error> {
6648
writer.write_u64_varint(*self.offset)?;
@@ -85,7 +67,7 @@ impl Decode for BlockHandle {
8567
}
8668

8769
/// Points to a block on file
88-
#[derive(Clone, Debug, Eq)]
70+
#[derive(Clone, Debug)]
8971
pub struct KeyedBlockHandle {
9072
/// Key of last item in block
9173
end_key: UserKey,
@@ -138,24 +120,13 @@ impl KeyedBlockHandle {
138120
}
139121
}
140122

123+
#[cfg(test)]
141124
impl PartialEq for KeyedBlockHandle {
142125
fn eq(&self, other: &Self) -> bool {
143126
self.offset() == other.offset()
144127
}
145128
}
146129

147-
impl Ord for KeyedBlockHandle {
148-
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
149-
self.offset().cmp(&other.offset())
150-
}
151-
}
152-
153-
impl PartialOrd for KeyedBlockHandle {
154-
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
155-
Some(self.cmp(other))
156-
}
157-
}
158-
159130
impl Encodable<BlockOffset> for KeyedBlockHandle {
160131
fn encode_full_into<W: std::io::Write>(
161132
&self,

src/table/regions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn toc_entry_to_handle(entry: &TocEntry) -> BlockHandle {
3030
/// |--------------|
3131
/// | trailer | <- fixed size
3232
/// |--------------|
33-
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
33+
#[derive(Copy, Clone, Debug, Default)]
3434
pub struct ParsedRegions {
3535
pub tli: BlockHandle,
3636
pub index: Option<BlockHandle>,

0 commit comments

Comments
 (0)