clippy: Remove unnecessary uses of ?

This commit is contained in:
Ian Hobson
2023-05-12 16:52:06 +02:00
parent 04d282ccd6
commit bbd84b7bbb
2 changed files with 6 additions and 7 deletions

View File

@@ -216,7 +216,7 @@ impl WaveReader<BufReader<File>> {
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, ParserError> { pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, ParserError> {
let f = File::open(path)?; let f = File::open(path)?;
let inner = BufReader::new(f); let inner = BufReader::new(f);
Ok(Self::new(inner)?) Self::new(inner)
} }
} }
@@ -224,10 +224,9 @@ impl WaveReader<File> {
/// Open a file for reading with unbuffered IO. /// Open a file for reading with unbuffered IO.
/// ///
/// A convenience that opens `path` and calls `Self::new()` /// A convenience that opens `path` and calls `Self::new()`
pub fn open_unbuffered<P: AsRef<Path>>(path: P) -> Result<Self, ParserError> { pub fn open_unbuffered<P: AsRef<Path>>(path: P) -> Result<Self, ParserError> {
let inner = File::open(path)?; let inner = File::open(path)?;
return Ok(Self::new(inner)?); Self::new(inner)
} }
} }
@@ -279,12 +278,12 @@ impl<R: Read + Seek> WaveReader<R> {
pub fn audio_frame_reader(mut self) -> Result<AudioFrameReader<R>, ParserError> { pub fn audio_frame_reader(mut self) -> Result<AudioFrameReader<R>, ParserError> {
let format = self.format()?; let format = self.format()?;
let audio_chunk_reader = self.get_chunk_extent_at_index(DATA_SIG, 0)?; let audio_chunk_reader = self.get_chunk_extent_at_index(DATA_SIG, 0)?;
Ok(AudioFrameReader::new( AudioFrameReader::new(
self.inner, self.inner,
format, format,
audio_chunk_reader.0, audio_chunk_reader.0,
audio_chunk_reader.1, audio_chunk_reader.1,
)?) )
} }
/// The count of audio frames in the file. /// The count of audio frames in the file.

View File

@@ -249,7 +249,7 @@ impl WaveWriter<BufWriter<File>> {
pub fn create<P: AsRef<Path>>(path: P, format: WaveFmt) -> Result<Self, Error> { pub fn create<P: AsRef<Path>>(path: P, format: WaveFmt) -> Result<Self, Error> {
let f = File::create(path)?; let f = File::create(path)?;
let b = BufWriter::new(f); let b = BufWriter::new(f);
Ok(Self::new(b, format)?) Self::new(b, format)
} }
} }
@@ -257,7 +257,7 @@ impl WaveWriter<File> {
/// Creare a new Wave file with unbuffered IO at `path` /// Creare a new Wave file with unbuffered IO at `path`
pub fn create_unbuffered<P: AsRef<Path>>(path: P, format: WaveFmt) -> Result<Self, Error> { pub fn create_unbuffered<P: AsRef<Path>>(path: P, format: WaveFmt) -> Result<Self, Error> {
let f = File::create(path)?; let f = File::create(path)?;
Ok(Self::new(f, format)?) Self::new(f, format)
} }
} }