fix github-advanced-security comments

This commit is contained in:
Guillem Castro 2024-05-17 17:57:35 +02:00
parent 60a04f18d6
commit 2dc99e884b
2 changed files with 2 additions and 3 deletions

View file

@ -65,7 +65,7 @@ impl Downloader {
) -> Result<()> { ) -> Result<()> {
futures::stream::iter(tracks) futures::stream::iter(tracks)
.map(|track| { .map(|track| {
self.download_track(track, &options) self.download_track(track, options)
}) })
.buffer_unordered(options.parallel) .buffer_unordered(options.parallel)
.try_collect::<Vec<_>>() .try_collect::<Vec<_>>()

View file

@ -46,8 +46,7 @@ impl Encoder for Mp3Encoder {
move || { move || {
let samples: Vec<i16> = samples.samples.iter().map(|&x| x as i16).collect(); let samples: Vec<i16> = samples.samples.iter().map(|&x| x as i16).collect();
let input = InterleavedPcm(samples.as_slice()); let input = InterleavedPcm(samples.as_slice());
let mut mp3_out_buffer = Vec::new(); let mut mp3_out_buffer = Vec::with_capacity(mp3lame_encoder::max_required_buffer_size(samples.len()));
mp3_out_buffer.reserve(mp3lame_encoder::max_required_buffer_size(samples.len()));
let encoded_size = mp3_encoder let encoded_size = mp3_encoder
.encode(input, mp3_out_buffer.spare_capacity_mut()) .encode(input, mp3_out_buffer.spare_capacity_mut())
.map_err(|e| anyhow!("Failed to encode mp3: {}", e))?; .map_err(|e| anyhow!("Failed to encode mp3: {}", e))?;