mirror of
https://github.com/iluvcapra/bwavfile.git
synced 2026-05-17 04:33:26 +00:00
Silencing clippy errors
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -30,7 +30,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bwavfile"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"clap",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::common_format::{CommonFormat, WAVE_UUID_BFORMAT_PCM, WAVE_UUID_PCM};
|
||||
use crate::Sample;
|
||||
|
||||
@@ -8,7 +10,6 @@ use byteorder::LittleEndian;
|
||||
use byteorder::ReadBytesExt;
|
||||
|
||||
// Need more test cases for ADMAudioID
|
||||
#[allow(dead_code)]
|
||||
|
||||
/// ADM Audio ID record.
|
||||
///
|
||||
@@ -154,7 +155,7 @@ pub struct WaveFmtExtended {
|
||||
/// - [Sampler Metadata](http://www.piclist.com/techref/io/serial/midi/wave.html)
|
||||
/// - [Audio File Format Specifications](http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html) (September 2022) Prof. Peter Kabal, MMSP Lab, ECE, McGill University
|
||||
/// - [Multimedia Programming Interface and Data Specifications 1.0](http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf)
|
||||
/// (August 1991), IBM Corporation and Microsoft Corporation
|
||||
/// (August 1991), IBM Corporation and Microsoft Corporation
|
||||
///
|
||||
/// [rfc3261]: https://tools.ietf.org/html/rfc2361
|
||||
|
||||
@@ -404,7 +405,7 @@ where
|
||||
format: WaveFmt,
|
||||
into: &mut [i32],
|
||||
) -> Result<usize, std::io::Error> {
|
||||
assert!(into.len() % format.channel_count as usize == 0);
|
||||
assert!(into.len().is_multiple_of(format.channel_count as usize));
|
||||
|
||||
for frame in into {
|
||||
*frame = match (format.valid_bits_per_sample(), format.bits_per_sample) {
|
||||
@@ -424,7 +425,7 @@ where
|
||||
format: WaveFmt,
|
||||
into: &mut [f32],
|
||||
) -> Result<usize, std::io::Error> {
|
||||
assert!(into.len() % format.channel_count as usize == 0);
|
||||
assert!(into.len().is_multiple_of(format.channel_count as usize));
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ use super::fourcc::{BW64_SIG, DATA_SIG, DS64_SIG, RF64_SIG, RIFF_SIG, WAVE_SIG};
|
||||
const RF64_SIZE_MARKER: u32 = 0xFF_FF_FF_FF;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub enum Event {
|
||||
StartParse,
|
||||
ReadHeader {
|
||||
|
||||
@@ -110,7 +110,7 @@ impl<R: Read + Seek> AudioFrameReader<R> {
|
||||
let common_format = self.format.common_format();
|
||||
let bits_per_sample = self.format.bits_per_sample;
|
||||
|
||||
if buffer.len() % channel_count != 0 {
|
||||
if !buffer.len().is_multiple_of(channel_count) {
|
||||
return Err(Error::InvalidBufferSize {
|
||||
buffer_size: buffer.len(),
|
||||
channel_count: self.format.channel_count,
|
||||
@@ -245,7 +245,7 @@ impl<R: Read + Seek> WaveReader<R> {
|
||||
/// will return an `Err(errors::Error)` immediately if there is a structural
|
||||
/// inconsistency that makes the stream unreadable or if it's missing
|
||||
/// essential components that make interpreting the audio data impossible.
|
||||
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::fs::File;
|
||||
/// use std::io::{Error,ErrorKind};
|
||||
|
||||
@@ -51,7 +51,7 @@ where
|
||||
let format = &self.inner.inner.format;
|
||||
let channel_count = format.channel_count as usize;
|
||||
|
||||
if buffer.len() % channel_count != 0 {
|
||||
if !buffer.len().is_multiple_of(channel_count) {
|
||||
return Err(Error::InvalidBufferSize {
|
||||
buffer_size: buffer.len(),
|
||||
channel_count: format.channel_count,
|
||||
@@ -339,7 +339,7 @@ where
|
||||
assert!(data.len() < u32::MAX as usize);
|
||||
self.inner.write_u32::<LittleEndian>(data.len() as u32)?;
|
||||
self.inner.write_all(data)?;
|
||||
if data.len() % 2 == 0 {
|
||||
if data.len().is_multiple_of(2) {
|
||||
self.increment_form_length(8 + data.len() as u64)?;
|
||||
} else {
|
||||
self.inner.write_u8(0)?;
|
||||
|
||||
Reference in New Issue
Block a user