clippy fixes.

This commit is contained in:
Pedro de Oliveira 2022-11-13 16:54:39 +00:00
parent bf3c774735
commit 108336e5a0
1 changed files with 10 additions and 8 deletions

View File

@ -1,3 +1,5 @@
#![allow(clippy::new_without_default)]
use std::fmt;
use std::fs::File;
use std::io::{Read, Seek, SeekFrom, Write};
@ -95,7 +97,7 @@ impl VocFile {
);
}
let mut address: i32 = fp.seek(SeekFrom::Current(0)).unwrap() as i32;
let address: i32 = fp.seek(SeekFrom::Current(0)).unwrap() as i32;
let end_address = address + block_size;
match block_type {
@ -187,7 +189,7 @@ impl Terminator {
Self { block_type: BlockType::Terminator }
}
pub fn from_stream(_fp: &File, _end_address: i32) -> Self {
pub fn from_stream(_fp: &mut File, _end_address: i32) -> Self {
Self::new()
}
}
@ -360,11 +362,11 @@ impl Silence {
impl Block for Silence {
fn to_bytes(&self) -> Vec<u8> {
let size_bytes: [u8; 4] = (3 as u32).to_le_bytes();
let size_bytes: [u8; 4] = 3u32.to_le_bytes();
let length_bytes: [u8; 2] = (self.length - 1).to_le_bytes();
let frequency_divisor: u8 = (256i32 - 1000000i32 / self.sample_rate as i32) as u8;
let mut result: Vec<u8> = vec![
let result: Vec<u8> = vec![
self.block_type as u8,
size_bytes[0],
size_bytes[1],
@ -413,10 +415,10 @@ impl Marker {
impl Block for Marker {
fn to_bytes(&self) -> Vec<u8> {
let size_bytes: [u8; 4] = (2 as u32).to_le_bytes();
let size_bytes: [u8; 4] = 2u32.to_le_bytes();
let value_bytes: [u8; 2] = self.value.to_le_bytes();
let mut result: Vec<u8> = vec![
let result: Vec<u8> = vec![
self.block_type as u8,
size_bytes[0],
size_bytes[1],
@ -512,10 +514,10 @@ impl RepeatStart {
impl Block for RepeatStart {
fn to_bytes(&self) -> Vec<u8> {
let size_bytes: [u8; 4] = (2 as u32).to_le_bytes();
let size_bytes: [u8; 4] = 2u32.to_le_bytes();
let count_bytes: [u8; 2] = self.count.to_le_bytes();
let mut result: Vec<u8> = vec![
let result: Vec<u8> = vec![
self.block_type as u8,
size_bytes[0],
size_bytes[1],