diff --git a/src/spotify.rs b/src/spotify.rs index 19665a68c..de295ceec 100644 --- a/src/spotify.rs +++ b/src/spotify.rs @@ -83,11 +83,10 @@ impl Spotify { spotify.set_volume(volume); spotify.api.set_worker_channel(spotify.channel.clone()); - ASYNC_RUNTIME - .get() - .unwrap() - .block_on(spotify.api.update_token().unwrap()) - .ok(); + spotify + .api + .update_token() + .map(move |h| ASYNC_RUNTIME.get().unwrap().block_on(h).ok()); spotify.api.set_user(user); diff --git a/src/spotify_api.rs b/src/spotify_api.rs index 04b60ed49..d3b4a5609 100644 --- a/src/spotify_api.rs +++ b/src/spotify_api.rs @@ -117,8 +117,7 @@ impl WebApi { } })) } else { - error!("worker channel is not set"); - None + panic!("worker channel is not set"); } } diff --git a/src/ui/search_results.rs b/src/ui/search_results.rs index 4074cc7d3..0a604b6f2 100644 --- a/src/ui/search_results.rs +++ b/src/ui/search_results.rs @@ -392,11 +392,10 @@ impl SearchResultsView { // check if API token refresh is necessary before commencing multiple // requests to avoid deadlock, as the parallel requests might // simultaneously try to refresh the token - ASYNC_RUNTIME - .get() - .unwrap() - .block_on(self.spotify.api.update_token().unwrap()) - .ok(); + self.spotify + .api + .update_token() + .map(move |h| ASYNC_RUNTIME.get().unwrap().block_on(h).ok()); // is the query a Spotify URI? if let Ok(uritype) = query.parse() {