Fix or disable all failing tests. Fix all cargo clippy warnings

This commit is contained in:
Igor Katson 2021-10-18 16:38:43 +01:00
parent 3a64254971
commit b2fb4729c7
11 changed files with 31 additions and 24 deletions

View file

@ -95,7 +95,10 @@ mod tests {
static LOG_INIT: Once = Once::new();
fn init_logging() {
LOG_INIT.call_once(pretty_env_logger::init)
#[allow(unused_must_use)]
LOG_INIT.call_once(|| {
pretty_env_logger::try_init();
})
}
#[tokio::test]

View file

@ -294,7 +294,7 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
if result_buf.len() < chunk_info.size as usize {
anyhow::bail!("read_chunk(): not enough capacity in the provided buffer")
}
let mut absolute_offset = self.lengths.chunk_absolute_offset(&chunk_info);
let mut absolute_offset = self.lengths.chunk_absolute_offset(chunk_info);
let mut buf = result_buf;
for (file_idx, file_len) in self.torrent.iter_file_lengths()?.enumerate() {
@ -349,7 +349,7 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
ByteBuf: AsRef<[u8]>,
{
let mut buf = data.block.as_ref();
let mut absolute_offset = self.lengths.chunk_absolute_offset(&chunk_info);
let mut absolute_offset = self.lengths.chunk_absolute_offset(chunk_info);
for (file_idx, (name, file_len)) in self.torrent.iter_filenames_and_lengths()?.enumerate() {
if absolute_offset > file_len {

View file

@ -236,10 +236,14 @@ mod tests {
static LOG_INIT: Once = std::sync::Once::new();
fn init_logging() {
LOG_INIT.call_once(pretty_env_logger::init)
#[allow(unused_must_use)]
LOG_INIT.call_once(|| {
pretty_env_logger::try_init();
})
}
#[tokio::test]
#[ignore]
async fn test_get_torrent_metadata_from_localhost_bittorrent_client() {
init_logging();