Ver Fonte

Update Spirc depreciated rand method

Sasha Hilton há 6 anos atrás
pai
commit
0686fe545f
1 ficheiros alterados com 3 adições e 2 exclusões
  1. 3 2
      connect/src/spirc.rs

+ 3 - 2
connect/src/spirc.rs

@@ -18,7 +18,7 @@ use playback::mixer::Mixer;
 use playback::player::Player;
 
 use rand;
-use rand::Rng;
+use rand::seq::SliceRandom;
 use std;
 use std::time::{SystemTime, UNIX_EPOCH};
 
@@ -508,7 +508,8 @@ impl SpircTask {
                         let tracks = self.state.mut_track();
                         tracks.swap(0, current_index as usize);
                         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);