@@ -25,7 +25,15 @@ use librespot_playback::{mixer::Mixer, player::Player};
2525use log:: { debug, error, info, trace, warn} ;
2626use sha1:: { Digest , Sha1 } ;
2727use std:: {
28- env, fs:: create_dir_all, ops:: RangeInclusive , path:: { Path , PathBuf } , pin:: Pin , process:: exit, str:: FromStr , sync:: Arc , time:: Duration
28+ env,
29+ fs:: create_dir_all,
30+ ops:: RangeInclusive ,
31+ path:: { Path , PathBuf } ,
32+ pin:: Pin ,
33+ process:: exit,
34+ str:: FromStr ,
35+ sync:: Arc ,
36+ time:: Duration ,
2937} ;
3038use sysinfo:: { ProcessesToUpdate , System } ;
3139use thiserror:: Error ;
@@ -260,8 +268,10 @@ impl Setup {
260268 }
261269 }
262270 }
263- } ;
264- } else { None }
271+ }
272+ } else {
273+ None
274+ }
265275 }
266276
267277 pub fn get_credentials ( & self , connecting : & mut bool ) -> Option < Arc < Credentials > > {
@@ -289,8 +299,12 @@ impl Setup {
289299 exit ( 1 ) ;
290300 } ) ;
291301 * connecting = true ;
292- Some ( Arc :: new ( Credentials :: with_access_token ( oauth_token. access_token ) ) )
293- } else { None }
302+ Some ( Arc :: new ( Credentials :: with_access_token (
303+ oauth_token. access_token ,
304+ ) ) )
305+ } else {
306+ None
307+ }
294308 }
295309
296310 pub fn get_mixer ( & self ) -> Arc < dyn Mixer > {
@@ -326,12 +340,24 @@ impl Setup {
326340 } ) ) ) ;
327341 }
328342 handler
329- } else { None }
343+ } else {
344+ None
345+ }
330346 }
331347
332- pub async fn get_spirc ( & self , session : Session , credentials : Credentials , player : Arc < Player > , mixer : Arc < dyn Mixer > ) -> ( Option < Spirc > , Option < Pin < Box < impl Future < Output = ( ) > + ' static > > > ) {
348+ pub async fn get_spirc (
349+ & self ,
350+ session : Session ,
351+ credentials : Credentials ,
352+ player : Arc < Player > ,
353+ mixer : Arc < dyn Mixer > ,
354+ ) -> (
355+ Option < Spirc > ,
356+ Option < Pin < Box < impl Future < Output = ( ) > + ' static > > > ,
357+ ) {
333358 let connect_config = self . connect_config . clone ( ) ;
334- let ( spirc_, spirc_task_) = match Spirc :: new ( connect_config, session, credentials, player, mixer) . await {
359+ let ( spirc_, spirc_task_) =
360+ match Spirc :: new ( connect_config, session, credentials, player, mixer) . await {
335361 Ok ( ( spirc_, spirc_task_) ) => ( spirc_, spirc_task_) ,
336362 Err ( e) => {
337363 error ! ( "could not initialize spirc: {e}" ) ;
@@ -1978,4 +2004,4 @@ pub async fn get_setup() -> Setup {
19782004 zeroconf_ip,
19792005 zeroconf_backend,
19802006 }
1981- }
2007+ }
0 commit comments