Migrate to Rust 2021

This commit is contained in:
Roderick van Domburg 2022-08-02 21:42:38 +02:00
parent ebfe8ca36c
commit 2a79af1f0a
No known key found for this signature in database
GPG key ID: 87F5FDE8A56219F4
19 changed files with 25 additions and 25 deletions

View file

@ -8,7 +8,7 @@ description = "An open source client library for Spotify, with support for Spoti
keywords = ["spotify"]
repository = "https://github.com/librespot-org/librespot"
readme = "README.md"
edition = "2018"
edition = "2021"
[workspace]

View file

@ -6,7 +6,7 @@ authors = ["Paul Lietar <paul@lietar.net>"]
description = "The audio fetching logic for librespot"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies.librespot-core]
path = "../core"

View file

@ -60,7 +60,7 @@ impl RangeSet {
self.ranges[index]
}
pub fn iter(&self) -> Iter<Range> {
pub fn iter(&self) -> Iter<'_, Range> {
self.ranges.iter()
}

View file

@ -6,7 +6,7 @@ authors = ["Paul Lietar <paul@lietar.net>"]
description = "The discovery and Spotify Connect logic for librespot"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies]
form_urlencoded = "1.0"

View file

@ -1443,7 +1443,7 @@ struct CommandSender<'a> {
}
impl<'a> CommandSender<'a> {
fn new(spirc: &'a mut SpircTask, cmd: MessageType) -> CommandSender {
fn new(spirc: &'a mut SpircTask, cmd: MessageType) -> CommandSender<'_> {
let mut frame = protocol::spirc::Frame::new();
frame.set_version(1);
frame.set_protocol_version(::std::convert::Into::into("2.0.0"));
@ -1455,7 +1455,7 @@ impl<'a> CommandSender<'a> {
CommandSender { spirc, frame }
}
fn recipient(mut self, recipient: &'a str) -> CommandSender {
fn recipient(mut self, recipient: &'a str) -> CommandSender<'_> {
self.frame.mut_recipient().push(recipient.to_owned());
self
}

View file

@ -7,7 +7,7 @@ build = "build.rs"
description = "The core functionality provided by librespot"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies.librespot-protocol]
path = "../protocol"

View file

@ -109,7 +109,7 @@ impl From<DeviceType> for &str {
}
impl fmt::Display for DeviceType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let str: &str = self.into();
f.write_str(str)
}

View file

@ -21,13 +21,13 @@ impl FileId {
}
impl fmt::Debug for FileId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("FileId").field(&self.to_base16()).finish()
}
}
impl fmt::Display for FileId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.to_base16().unwrap_or_default())
}
}

View file

@ -1,6 +1,5 @@
#[macro_use]
extern crate log;
extern crate num_derive;
use librespot_protocol as protocol;

View file

@ -274,7 +274,7 @@ impl SpotifyId {
}
impl fmt::Debug for SpotifyId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("SpotifyId")
.field(&self.to_uri().unwrap_or_else(|_| "invalid uri".into()))
.finish()
@ -282,7 +282,7 @@ impl fmt::Debug for SpotifyId {
}
impl fmt::Display for SpotifyId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.to_uri().unwrap_or_else(|_| "invalid uri".into()))
}
}
@ -345,7 +345,7 @@ impl Deref for NamedSpotifyId {
}
impl fmt::Debug for NamedSpotifyId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("NamedSpotifyId")
.field(
&self
@ -358,7 +358,7 @@ impl fmt::Debug for NamedSpotifyId {
}
impl fmt::Display for NamedSpotifyId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(
&self
.inner_id

View file

@ -6,7 +6,7 @@ authors = ["Paul Lietar <paul@lietar.net>"]
description = "The discovery logic for librespot"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies]
aes = "0.8"

View file

@ -6,7 +6,7 @@ authors = ["Paul Lietar <paul@lietar.net>"]
description = "The metadata logic for librespot"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies]
async-trait = "0.1"

View file

@ -74,11 +74,11 @@ impl_from_repeated_copy!(RestrictionCatalogue, RestrictionCatalogues);
struct StrChunks<'s>(&'s str, usize);
trait StrChunksExt {
fn chunks(&self, size: usize) -> StrChunks;
fn chunks(&self, size: usize) -> StrChunks<'_>;
}
impl StrChunksExt for str {
fn chunks(&self, size: usize) -> StrChunks {
fn chunks(&self, size: usize) -> StrChunks<'_> {
StrChunks(self, size)
}
}

View file

@ -6,14 +6,16 @@ authors = ["Sasha Hilton <sashahilton00@gmail.com>"]
description = "The audio playback logic for librespot"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies.librespot-audio]
path = "../audio"
version = "0.5.0-dev"
[dependencies.librespot-core]
path = "../core"
version = "0.5.0-dev"
[dependencies.librespot-metadata]
path = "../metadata"
version = "0.5.0-dev"

View file

@ -126,7 +126,7 @@ pub const BACKENDS: &[(&str, SinkBuilder)] = &[
#[cfg(feature = "alsa-backend")]
(AlsaSink::NAME, mk_sink::<AlsaSink>),
#[cfg(feature = "portaudio-backend")]
(PortAudioSink::NAME, mk_sink::<PortAudioSink>),
(PortAudioSink::NAME, mk_sink::<PortAudioSink<'_>>),
#[cfg(feature = "pulseaudio-backend")]
(PulseAudioSink::NAME, mk_sink::<PulseAudioSink>),
#[cfg(feature = "jackaudio-backend")]

View file

@ -2132,7 +2132,7 @@ impl Drop for PlayerInternal {
}
impl fmt::Debug for PlayerCommand {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
PlayerCommand::Load {
track_id,

View file

@ -7,7 +7,7 @@ build = "build.rs"
description = "The protobuf logic for communicating with Spotify servers"
license = "MIT"
repository = "https://github.com/librespot-org/librespot"
edition = "2018"
edition = "2021"
[dependencies]
protobuf = "2"

View file

@ -1,4 +1,3 @@
extern crate protobuf;
// This file is parsed by build.rs
// Each included module will be compiled from the matching .proto definition.

View file

@ -1 +1 @@
edition = "2018"
edition = "2021"