From b594b7ec2c3d1cbc8892d62a572f772461d3502a Mon Sep 17 00:00:00 2001 From: ranfdev Date: Wed, 5 Aug 2020 12:11:48 +0200 Subject: [PATCH] Fixed clippy warnings --- src/audio/backend/gstreamer_backend.rs | 16 +++++++--------- src/audio/controller/mini_controller.rs | 2 +- src/audio/controller/mpris_controller.rs | 2 +- src/audio/player.rs | 2 +- src/ui/song_listbox.rs | 1 - src/ui/song_row.rs | 1 - src/ui/window.rs | 10 ++++------ 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/audio/backend/gstreamer_backend.rs b/src/audio/backend/gstreamer_backend.rs index c0c0745c..ce8701a0 100644 --- a/src/audio/backend/gstreamer_backend.rs +++ b/src/audio/backend/gstreamer_backend.rs @@ -481,15 +481,13 @@ impl GstreamerBackend { let _ = pipeline.set_state(State::Paused); } } - } else { - if buffering_state.buffering { - buffering_state.buffering = false; - if buffering_state.is_live == Some(false) { - debug!("Resuming pipeline because buffering finished"); - let _ = pipeline.set_state(State::Playing); - if let Some((pad, probe_id)) = buffering_state.buffering_probe.take() { - pad.remove_probe(probe_id); - } + } else if buffering_state.buffering { + buffering_state.buffering = false; + if buffering_state.is_live == Some(false) { + debug!("Resuming pipeline because buffering finished"); + let _ = pipeline.set_state(State::Playing); + if let Some((pad, probe_id)) = buffering_state.buffering_probe.take() { + pad.remove_probe(probe_id); } } } diff --git a/src/audio/controller/mini_controller.rs b/src/audio/controller/mini_controller.rs index 828afb38..8f29d69c 100644 --- a/src/audio/controller/mini_controller.rs +++ b/src/audio/controller/mini_controller.rs @@ -94,7 +94,7 @@ impl Controller for MiniController { fn set_station(&self, station: Station) { self.title_label.set_text(&station.name); self.title_label.set_tooltip_text(Some(station.name.as_str())); - *self.station.borrow_mut() = Some(station.clone()); + *self.station.borrow_mut() = Some(station); self.subtitle_revealer.set_reveal_child(false); } diff --git a/src/audio/controller/mpris_controller.rs b/src/audio/controller/mpris_controller.rs index 9bac4e07..20c2ece2 100644 --- a/src/audio/controller/mpris_controller.rs +++ b/src/audio/controller/mpris_controller.rs @@ -144,7 +144,7 @@ impl Controller for MprisController { fn set_volume(&self, volume: f64) { *self.volume.borrow_mut() = volume; - self.mpris.set_volume(volume.clone()).unwrap(); + self.mpris.set_volume(volume).unwrap(); } fn set_song_title(&self, title: &str) { diff --git a/src/audio/player.rs b/src/audio/player.rs index a0efd524..9cea6e15 100644 --- a/src/audio/player.rs +++ b/src/audio/player.rs @@ -221,7 +221,7 @@ impl Player { pub fn set_volume(&self, volume: f64) { debug!("Set volume: {}", &volume); - self.backend.lock().unwrap().gstreamer.set_volume(volume.clone()); + self.backend.lock().unwrap().gstreamer.set_volume(volume); for con in &*self.controller { con.set_volume(volume); diff --git a/src/ui/song_listbox.rs b/src/ui/song_listbox.rs index 39132116..573d263a 100644 --- a/src/ui/song_listbox.rs +++ b/src/ui/song_listbox.rs @@ -16,7 +16,6 @@ use glib::Sender; use gtk::prelude::*; -use open; use crate::app::Action; use crate::audio::Song; diff --git a/src/ui/song_row.rs b/src/ui/song_row.rs index b492cf2d..797ac403 100644 --- a/src/ui/song_row.rs +++ b/src/ui/song_row.rs @@ -17,7 +17,6 @@ use chrono::NaiveTime; use glib::Sender; use gtk::prelude::*; -use open; use crate::app::Action; use crate::audio::Song; diff --git a/src/ui/window.rs b/src/ui/window.rs index 5086b399..5d03a020 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -108,7 +108,7 @@ impl SwApplicationWindow { // Create new GObject and downcast it into SwApplicationWindow let window = glib::Object::new(SwApplicationWindow::static_type(), &[]).unwrap().downcast::().unwrap(); - app.add_window(&window.clone()); + app.add_window(&window); window.setup_widgets(); window.setup_signals(sender.clone()); window.setup_gactions(sender); @@ -372,12 +372,10 @@ impl SwApplicationWindow { // and set the corresponding view (Library|Storefront|Player) let current_view = if self_.sidebar_flap.get_folded() && self_.sidebar_flap.get_reveal_flap() { View::Player + } else if deck_child_name == "storefront" { + View::Storefront } else { - if deck_child_name == "storefront" { - View::Storefront - } else { - View::Library - } + View::Library }; // Show bottom player controller toolbar when sidebar flap is folded and player widget is not revealed -- GitLab