diff --git a/src/download.rs b/src/download.rs index 23eb7f3..eea27f5 100644 --- a/src/download.rs +++ b/src/download.rs @@ -65,7 +65,7 @@ impl Downloader { ) -> Result<()> { futures::stream::iter(tracks) .map(|track| { - self.download_track(track, &options) + self.download_track(track, options) }) .buffer_unordered(options.parallel) .try_collect::>() diff --git a/src/encoder/mp3.rs b/src/encoder/mp3.rs index 779d4d3..87f0098 100644 --- a/src/encoder/mp3.rs +++ b/src/encoder/mp3.rs @@ -46,8 +46,7 @@ impl Encoder for Mp3Encoder { move || { let samples: Vec = samples.samples.iter().map(|&x| x as i16).collect(); let input = InterleavedPcm(samples.as_slice()); - let mut mp3_out_buffer = Vec::new(); - mp3_out_buffer.reserve(mp3lame_encoder::max_required_buffer_size(samples.len())); + let mut mp3_out_buffer = Vec::with_capacity(mp3lame_encoder::max_required_buffer_size(samples.len())); let encoded_size = mp3_encoder .encode(input, mp3_out_buffer.spare_capacity_mut()) .map_err(|e| anyhow!("Failed to encode mp3: {}", e))?;