commit: | 6f30e8d81eba23605b6782171c87a04979a2150e |
author: | Trevor Bentley |
committer: | Trevor Bentley |
date: | Sun Jun 30 14:20:05 2019 +0200 |
parents: | 68ca6a88d6200f86310174c2121fd90cc7cfbcb5 |
diff --git a/Cargo.toml b/Cargo.toml line changes: +1/-0 index 5521017..ce48af1 --- a/Cargo.toml +++ b/Cargo.toml
@@ -50,6 +50,7 @@ chrono = "0.4" log = "0.4" log4rs = "0.8" ctrlc = "3.1" +dirs = "2.0" rustfm-scrobble = {version="0.9.1", optional = true} [dependencies.fruitbasket]
diff --git a/src/lib.rs b/src/lib.rs line changes: +4/-2 index 659c906..d86063c --- a/src/lib.rs +++ b/src/lib.rs
@@ -12,6 +12,8 @@ extern crate lazy_static; #[macro_use] extern crate log; +extern crate dirs; + #[cfg(target_os = "macos")] pub mod osx;
@@ -98,7 +100,7 @@ pub trait TStatusBar { } use std::sync::mpsc::Sender; -pub type NSCallback = Box<Fn(u64, &Sender<String>)>; +pub type NSCallback = Box<dyn Fn(u64, &Sender<String>)>; pub struct DummyStatusBar {} impl TStatusBar for DummyStatusBar {
@@ -157,7 +159,7 @@ pub fn search_paths() -> Vec<String> { let mut v = BTreeSet::<String>::new(); // $HOME - if let Some(dir) = std::env::home_dir() { + if let Some(dir) = dirs::home_dir() { v.insert(dir.display().to_string()); }
diff --git a/src/main.rs b/src/main.rs line changes: +1/-1 index c5e355a..ad45e68 --- a/src/main.rs +++ b/src/main.rs
@@ -1227,7 +1227,7 @@ fn main() { fn require(response: SpotifyResponse) { match response.code.unwrap() { - 200 ... 299 => { info!("Response: {}", response.code.unwrap()); }, + 200 ..= 299 => { info!("Response: {}", response.code.unwrap()); }, _ => { warn!("Spotify action failed! ({})", response); } } }
diff --git a/src/osx/rustnsobject.rs b/src/osx/rustnsobject.rs line changes: +2/-2 index 05e5f0d..9609c78 --- a/src/osx/rustnsobject.rs +++ b/src/osx/rustnsobject.rs
@@ -25,7 +25,7 @@ use std::sync::mpsc::Sender; pub struct RustWrapperClass { pub objc: Id<ObjcSubclass, Shared>, - pub cb_fn: Option<Box<Fn(&mut RustWrapperClass, u64)>>, + pub cb_fn: Option<Box<dyn Fn(&mut RustWrapperClass, u64)>>, pub map: BTreeMap<u64, NSCallback>, pub tx: Sender<String>, }
@@ -136,7 +136,7 @@ impl INSObject for ObjcSubclass { unsafe {*this.get_ivar("_rustdata")} } - extern fn objc_url(this: &Object, _cmd: Sel, event: u64, reply: u64) { + extern fn objc_url(_this: &Object, _cmd: Sel, _event: u64, _reply: u64) { info!("connectr URL support not implemented yet."); }
diff --git a/src/settings/mod.rs b/src/settings/mod.rs line changes: +2/-3 index d6752ae..5157a99 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs
@@ -9,7 +9,6 @@ use super::Scrobbler; extern crate time; extern crate fruitbasket; -use std::env; use std::path; use std::str::FromStr; use std::collections::BTreeMap;
@@ -59,12 +58,12 @@ impl Settings { } fn default_inifile() -> String { - format!("{}/.{}", env::home_dir().unwrap().display(), INIFILE) + format!("{}/.{}", dirs::home_dir().unwrap().display(), INIFILE) } fn inifile() -> String { // Try to load INI file from home directory - let path = format!("{}/.{}", env::home_dir().unwrap().display(), INIFILE); + let path = format!("{}/.{}", dirs::home_dir().unwrap().display(), INIFILE); if path::Path::new(&path).exists() { info!("Found config: {}", path); return path;
diff --git a/src/webapi/mod.rs b/src/webapi/mod.rs line changes: +1/-1 index a4150df..a73f46e --- a/src/webapi/mod.rs +++ b/src/webapi/mod.rs
@@ -750,7 +750,7 @@ impl<'a> SpotifyConnectr<'a> { } pub fn await_once(&mut self, blocking: bool) { // Choose between blocking or non-blocking receive. - let recv_fn: Box<Fn(&Receiver<()>) -> bool> = match blocking { + let recv_fn: Box<dyn Fn(&Receiver<()>) -> bool> = match blocking { true => Box::new(move |rx| { match rx.recv() { Ok(_) => true, Err(_) => false } }), false => Box::new(move |rx| { match rx.try_recv() { Ok(_) => true, Err(_) => false } }), };