diff --git a/Cargo.toml b/Cargo.toml index e02c6990..7a423d76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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] diff --git a/audio/Cargo.toml b/audio/Cargo.toml index e6649b20..eaa84313 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Paul Lietar "] 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" diff --git a/audio/src/range_set.rs b/audio/src/range_set.rs index 9c4b0b87..ee9136f2 100644 --- a/audio/src/range_set.rs +++ b/audio/src/range_set.rs @@ -60,7 +60,7 @@ impl RangeSet { self.ranges[index] } - pub fn iter(&self) -> Iter { + pub fn iter(&self) -> Iter<'_, Range> { self.ranges.iter() } diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 2caa9f33..108a3804 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Paul Lietar "] 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" diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 6adb340c..b8c60a85 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -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 } diff --git a/core/Cargo.toml b/core/Cargo.toml index d64590c2..c2988bb8 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -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" diff --git a/core/src/config.rs b/core/src/config.rs index 46f11fe8..7c5f75a1 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -109,7 +109,7 @@ impl From 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) } diff --git a/core/src/file_id.rs b/core/src/file_id.rs index 5422c428..1e84b489 100644 --- a/core/src/file_id.rs +++ b/core/src/file_id.rs @@ -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()) } } diff --git a/core/src/lib.rs b/core/src/lib.rs index a0f180ca..d476d917 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,6 +1,5 @@ #[macro_use] extern crate log; -extern crate num_derive; use librespot_protocol as protocol; diff --git a/core/src/spotify_id.rs b/core/src/spotify_id.rs index 3db010e9..227fa526 100644 --- a/core/src/spotify_id.rs +++ b/core/src/spotify_id.rs @@ -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 diff --git a/discovery/Cargo.toml b/discovery/Cargo.toml index ebbfb809..c2274fbe 100644 --- a/discovery/Cargo.toml +++ b/discovery/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Paul Lietar "] description = "The discovery logic for librespot" license = "MIT" repository = "https://github.com/librespot-org/librespot" -edition = "2018" +edition = "2021" [dependencies] aes = "0.8" diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index 0d86cd29..490b5227 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Paul Lietar "] description = "The metadata logic for librespot" license = "MIT" repository = "https://github.com/librespot-org/librespot" -edition = "2018" +edition = "2021" [dependencies] async-trait = "0.1" diff --git a/metadata/src/restriction.rs b/metadata/src/restriction.rs index 51035a6c..565010ff 100644 --- a/metadata/src/restriction.rs +++ b/metadata/src/restriction.rs @@ -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) } } diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 39e87261..a8d43b68 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -6,14 +6,16 @@ authors = ["Sasha Hilton "] 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" diff --git a/playback/src/audio_backend/mod.rs b/playback/src/audio_backend/mod.rs index 959bf17d..05822395 100644 --- a/playback/src/audio_backend/mod.rs +++ b/playback/src/audio_backend/mod.rs @@ -126,7 +126,7 @@ pub const BACKENDS: &[(&str, SinkBuilder)] = &[ #[cfg(feature = "alsa-backend")] (AlsaSink::NAME, mk_sink::), #[cfg(feature = "portaudio-backend")] - (PortAudioSink::NAME, mk_sink::), + (PortAudioSink::NAME, mk_sink::>), #[cfg(feature = "pulseaudio-backend")] (PulseAudioSink::NAME, mk_sink::), #[cfg(feature = "jackaudio-backend")] diff --git a/playback/src/player.rs b/playback/src/player.rs index 1ebf42d7..30d6d2a2 100644 --- a/playback/src/player.rs +++ b/playback/src/player.rs @@ -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, diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index aa5f4496..36d00c2b 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -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" diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 94180d54..224043e7 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -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. diff --git a/rustfmt.toml b/rustfmt.toml index 32a9786f..3a26366d 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1 @@ -edition = "2018" +edition = "2021"