Skip to content

Commit 767e75c

Browse files
committed
fmt
1 parent 70fda63 commit 767e75c

2 files changed

Lines changed: 41 additions & 13 deletions

File tree

src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use futures_util::StreamExt;
2-
use librespot::{
3-
connect::Spirc,
4-
};
2+
use librespot::connect::Spirc;
53
use log::{error, info, warn};
64
use std::{
7-
env, ffi::OsStr, process::exit, sync::Arc, time::{Duration, Instant}
5+
env,
6+
ffi::OsStr,
7+
process::exit,
8+
sync::Arc,
9+
time::{Duration, Instant},
810
};
911
use tokio::sync::Semaphore;
1012

src/setup.rs

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ use librespot_playback::{mixer::Mixer, player::Player};
2525
use log::{debug, error, info, trace, warn};
2626
use sha1::{Digest, Sha1};
2727
use 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
};
3038
use sysinfo::{ProcessesToUpdate, System};
3139
use 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

Comments
 (0)