Skip to content

Commit

Permalink
refactor: remove returns that are unnecessary (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamirmahal authored Mar 8, 2024
1 parent 4688432 commit 698ca2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
8 changes: 2 additions & 6 deletions src/decoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ where

match symphonia::SymphoniaDecoder::new(mss, None) {
Err(e) => Err(e),
Ok(decoder) => {
return Ok(Decoder(DecoderImpl::Symphonia(decoder)));
}
Ok(decoder) => Ok(Decoder(DecoderImpl::Symphonia(decoder))),
}
}
#[cfg(not(feature = "symphonia"))]
Expand Down Expand Up @@ -200,9 +198,7 @@ where

match symphonia::SymphoniaDecoder::new(mss, Some(hint)) {
Err(e) => Err(e),
Ok(decoder) => {
return Ok(Decoder(DecoderImpl::Symphonia(decoder)));
}
Ok(decoder) => Ok(Decoder(DecoderImpl::Symphonia(decoder))),
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/decoder/symphonia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,21 @@ impl SymphoniaDecoder {
};
let spec = decoded.spec().to_owned();
let buffer = SymphoniaDecoder::get_buffer(decoded, &spec);

return Ok(Some(SymphoniaDecoder {
Ok(Some(SymphoniaDecoder {
decoder,
current_frame_offset: 0,
format: probed.format,
buffer,
spec,
}));
}))
}

#[inline]
fn get_buffer(decoded: AudioBufferRef, spec: &SignalSpec) -> SampleBuffer<i16> {
let duration = units::Duration::from(decoded.capacity() as u64);
let mut buffer = SampleBuffer::<i16>::new(duration, spec.clone());
buffer.copy_interleaved_ref(decoded);
return buffer;
buffer
}
}

Expand Down

0 comments on commit 698ca2d

Please sign in to comment.