Remove all linter warnings

This commit is contained in:
Igor Katson 2021-07-02 10:21:19 +01:00
parent 1f299247d2
commit d722f0edcb
11 changed files with 73 additions and 92 deletions

View file

@ -193,20 +193,18 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
);
have_bytes += piece_info.len as u64;
have_pieces.set(piece_info.piece_index.get() as usize, true);
} else {
if at_least_one_file_required {
trace!(
"piece {} hash does not match, marking as needed",
piece_info.piece_index
);
needed_bytes += piece_info.len as u64;
needed_pieces.set(piece_info.piece_index.get() as usize, true);
} else {
trace!(
"piece {} hash does not match, but it is not required by any of the requested files, ignoring",
} else if at_least_one_file_required {
trace!(
"piece {} hash does not match, marking as needed",
piece_info.piece_index
);
}
needed_bytes += piece_info.len as u64;
needed_pieces.set(piece_info.piece_index.get() as usize, true);
} else {
trace!(
"piece {} hash does not match, but it is not required by any of the requested files, ignoring",
piece_info.piece_index
);
}
}
@ -304,7 +302,7 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
anyhow::bail!("read_chunk(): not enough capacity in the provided buffer")
}
let mut absolute_offset = self.lengths.chunk_absolute_offset(&chunk_info);
let mut buf = &mut result_buf[..];
let mut buf = result_buf;
for (file_idx, file_len) in self.torrent.info.iter_file_lengths().enumerate() {
if absolute_offset > file_len {
@ -345,7 +343,7 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
absolute_offset = 0;
}
return Ok(());
Ok(())
}
pub fn write_chunk<ByteBuf>(