From 829b799cc55771c0e18819a037e3c5c240d0390e Mon Sep 17 00:00:00 2001 From: Thomas Frans Date: Wed, 15 Feb 2023 18:06:04 +0100 Subject: [PATCH] Fix clippy warnings. --- src/spotify_api.rs | 12 +++++++++--- src/ui/layout.rs | 2 +- src/ui/search.rs | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/spotify_api.rs b/src/spotify_api.rs index 78c64ad..a418a28 100644 --- a/src/spotify_api.rs +++ b/src/spotify_api.rs @@ -35,15 +35,21 @@ pub struct WebApi { token_expiration: Arc>>, } -impl WebApi { - pub fn new() -> WebApi { - WebApi { +impl Default for WebApi { + fn default() -> Self { + Self { api: AuthCodeSpotify::default(), user: None, worker_channel: Arc::new(RwLock::new(None)), token_expiration: Arc::new(RwLock::new(Utc::now())), } } +} + +impl WebApi { + pub fn new() -> WebApi { + Self::default() + } pub fn set_user(&mut self, user: Option) { self.user = user; diff --git a/src/ui/layout.rs b/src/ui/layout.rs index 8e85300..9081fa6 100644 --- a/src/ui/layout.rs +++ b/src/ui/layout.rs @@ -342,7 +342,7 @@ impl View for Layout { } } - fn call_on_any<'a>(&mut self, s: &Selector, c: AnyCb<'a>) { + fn call_on_any(&mut self, s: &Selector, c: AnyCb<'_>) { if let Some(view) = self.get_current_view_mut() { view.call_on_any(s, c); } diff --git a/src/ui/search.rs b/src/ui/search.rs index 155ce94..1995075 100644 --- a/src/ui/search.rs +++ b/src/ui/search.rs @@ -94,7 +94,7 @@ impl View for SearchView { } } - fn call_on_any<'a>(&mut self, selector: &Selector<'_>, callback: AnyCb<'a>) { + fn call_on_any(&mut self, selector: &Selector<'_>, callback: AnyCb<'_>) { self.edit.call_on_any(selector, &mut |v| callback(v)); }