Skip to content

Commit

Permalink
refactor: replace seek(SeekFrom::Current(0)) (#551)
Browse files Browse the repository at this point in the history
with more concise `stream_position()`
  • Loading branch information
hamirmahal authored Mar 10, 2024
1 parent 01ec33f commit 1d3a37a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/decoder/flac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn is_flac<R>(mut data: R) -> bool
where
R: Read + Seek,
{
let stream_pos = data.seek(SeekFrom::Current(0)).unwrap();
let stream_pos = data.stream_position().unwrap();

if FlacReader::new(data.by_ref()).is_err() {
data.seek(SeekFrom::Start(stream_pos)).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/decoder/vorbis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn is_vorbis<R>(mut data: R) -> bool
where
R: Read + Seek,
{
let stream_pos = data.seek(SeekFrom::Current(0)).unwrap();
let stream_pos = data.stream_position().unwrap();

if OggStreamReader::new(data.by_ref()).is_err() {
data.seek(SeekFrom::Start(stream_pos)).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/decoder/wav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn is_wave<R>(mut data: R) -> bool
where
R: Read + Seek,
{
let stream_pos = data.seek(SeekFrom::Current(0)).unwrap();
let stream_pos = data.stream_position().unwrap();

if WavReader::new(data.by_ref()).is_err() {
data.seek(SeekFrom::Start(stream_pos)).unwrap();
Expand Down

0 comments on commit 1d3a37a

Please sign in to comment.