refactor: remove unnecessary clone() calls (#550)

This commit is contained in:
Hamir Mahal 2024-03-09 18:15:03 -08:00 committed by GitHub
parent 698ca2d5c2
commit 77c5c5485c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -112,7 +112,7 @@ impl SymphoniaDecoder {
#[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());
let mut buffer = SampleBuffer::<i16>::new(duration, *spec);
buffer.copy_interleaved_ref(decoded);
buffer
}

View file

@ -349,9 +349,9 @@ fn supported_output_formats(
Ok(supported.into_iter().flat_map(|sf| {
let max_rate = sf.max_sample_rate();
let min_rate = sf.min_sample_rate();
let mut formats = vec![sf.clone().with_max_sample_rate()];
let mut formats = vec![sf.with_max_sample_rate()];
if HZ_44100 < max_rate && HZ_44100 > min_rate {
formats.push(sf.clone().with_sample_rate(HZ_44100))
formats.push(sf.with_sample_rate(HZ_44100))
}
formats.push(sf.with_sample_rate(min_rate));
formats