From 71d42d489ec17a428254e1ecc3fc30c974f4f19e Mon Sep 17 00:00:00 2001 From: Henrik Friedrichsen Date: Tue, 4 May 2021 22:51:03 +0200 Subject: [PATCH] Remove `extern crate` statements https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html --- src/album.rs | 1 + src/commands.rs | 1 + src/config.rs | 1 + src/library.rs | 1 + src/main.rs | 32 +------------------------------- src/mpris.rs | 4 +--- src/playlist.rs | 1 + src/queue.rs | 1 + src/spotify.rs | 1 + src/spotify_worker.rs | 1 + src/theme.rs | 1 + src/ui/layout.rs | 1 + src/ui/listview.rs | 1 + src/ui/pagination.rs | 4 ++-- 14 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/album.rs b/src/album.rs index 93d70e5..5e42128 100644 --- a/src/album.rs +++ b/src/album.rs @@ -2,6 +2,7 @@ use std::fmt; use std::sync::Arc; use chrono::{DateTime, Utc}; +use log::debug; use rspotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum}; use crate::artist::Artist; diff --git a/src/commands.rs b/src/commands.rs index 9c019eb..f9cd9bb 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -25,6 +25,7 @@ use cursive::event::{Event, Key}; use cursive::traits::View; use cursive::views::Dialog; use cursive::Cursive; +use log::{debug, error, info}; use std::cell::RefCell; pub enum CommandResult { diff --git a/src/config.rs b/src/config.rs index 9f6e141..3c32a8a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -4,6 +4,7 @@ use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::{fs, process}; use cursive::theme::Theme; +use log::{debug, error}; use platform_dirs::AppDirs; use crate::command::{SortDirection, SortKey}; diff --git a/src/library.rs b/src/library.rs index 465e395..2099fd0 100644 --- a/src/library.rs +++ b/src/library.rs @@ -5,6 +5,7 @@ use std::path::PathBuf; use std::sync::{Arc, RwLock, RwLockReadGuard}; use std::thread; +use log::{debug, error, info}; use serde::de::DeserializeOwned; use serde::Serialize; diff --git a/src/main.rs b/src/main.rs index ca16893..0666fa8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,39 +1,9 @@ -extern crate clap; -extern crate crossbeam_channel; #[macro_use] extern crate cursive; -#[cfg(feature = "share_clipboard")] -extern crate clipboard; -extern crate failure; -extern crate futures; #[macro_use] extern crate lazy_static; -extern crate librespot_core; -extern crate librespot_playback; -extern crate librespot_protocol; -extern crate rspotify; -extern crate tokio_core; -extern crate tokio_timer; -extern crate unicode_width; -extern crate webbrowser; - #[macro_use] extern crate serde; -extern crate serde_json; -extern crate toml; - -#[macro_use] -extern crate log; -extern crate chrono; -extern crate fern; - -extern crate rand; -extern crate url; - -extern crate strum; -extern crate strum_macros; - -extern crate regex; use std::fs; use std::path::PathBuf; @@ -42,10 +12,10 @@ use std::sync::Arc; use clap::{App, Arg}; use cursive::traits::Identifiable; - use librespot_core::authentication::Credentials; use librespot_core::cache::Cache; use librespot_playback::audio_backend; +use log::{info, trace}; mod album; mod artist; diff --git a/src/mpris.rs b/src/mpris.rs index 955465d..b90a64f 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -1,6 +1,3 @@ -extern crate dbus; -extern crate dbus_tree; - use std::collections::HashMap; use std::rc::Rc; use std::sync::{mpsc, Arc}; @@ -11,6 +8,7 @@ use dbus::ffidisp::stdintf::org_freedesktop_dbus::PropertiesPropertiesChanged; use dbus::message::SignalArgs; use dbus::strings::Path; use dbus_tree::{Access, Factory}; +use log::{debug, warn}; use crate::album::Album; use crate::episode::Episode; diff --git a/src/playlist.rs b/src/playlist.rs index 94d80dc..02e197b 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -1,6 +1,7 @@ use std::sync::Arc; use std::{cmp::Ordering, iter::Iterator}; +use log::debug; use rspotify::model::playlist::{FullPlaylist, SimplifiedPlaylist}; use crate::playable::Playable; diff --git a/src/queue.rs b/src/queue.rs index a9f24ce..bec13b0 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -1,6 +1,7 @@ use std::cmp::Ordering; use std::sync::{Arc, RwLock}; +use log::{debug, error, info}; #[cfg(feature = "notify")] use notify_rust::Notification; diff --git a/src/spotify.rs b/src/spotify.rs index 96750ea..c279dd5 100644 --- a/src/spotify.rs +++ b/src/spotify.rs @@ -5,6 +5,7 @@ use librespot_core::keymaster::Token; use librespot_core::mercury::MercuryError; use librespot_core::session::Session; use librespot_playback::config::PlayerConfig; +use log::{debug, error, info}; use librespot_playback::audio_backend; use librespot_playback::config::Bitrate; diff --git a/src/spotify_worker.rs b/src/spotify_worker.rs index 8e556e2..e6c8021 100644 --- a/src/spotify_worker.rs +++ b/src/spotify_worker.rs @@ -15,6 +15,7 @@ use librespot_core::session::Session; use librespot_core::spotify_id::{SpotifyAudioType, SpotifyId}; use librespot_playback::mixer::Mixer; use librespot_playback::player::{Player, PlayerEvent as LibrespotPlayerEvent}; +use log::{debug, error, info, warn}; use std::time::Duration; use std::{pin::Pin, time::SystemTime}; diff --git a/src/theme.rs b/src/theme.rs index 8dd8577..37ad69d 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -2,6 +2,7 @@ use cursive::theme::BaseColor::*; use cursive::theme::Color::*; use cursive::theme::PaletteColor::*; use cursive::theme::*; +use log::warn; use crate::config::ConfigTheme; diff --git a/src/ui/layout.rs b/src/ui/layout.rs index 8a45197..3758f50 100644 --- a/src/ui/layout.rs +++ b/src/ui/layout.rs @@ -10,6 +10,7 @@ use cursive::vec::Vec2; use cursive::view::{IntoBoxedView, Selector}; use cursive::views::EditView; use cursive::{Cursive, Printer}; +use log::debug; use unicode_width::UnicodeWidthStr; use crate::command::Command; diff --git a/src/ui/listview.rs b/src/ui/listview.rs index e1f7a21..79f21f1 100644 --- a/src/ui/listview.rs +++ b/src/ui/listview.rs @@ -1,3 +1,4 @@ +use log::{info, trace}; use std::cmp::{max, min, Ordering}; use std::sync::{Arc, RwLock}; diff --git a/src/ui/pagination.rs b/src/ui/pagination.rs index a5cb93e..1aeec2d 100644 --- a/src/ui/pagination.rs +++ b/src/ui/pagination.rs @@ -1,7 +1,7 @@ -use std::sync::{Arc, RwLock}; - use crate::library::Library; use crate::traits::ListItem; +use log::debug; +use std::sync::{Arc, RwLock}; pub struct ApiPage { pub offset: u32,