diff --git a/Cargo.toml b/Cargo.toml index a42e2b2d..6605b8a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,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" [workspace] diff --git a/examples/play.rs b/examples/play.rs index 87f68825..c619b591 100644 --- a/examples/play.rs +++ b/examples/play.rs @@ -1,6 +1,3 @@ -extern crate librespot; -extern crate tokio_core; - use std::env; use tokio_core::reactor::Core; diff --git a/examples/playlist_tracks.rs b/examples/playlist_tracks.rs index 5d6aec59..3e4202d5 100644 --- a/examples/playlist_tracks.rs +++ b/examples/playlist_tracks.rs @@ -1,11 +1,5 @@ -extern crate log; -extern crate env_logger; - -extern crate librespot; -extern crate tokio_core; -extern crate tokio_io; -extern crate futures; +use env_logger; use std::env; use tokio_core::reactor::Core; diff --git a/src/lib.rs b/src/lib.rs index f73db1ab..610062e2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,15 +1,6 @@ #![crate_name = "librespot"] #![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))] -extern crate base64; -extern crate futures; -extern crate hyper; -extern crate num_bigint; -extern crate protobuf; -extern crate rand; -extern crate tokio_core; -extern crate url; - pub extern crate librespot_audio as audio; pub extern crate librespot_connect as connect; pub extern crate librespot_core as core; diff --git a/src/main.rs b/src/main.rs index e193257b..db197269 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,7 @@ -extern crate env_logger; -extern crate futures; -extern crate getopts; -extern crate librespot; -#[macro_use] -extern crate log; -extern crate hex; -extern crate rpassword; -extern crate sha1; -extern crate tokio_core; -extern crate tokio_io; -extern crate tokio_process; -extern crate tokio_signal; -extern crate url; - use futures::sync::mpsc::UnboundedReceiver; use futures::{Async, Future, Poll, Stream}; use sha1::{Digest, Sha1}; +use log::{error, info, trace, warn}; use std::env; use std::io::{self, stderr, Write}; use std::mem; @@ -40,7 +26,7 @@ use librespot::playback::mixer::{self, Mixer, MixerConfig}; use librespot::playback::player::{Player, PlayerEvent}; mod player_event_handler; -use player_event_handler::run_program_on_events; +use crate::player_event_handler::run_program_on_events; fn device_id(name: &str) -> String { hex::encode(Sha1::digest(name.as_bytes())) @@ -86,10 +72,10 @@ fn list_backends() { #[derive(Clone)] struct Setup { - backend: fn(Option) -> Box, + backend: fn(Option) -> Box, device: Option, - mixer: fn(Option) -> Box, + mixer: fn(Option) -> Box, cache: Option, player_config: PlayerConfig, @@ -367,9 +353,9 @@ struct Main { player_config: PlayerConfig, session_config: SessionConfig, connect_config: ConnectConfig, - backend: fn(Option) -> Box, + backend: fn(Option) -> Box, device: Option, - mixer: fn(Option) -> Box, + mixer: fn(Option) -> Box, mixer_config: MixerConfig, handle: Handle, @@ -378,7 +364,7 @@ struct Main { spirc: Option, spirc_task: Option, - connect: Box>, + connect: Box>, shutdown: bool, diff --git a/src/player_event_handler.rs b/src/player_event_handler.rs index 1e682b98..6da600b8 100644 --- a/src/player_event_handler.rs +++ b/src/player_event_handler.rs @@ -1,3 +1,4 @@ +use log::info; use librespot::playback::player::PlayerEvent; use tokio_process::{Child, CommandExt}; use std::collections::HashMap;