Skip to content

Commit

Permalink
chore(bitar): fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
oll3 committed Jan 20, 2025
1 parent 40456e6 commit d8e1b59
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions bitar/src/archive_reader/http_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct ChunkReader<'a> {
request: Option<HttpRangeRequest>,
}

impl<'a> ChunkReader<'a>
impl ChunkReader<'_>
where
Self: Unpin,
{
Expand Down Expand Up @@ -138,7 +138,7 @@ where
}
}

impl<'a> Stream for ChunkReader<'a> {
impl Stream for ChunkReader<'_> {
type Item = Result<Bytes, HttpReaderError>;

fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
Expand Down Expand Up @@ -266,13 +266,13 @@ mod tests {

#[test]
fn one_adjacent_reads() {
let chunks = vec![ChunkOffset::new(0, 1), ChunkOffset::new(10, 1)];
let chunks = [ChunkOffset::new(0, 1), ChunkOffset::new(10, 1)];
assert_eq!(ChunkReader::adjacent_reads(&chunks[..]), 1);
}

#[test]
fn two_adjacent_reads() {
let chunks = vec![
let chunks = [
ChunkOffset::new(0, 1),
ChunkOffset::new(1, 3),
ChunkOffset::new(10, 3),
Expand All @@ -282,7 +282,7 @@ mod tests {

#[test]
fn multiple_adjacent_reads() {
let chunks = vec![
let chunks = [
ChunkOffset::new(0, 1),
ChunkOffset::new(1, 3),
ChunkOffset::new(4, 3),
Expand Down
2 changes: 1 addition & 1 deletion bitar/src/archive_reader/io_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ where
}
}

impl<'a, R> Stream for IoChunkReader<'a, R>
impl<R> Stream for IoChunkReader<'_, R>
where
R: AsyncRead + AsyncSeek + Unpin + Send,
{
Expand Down
12 changes: 6 additions & 6 deletions bitar/src/chunk_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ struct MoveChunk<'a> {
source: u64,
}

impl<'a> Ord for MoveChunk<'a> {
impl Ord for MoveChunk<'_> {
fn cmp(&self, other: &Self) -> Ordering {
self.source.cmp(&other.source)
}
}

impl<'a> PartialOrd for MoveChunk<'a> {
impl PartialOrd for MoveChunk<'_> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
Expand Down Expand Up @@ -106,7 +106,7 @@ struct TruncatedHashSum<'a> {
truncate_len: usize,
}

impl<'a> HashSumKey for TruncatedHashSum<'a> {
impl HashSumKey for TruncatedHashSum<'_> {
fn sum(&self) -> &[u8] {
let hash = self.hash.slice();
if hash.len() > self.truncate_len {
Expand All @@ -117,15 +117,15 @@ impl<'a> HashSumKey for TruncatedHashSum<'a> {
}
}

impl<'a> Eq for (dyn HashSumKey + 'a) {}
impl Eq for (dyn HashSumKey + '_) {}

impl<'a> PartialEq for (dyn HashSumKey + 'a) {
impl PartialEq for (dyn HashSumKey + '_) {
fn eq(&self, other: &dyn HashSumKey) -> bool {
self.sum() == other.sum()
}
}

impl<'a> std::hash::Hash for (dyn HashSumKey + 'a) {
impl std::hash::Hash for (dyn HashSumKey + '_) {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.sum().hash(state)
}
Expand Down
8 changes: 4 additions & 4 deletions bitar/src/chunker/streaming_chunker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ mod tests {
};
let expected_offsets = {
chunker_config
.new_chunker(&mut Box::new(&source_data[..]))
.new_chunker(Box::new(&source_data[..]))
.map(|result| {
let (offset, _chunk) = result.unwrap();
offset
Expand Down Expand Up @@ -231,7 +231,7 @@ mod tests {
static SRC: [u8; 0] = [];
assert_eq!(
chunker_config
.new_chunker(&mut Box::new(&SRC[..]))
.new_chunker(Box::new(&SRC[..]))
.map(|result| {
let (offset, chunk) = result.unwrap();
assert_eq!(chunk.len(), 0);
Expand Down Expand Up @@ -264,7 +264,7 @@ mod tests {
static SRC: [u8; 5] = [0x1f, 0x55, 0x39, 0x5e, 0xfa];
assert_eq!(
chunker_config
.new_chunker(&mut Box::new(&SRC[..]))
.new_chunker(Box::new(&SRC[..]))
.map(|result| {
let (offset, chunk) = result.unwrap();
assert_eq!(chunk, Chunk::from(vec![0x1f, 0x55, 0x39, 0x5e, 0xfa]));
Expand Down Expand Up @@ -297,7 +297,7 @@ mod tests {
static SRC: [u8; 5] = [0x1f, 0x55, 0x39, 0x5e, 0xfa];
assert_eq!(
chunker_config
.new_chunker(&mut Box::new(&SRC[..]))
.new_chunker(Box::new(&SRC[..]))
.map(|result| {
let (offset, chunk) = result.unwrap();
assert_eq!(chunk, Chunk::from(vec![0x1f, 0x55, 0x39, 0x5e, 0xfa]));
Expand Down
4 changes: 2 additions & 2 deletions bitar/src/rolling_hash/buzhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ mod tests {
fn equal_sums_for_equal_range() {
let window_size = 8;
let mut h = BuzHash::new(window_size);
let data1 = vec![
let data1 = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
];
let data2 = vec![
let data2 = [
1, 99, 99, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
];
let sums1: Vec<u32> = data1
Expand Down

0 comments on commit d8e1b59

Please sign in to comment.