Skip to content

Commit

Permalink
revert rustfmt.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
photovoltex committed Sep 29, 2024
1 parent 9684cfa commit 959993a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 29 deletions.
8 changes: 6 additions & 2 deletions connect/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
use crate::core::spotify_id::SpotifyId;
use crate::protocol::spirc::TrackRef;

use librespot_protocol::player::{ContextPage, ContextTrack};
use serde::{
de::{Error, Unexpected},
Deserialize,
};
use librespot_protocol::player::{ContextPage, ContextTrack};

#[derive(Deserialize, Debug, Default, Clone)]
pub struct StationContext {
Expand Down Expand Up @@ -92,7 +92,11 @@ impl From<PageContext> for ContextPage {
fn from(value: PageContext) -> Self {
Self {
next_page_url: value.next_page_url,
tracks: value.tracks.into_iter().map(track_ref_to_context_track).collect(),
tracks: value
.tracks
.into_iter()
.map(track_ref_to_context_track)
.collect(),
loading: false,
..Default::default()
}
Expand Down
16 changes: 6 additions & 10 deletions connect/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,7 @@ impl ConnectState {
}

pub fn move_to_next_track(&mut self) -> Result<u32, ConnectStateError> {
let old_track = self
.player
.track
.take();
let old_track = self.player.track.take();

if let Some(old_track) = old_track {
// only add songs not from the queue to our previous tracks
Expand All @@ -261,7 +258,7 @@ impl ConnectState {
self.player.prev_tracks.remove(0);
}
self.player.prev_tracks.push(old_track);
}
}
}

if self.player.next_tracks.is_empty() {
Expand Down Expand Up @@ -302,10 +299,7 @@ impl ConnectState {
pub fn move_to_prev_track(
&mut self,
) -> Result<&MessageField<ProvidedTrack>, ConnectStateError> {
let old_track = self
.player
.track
.take();
let old_track = self.player.track.take();

if let Some(old_track) = old_track {
if old_track.provider != QUEUE_PROVIDER {
Expand Down Expand Up @@ -340,7 +334,9 @@ impl ConnectState {
.player
.index
.as_mut()
.ok_or(ConnectStateError::MessageFieldNone("player.index".to_string()))?;
.ok_or(ConnectStateError::MessageFieldNone(
"player.index".to_string(),
))?;

index.track -= 1;

Expand Down
32 changes: 16 additions & 16 deletions core/src/spclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@ use std::{
time::{Duration, Instant},
};

use byteorder::{BigEndian, ByteOrder};
use bytes::Bytes;
use data_encoding::HEXUPPER_PERMISSIVE;
use futures_util::future::IntoStream;
use http::header::HeaderValue;
use hyper::{
header::{HeaderName, ACCEPT, AUTHORIZATION, CONTENT_TYPE, RANGE},
HeaderMap, Method, Request,
};
use hyper_util::client::legacy::ResponseFuture;
use protobuf::{Enum, Message, MessageFull};
use rand::RngCore;
use sha1::{Digest, Sha1};
use sysinfo::System;
use thiserror::Error;
use librespot_protocol::player::Context;
use crate::{
apresolve::SocketAddress,
cdn_url::CdnUrl,
Expand All @@ -38,6 +22,22 @@ use crate::{
version::spotify_semantic_version,
Error, FileId, SpotifyId,
};
use byteorder::{BigEndian, ByteOrder};
use bytes::Bytes;
use data_encoding::HEXUPPER_PERMISSIVE;
use futures_util::future::IntoStream;
use http::header::HeaderValue;
use hyper::{
header::{HeaderName, ACCEPT, AUTHORIZATION, CONTENT_TYPE, RANGE},
HeaderMap, Method, Request,
};
use hyper_util::client::legacy::ResponseFuture;
use librespot_protocol::player::Context;
use protobuf::{Enum, Message, MessageFull};
use rand::RngCore;
use sha1::{Digest, Sha1};
use sysinfo::System;
use thiserror::Error;

component! {
SpClient : SpClientInner {
Expand Down
1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
edition = "2021"
group_imports = "StdExternalCrate"

0 comments on commit 959993a

Please sign in to comment.