Skip to content

Commit c162cee

Browse files
removed redundunt cloning
1 parent a7b96c2 commit c162cee

File tree

1 file changed

+2
-5
lines changed
  • src/host/coreaudio/macos

1 file changed

+2
-5
lines changed

src/host/coreaudio/macos/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,10 @@ impl Device {
321321
});
322322
Ok(res.collect::<Vec<_>>().into_iter())
323323
} else {
324-
let values = ranges.into_iter().map(|v| v.mMinimum as u32); //assume that all mMinimum and mMaximum values are the same
325-
let min = values.clone().min().expect("the list must not be empty");
326-
let max = values.max().expect("the list must not be empty");
327324
let fmt = SupportedStreamConfigRange {
328325
channels: n_channels as ChannelCount,
329-
min_sample_rate: SampleRate(min),
330-
max_sample_rate: SampleRate(max),
326+
min_sample_rate: SampleRate(ranges.into_iter().map(|v| v.mMinimum as u32).min().expect("the list must not be empty")),
327+
max_sample_rate: SampleRate(ranges.into_iter().map(|v| v.mMaximum as u32).max().expect("the list must not be empty")),
331328
buffer_size,
332329
sample_format,
333330
};

0 commit comments

Comments
 (0)