Update Spirc depreciated rand method

This commit is contained in:
Sasha Hilton 2019-03-10 17:48:19 +01:00
parent 0a9a293315
commit 0686fe545f

View file

@ -18,7 +18,7 @@ use playback::mixer::Mixer;
use playback::player::Player; use playback::player::Player;
use rand; use rand;
use rand::Rng; use rand::seq::SliceRandom;
use std; use std;
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
@ -508,7 +508,8 @@ impl SpircTask {
let tracks = self.state.mut_track(); let tracks = self.state.mut_track();
tracks.swap(0, current_index as usize); tracks.swap(0, current_index as usize);
if let Some((_, rest)) = tracks.split_first_mut() { if let Some((_, rest)) = tracks.split_first_mut() {
rand::thread_rng().shuffle(rest); let mut rng = rand::thread_rng();
rest.shuffle(&mut rng);
} }
} }
self.state.set_playing_track_index(0); self.state.set_playing_track_index(0);