mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
fix clippy warnings
This commit is contained in:
parent
f72048e5e1
commit
7f2cb684c9
8 changed files with 10 additions and 16 deletions
|
@ -1138,7 +1138,7 @@ impl SpircTask {
|
||||||
self.state.set_status(PlayStatus::kPlayStatusPlay);
|
self.state.set_status(PlayStatus::kPlayStatusPlay);
|
||||||
self.update_state_position(position_ms);
|
self.update_state_position(position_ms);
|
||||||
self.play_status = SpircPlayStatus::Playing {
|
self.play_status = SpircPlayStatus::Playing {
|
||||||
nominal_start_time: self.now_ms() as i64 - position_ms as i64,
|
nominal_start_time: self.now_ms() - position_ms as i64,
|
||||||
preloading_of_next_track_triggered,
|
preloading_of_next_track_triggered,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,5 +173,5 @@ where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let v: String = serde::Deserialize::deserialize(de)?;
|
let v: String = serde::Deserialize::deserialize(de)?;
|
||||||
base64::decode(&v).map_err(|e| serde::de::Error::custom(e.to_string()))
|
base64::decode(v).map_err(|e| serde::de::Error::custom(e.to_string()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl RequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_get_info(&self) -> Response<hyper::Body> {
|
fn handle_get_info(&self) -> Response<hyper::Body> {
|
||||||
let public_key = base64::encode(&self.keys.public_key());
|
let public_key = base64::encode(self.keys.public_key());
|
||||||
let device_type: &str = self.config.device_type.into();
|
let device_type: &str = self.config.device_type.into();
|
||||||
let mut active_user = String::new();
|
let mut active_user = String::new();
|
||||||
if let Some(username) = &self.username {
|
if let Some(username) = &self.username {
|
||||||
|
@ -139,7 +139,7 @@ impl RequestHandler {
|
||||||
let encrypted = &encrypted_blob[16..encrypted_blob_len - 20];
|
let encrypted = &encrypted_blob[16..encrypted_blob_len - 20];
|
||||||
let cksum = &encrypted_blob[encrypted_blob_len - 20..encrypted_blob_len];
|
let cksum = &encrypted_blob[encrypted_blob_len - 20..encrypted_blob_len];
|
||||||
|
|
||||||
let base_key = Sha1::digest(&shared_key);
|
let base_key = Sha1::digest(shared_key);
|
||||||
let base_key = &base_key[..16];
|
let base_key = &base_key[..16];
|
||||||
|
|
||||||
let checksum_key = {
|
let checksum_key = {
|
||||||
|
@ -179,7 +179,7 @@ impl RequestHandler {
|
||||||
data
|
data
|
||||||
};
|
};
|
||||||
|
|
||||||
let credentials = Credentials::with_blob(username, &decrypted, &self.config.device_id)?;
|
let credentials = Credentials::with_blob(username, decrypted, &self.config.device_id)?;
|
||||||
|
|
||||||
self.tx.send(credentials)?;
|
self.tx.send(credentials)?;
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl AudioItem {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
let popularity = track.popularity.max(0).min(100) as u8;
|
let popularity = track.popularity.clamp(0, 100) as u8;
|
||||||
let number = track.number.max(0) as u32;
|
let number = track.number.max(0) as u32;
|
||||||
let disc_number = track.disc_number.max(0) as u32;
|
let disc_number = track.disc_number.max(0) as u32;
|
||||||
|
|
||||||
|
|
|
@ -76,13 +76,7 @@ impl Converter {
|
||||||
let min = -factor;
|
let min = -factor;
|
||||||
let max = factor - 1.0;
|
let max = factor - 1.0;
|
||||||
|
|
||||||
if int_value < min {
|
int_value.clamp(min, max)
|
||||||
min
|
|
||||||
} else if int_value > max {
|
|
||||||
max
|
|
||||||
} else {
|
|
||||||
int_value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f64_to_f32(&mut self, samples: &[f64]) -> Vec<f32> {
|
pub fn f64_to_f32(&mut self, samples: &[f64]) -> Vec<f32> {
|
||||||
|
|
|
@ -15,6 +15,6 @@ pub mod player;
|
||||||
|
|
||||||
pub const SAMPLE_RATE: u32 = 44100;
|
pub const SAMPLE_RATE: u32 = 44100;
|
||||||
pub const NUM_CHANNELS: u8 = 2;
|
pub const NUM_CHANNELS: u8 = 2;
|
||||||
pub const SAMPLES_PER_SECOND: u32 = SAMPLE_RATE as u32 * NUM_CHANNELS as u32;
|
pub const SAMPLES_PER_SECOND: u32 = SAMPLE_RATE * NUM_CHANNELS as u32;
|
||||||
pub const PAGES_PER_MS: f64 = SAMPLE_RATE as f64 / 1000.0;
|
pub const PAGES_PER_MS: f64 = SAMPLE_RATE as f64 / 1000.0;
|
||||||
pub const MS_PER_PAGE: f64 = 1000.0 / SAMPLE_RATE as f64;
|
pub const MS_PER_PAGE: f64 = 1000.0 / SAMPLE_RATE as f64;
|
||||||
|
|
|
@ -1311,7 +1311,7 @@ impl Future for PlayerInternal {
|
||||||
self.send_event(PlayerEvent::PositionCorrection {
|
self.send_event(PlayerEvent::PositionCorrection {
|
||||||
play_request_id,
|
play_request_id,
|
||||||
track_id,
|
track_id,
|
||||||
position_ms: new_stream_position_ms as u32,
|
position_ms: new_stream_position_ms,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn out_dir() -> PathBuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cleanup() {
|
fn cleanup() {
|
||||||
let _ = fs::remove_dir_all(&out_dir());
|
let _ = fs::remove_dir_all(out_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile() {
|
fn compile() {
|
||||||
|
|
Loading…
Reference in a new issue