Skip to content

Commit 041f084

Browse files
committed
Fix warnings
1 parent 3134e1a commit 041f084

8 files changed

Lines changed: 14 additions & 11 deletions

File tree

connect/src/spirc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl Spirc {
272272
.flatten_stream()
273273
.map(|response| -> Frame {
274274
let data = response.payload.first().unwrap();
275-
protobuf::parse_from_bytes(data).unwrap()
275+
Frame::parse_from_bytes(data).unwrap()
276276
}),
277277
);
278278

core/src/connection/handshake.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ where
102102
let header = read_into_accumulator(connection, 4, acc).await?;
103103
let size = BigEndian::read_u32(header) as usize;
104104
let data = read_into_accumulator(connection, size - 4, acc).await?;
105-
let message = protobuf::parse_from_bytes(data).unwrap();
105+
let message = M::parse_from_bytes(data).unwrap();
106106
Ok(message)
107107
}
108108

core/src/connection/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub async fn authenticate(
146146
let (cmd, data) = transport.next().await.expect("EOF")?;
147147
match cmd {
148148
0xac => {
149-
let welcome_data: APWelcome = protobuf::parse_from_bytes(data.as_ref())?;
149+
let welcome_data = APWelcome::parse_from_bytes(data.as_ref())?;
150150

151151
let reusable_credentials = Credentials {
152152
username: welcome_data.get_canonical_username().to_owned(),
@@ -157,7 +157,7 @@ pub async fn authenticate(
157157
Ok(reusable_credentials)
158158
}
159159
0xad => {
160-
let error_data: APLoginFailed = protobuf::parse_from_bytes(data.as_ref())?;
160+
let error_data = APLoginFailed::parse_from_bytes(data.as_ref())?;
161161
Err(error_data.into())
162162
}
163163
_ => {

core/src/mercury/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::task::Poll;
88
use byteorder::{BigEndian, ByteOrder};
99
use bytes::Bytes;
1010
use futures_util::FutureExt;
11+
use protobuf::Message;
1112
use tokio::sync::{mpsc, oneshot};
1213

1314
use crate::protocol;
@@ -123,8 +124,8 @@ impl MercuryManager {
123124
if !response.payload.is_empty() {
124125
// Old subscription protocol, watch the provided list of URIs
125126
for sub in response.payload {
126-
let mut sub: protocol::pubsub::Subscription =
127-
protobuf::parse_from_bytes(&sub).unwrap();
127+
let mut sub =
128+
protocol::pubsub::Subscription::parse_from_bytes(&sub).unwrap();
128129
let sub_uri = sub.take_uri();
129130

130131
debug!("subscribed sub_uri={}", sub_uri);
@@ -192,7 +193,7 @@ impl MercuryManager {
192193

193194
fn complete_request(&self, cmd: u8, mut pending: MercuryPending) {
194195
let header_data = pending.parts.remove(0);
195-
let header: protocol::mercury::Header = protobuf::parse_from_bytes(&header_data).unwrap();
196+
let header = protocol::mercury::Header::parse_from_bytes(&header_data).unwrap();
196197

197198
let response = MercuryResponse {
198199
uri: header.get_uri().to_string(),

core/src/spotify_id.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::wrong_self_convention)]
2+
13
use std::convert::TryInto;
24
use std::fmt;
35

examples/playlist_tracks.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use env_logger;
21
use std::env;
32

43
use librespot::core::authentication::Credentials;

metadata/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use librespot_core::mercury::MercuryError;
1414
use librespot_core::session::Session;
1515
use librespot_core::spotify_id::{FileId, SpotifyAudioType, SpotifyId};
1616
use librespot_protocol as protocol;
17+
use protobuf::Message;
1718

1819
pub use crate::protocol::metadata::AudioFile_Format as FileFormat;
1920

@@ -123,7 +124,7 @@ pub trait Metadata: Send + Sized + 'static {
123124
let uri = Self::request_url(id);
124125
let response = session.mercury().get(uri).await?;
125126
let data = response.payload.first().expect("Empty payload");
126-
let msg: Self::Message = protobuf::parse_from_bytes(data).unwrap();
127+
let msg = Self::Message::parse_from_bytes(data).unwrap();
127128

128129
Ok(Self::parse(&msg, &session))
129130
}

playback/src/player.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,10 @@ impl PlayerState {
538538
play_request_id,
539539
loaded_track: PlayerLoadedTrackData {
540540
decoder,
541-
duration_ms,
542-
bytes_per_second,
543541
normalisation_factor,
544542
stream_loader_controller,
543+
bytes_per_second,
544+
duration_ms,
545545
stream_position_pcm,
546546
},
547547
};

0 commit comments

Comments
 (0)