diff --git a/hammond-gtk/src/app.rs b/hammond-gtk/src/app.rs index cbebed5..822fb3c 100644 --- a/hammond-gtk/src/app.rs +++ b/hammond-gtk/src/app.rs @@ -143,7 +143,6 @@ impl App { }); } - #[inline] pub fn run(self) { WindowGeometry::from_settings(&self.settings).apply(&self.window); diff --git a/hammond-gtk/src/stacks/home.rs b/hammond-gtk/src/stacks/home.rs index 6711b54..7b959b6 100644 --- a/hammond-gtk/src/stacks/home.rs +++ b/hammond-gtk/src/stacks/home.rs @@ -81,7 +81,6 @@ impl HomeStack { Ok(()) } - #[inline] fn switch_visible(&mut self, s: State) { use self::State::*; @@ -97,7 +96,6 @@ impl HomeStack { } } - #[inline] fn determine_state(&mut self) -> Result<(), DataError> { if is_episodes_populated()? { self.switch_visible(State::Home); diff --git a/hammond-gtk/src/stacks/populated.rs b/hammond-gtk/src/stacks/populated.rs index f9f92fb..2052ea1 100644 --- a/hammond-gtk/src/stacks/populated.rs +++ b/hammond-gtk/src/stacks/populated.rs @@ -134,7 +134,6 @@ impl PopulatedStack { self.container.clone() } - #[inline] pub fn switch_visible(&mut self, state: PopulatedState, animation: gtk::StackTransitionType) { use self::PopulatedState::*; diff --git a/hammond-gtk/src/stacks/show.rs b/hammond-gtk/src/stacks/show.rs index 98d65fa..e00cc35 100644 --- a/hammond-gtk/src/stacks/show.rs +++ b/hammond-gtk/src/stacks/show.rs @@ -63,7 +63,6 @@ impl ShowStack { self.determine_state() } - #[inline] fn switch_visible(&mut self, s: ShowState) { use self::ShowState::*; @@ -79,7 +78,6 @@ impl ShowStack { }; } - #[inline] fn determine_state(&mut self) -> Result<(), Error> { use self::ShowState::*; diff --git a/hammond-gtk/src/utils.rs b/hammond-gtk/src/utils.rs index 2e8e2d1..34cecb3 100644 --- a/hammond-gtk/src/utils.rs +++ b/hammond-gtk/src/utils.rs @@ -62,7 +62,6 @@ use app::Action; /// let list = gtk::ListBox::new(); /// lazy_load(widgets, list, |w| w, || {}); /// ``` -#[inline] pub fn lazy_load(data: T, container: C, mut contructor: F, callback: U) where T: IntoIterator + 'static, @@ -82,7 +81,6 @@ where /// This is a more flexible version of `lazy_load` with less constrains. /// If you just want to lazy add `widgets` to a `container` check if /// `lazy_load` fits your needs first. -#[inline] #[cfg_attr(feature = "cargo-clippy", allow(redundant_closure))] pub fn lazy_load_full(data: T, mut func: F, finish_callback: U) where @@ -233,7 +231,6 @@ lazy_static! { // GObjects do not implement Send trait, so SendCell is a way around that. // Also lazy_static requires Sync trait, so that's what the mutexes are. // TODO: maybe use something that would just scale to requested size? -#[inline] pub fn set_image_from_path(image: >k::Image, podcast_id: i32, size: u32) -> Result<(), Error> { // Check if there's an active download about this show cover. // If there is, a callback will be set so this function will be called again. @@ -306,14 +303,12 @@ pub fn set_image_from_path(image: >k::Image, podcast_id: i32, size: u32) -> Re Ok(()) } -#[inline] // FIXME: the signature should be `fn foo(s: Url) -> Result` pub fn itunes_to_rss(url: &str) -> Result { let id = itunes_id_from_url(url).ok_or_else(|| format_err!("Failed to find an Itunes ID."))?; lookup_id(id) } -#[inline] fn itunes_id_from_url(url: &str) -> Option { lazy_static! { static ref RE: Regex = Regex::new(r"/id([0-9]+)").unwrap(); @@ -325,7 +320,6 @@ fn itunes_id_from_url(url: &str) -> Option { foo.parse::().ok() } -#[inline] fn lookup_id(id: u32) -> Result { let url = format!("https://itunes.apple.com/lookup?id={}&entity=podcast", id); let req: Value = reqwest::get(&url)?.json()?; diff --git a/hammond-gtk/src/widgets/empty.rs b/hammond-gtk/src/widgets/empty.rs index 40ffa16..ad3d152 100644 --- a/hammond-gtk/src/widgets/empty.rs +++ b/hammond-gtk/src/widgets/empty.rs @@ -6,7 +6,6 @@ pub struct EmptyView { } impl Default for EmptyView { - #[inline] fn default() -> Self { let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/empty_view.ui"); let view: gtk::Box = builder.get_object("empty_view").unwrap(); @@ -16,7 +15,6 @@ impl Default for EmptyView { } impl EmptyView { - #[inline] pub fn new() -> EmptyView { EmptyView::default() } diff --git a/hammond-gtk/src/widgets/episode.rs b/hammond-gtk/src/widgets/episode.rs index 02d16df..01ae0ff 100644 --- a/hammond-gtk/src/widgets/episode.rs +++ b/hammond-gtk/src/widgets/episode.rs @@ -32,7 +32,6 @@ pub struct EpisodeWidget { } impl Default for EpisodeWidget { - #[inline] fn default() -> Self { let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episode_widget.ui"); @@ -79,14 +78,12 @@ impl Default for EpisodeWidget { } impl EpisodeWidget { - #[inline] pub fn new(episode: EpisodeWidgetQuery, sender: &Sender) -> EpisodeWidget { let mut widget = EpisodeWidget::default(); widget.init(episode, sender); widget } - #[inline] fn init(&mut self, episode: EpisodeWidgetQuery, sender: &Sender) { // Set the date label. self.set_date(episode.epoch()); @@ -107,7 +104,6 @@ impl EpisodeWidget { self.connect_buttons(&episode, sender); } - #[inline] fn connect_buttons(&self, episode: &Arc>, sender: &Sender) { let title = self.title.clone(); if let Ok(media) = self.media.try_borrow_mut() { @@ -140,7 +136,6 @@ impl EpisodeWidget { } } - #[inline] /// Determine the title state. fn set_title(&mut self, episode: &EpisodeWidgetQuery) { let mut machine = self.title.borrow_mut(); @@ -150,14 +145,12 @@ impl EpisodeWidget { }); } - #[inline] /// Set the date label depending on the current time. fn set_date(&mut self, epoch: i32) { let machine = &mut self.date; take_mut::take(machine, |date| date.determine_state(i64::from(epoch))); } - #[inline] /// Set the duration label. fn set_duration(&mut self, seconds: Option) { let machine = &mut self.duration; @@ -165,7 +158,6 @@ impl EpisodeWidget { } } -#[inline] fn determine_media_state( media_machine: &Rc>, episode: &EpisodeWidgetQuery, @@ -241,7 +233,6 @@ fn determine_media_state( Ok(()) } -#[inline] fn on_download_clicked(ep: &EpisodeWidgetQuery, sender: &Sender) -> Result<(), Error> { let pd = dbqueries::get_podcast_from_id(ep.podcast_id())?; let download_fold = get_download_folder(&pd.title())?; @@ -255,7 +246,6 @@ fn on_download_clicked(ep: &EpisodeWidgetQuery, sender: &Sender) -> Resu Ok(()) } -#[inline] fn on_play_bttn_clicked( episode: &mut EpisodeWidgetQuery, title: &Rc>, @@ -273,7 +263,6 @@ fn on_play_bttn_clicked( Ok(()) } -#[inline] fn open_uri(rowid: i32) -> Result<(), Error> { let uri = dbqueries::get_episode_local_uri_from_id(rowid)? .ok_or_else(|| format_err!("Expected Some found None."))?; @@ -303,7 +292,6 @@ fn update_progressbar_callback( timeout_add(300, callback); } -#[inline] #[allow(if_same_then_else)] fn progress_bar_helper( prog: &Arc>, @@ -363,7 +351,6 @@ fn update_total_size_callback( timeout_add(500, callback); } -#[inline] fn total_size_helper( prog: &Arc>, media: &Rc>, diff --git a/hammond-gtk/src/widgets/episode_states.rs b/hammond-gtk/src/widgets/episode_states.rs index d69e2f1..a3e27c2 100644 --- a/hammond-gtk/src/widgets/episode_states.rs +++ b/hammond-gtk/src/widgets/episode_states.rs @@ -61,7 +61,6 @@ pub struct Title { impl Title { #[allow(unused_must_use)] - #[inline] // This does not need to be &mut since gtk-rs does not model ownership // But I think it wouldn't hurt if we treat it as a Rust api. fn set_title(&mut self, s: &str) { @@ -70,7 +69,6 @@ impl Title { } impl Title { - #[inline] fn new(title: gtk::Label) -> Self { Title { title, @@ -80,7 +78,6 @@ impl Title { } impl From> for Title { - #[inline] fn from(f: Title) -> Self { f.title .get_style_context() @@ -94,7 +91,6 @@ impl From> for Title { } impl From> for Title { - #[inline] fn from(f: Title) -> Self { f.title .get_style_context() @@ -114,13 +110,11 @@ pub enum TitleMachine { } impl TitleMachine { - #[inline] pub fn new(label: gtk::Label, is_played: bool) -> Self { let m = TitleMachine::Normal(Title::::new(label)); m.determine_state(is_played) } - #[inline] pub fn determine_state(self, is_played: bool) -> Self { use self::TitleMachine::*; @@ -132,7 +126,6 @@ impl TitleMachine { } } - #[inline] pub fn set_title(&mut self, s: &str) { use self::TitleMachine::*; @@ -156,7 +149,6 @@ pub struct Date { } impl Date { - #[inline] fn into_usual(self, epoch: i64) -> Date { let ts = Utc.timestamp(epoch, 0); self.date.set_text(ts.format("%e %b").to_string().trim()); @@ -168,7 +160,6 @@ impl Date { } } - #[inline] fn into_year_shown(self, epoch: i64) -> Date { let ts = Utc.timestamp(epoch, 0); self.date.set_text(ts.format("%e %b %Y").to_string().trim()); @@ -182,7 +173,6 @@ impl Date { } impl Date { - #[inline] fn new(date: gtk::Label, epoch: i64) -> Self { let ts = Utc.timestamp(epoch, 0); date.set_text(ts.format("%e %b %Y").to_string().trim()); @@ -203,13 +193,11 @@ pub enum DateMachine { } impl DateMachine { - #[inline] pub fn new(label: gtk::Label, epoch: i64) -> Self { let m = DateMachine::UnInitialized(Date::::new(label, epoch)); m.determine_state(epoch) } - #[inline] pub fn determine_state(self, epoch: i64) -> Self { use self::DateMachine::*; @@ -239,7 +227,6 @@ pub struct Duration { } impl Duration { - #[inline] // This needs a better name. // TODO: make me mut fn set_duration(&self, minutes: i64) { @@ -248,7 +235,6 @@ impl Duration { } impl Duration { - #[inline] fn new(duration: gtk::Label, separator: gtk::Label) -> Self { duration.hide(); separator.hide(); @@ -262,7 +248,6 @@ impl Duration { } impl From> for Duration { - #[inline] fn from(f: Duration) -> Self { f.duration.show(); f.separator.show(); @@ -276,7 +261,6 @@ impl From> for Duration { } impl From> for Duration { - #[inline] fn from(f: Duration) -> Self { f.duration.hide(); f.separator.hide(); @@ -296,13 +280,11 @@ pub enum DurationMachine { } impl DurationMachine { - #[inline] pub fn new(duration: gtk::Label, separator: gtk::Label, seconds: Option) -> Self { let m = DurationMachine::Hidden(Duration::::new(duration, separator)); m.determine_state(seconds) } - #[inline] pub fn determine_state(self, seconds: Option) -> Self { match (self, seconds) { (d @ DurationMachine::Hidden(_), None) => d, @@ -337,7 +319,6 @@ pub struct Size { } impl Size { - #[inline] fn set_size(self, s: &str) -> Size { self.size.set_text(s); self.size.show(); @@ -349,7 +330,6 @@ impl Size { } } - #[inline] // https://play.rust-lang.org/?gist=1acffaf62743eeb85be1ae6ecf474784&version=stable // It might be possible to make a generic definition with Specialization. // https://github.com/rust-lang/rust/issues/31844 @@ -364,7 +344,6 @@ impl Size { } } - #[inline] fn into_hidden(self) -> Size { self.size.hide(); self.separator.hide(); @@ -378,7 +357,6 @@ impl Size { } impl Size { - #[inline] fn new(size: gtk::Label, separator: gtk::Label) -> Self { size.hide(); separator.hide(); @@ -412,7 +390,6 @@ pub struct DownloadPlay { } impl DownloadPlay { - #[inline] // https://play.rust-lang.org/?gist=1acffaf62743eeb85be1ae6ecf474784&version=stable // It might be possible to make a generic definition with Specialization. // https://github.com/rust-lang/rust/issues/31844 @@ -427,7 +404,6 @@ impl DownloadPlay { } } - #[inline] fn into_fetchable(self) -> DownloadPlay { self.play.hide(); self.download.show(); @@ -439,7 +415,6 @@ impl DownloadPlay { } } - #[inline] fn into_hidden(self) -> DownloadPlay { self.play.hide(); self.download.hide(); @@ -451,7 +426,6 @@ impl DownloadPlay { } } - #[inline] fn download_connect_clicked( &self, f: F, @@ -459,14 +433,12 @@ impl DownloadPlay { self.download.connect_clicked(f) } - #[inline] fn play_connect_clicked(&self, f: F) -> glib::SignalHandlerId { self.play.connect_clicked(f) } } impl DownloadPlay { - #[inline] fn new(play: gtk::Button, download: gtk::Button) -> Self { play.hide(); download.hide(); @@ -489,7 +461,6 @@ pub struct Progress { } impl Progress { - #[inline] fn into_shown(self) -> Progress { self.bar.show(); self.cancel.show(); @@ -505,7 +476,6 @@ impl Progress { } } - #[inline] fn into_hidden(self) -> Progress { self.bar.hide(); self.cancel.hide(); @@ -522,7 +492,6 @@ impl Progress { } #[allow(unused_must_use)] - #[inline] // This does not need to be &mut since gtk-rs does not model ownership // But I think it wouldn't hurt if we treat it as a Rust api. fn update_progress(&mut self, local_size: &str, fraction: f64) { @@ -530,14 +499,12 @@ impl Progress { self.bar.set_fraction(fraction); } - #[inline] fn cancel_connect_clicked(&self, f: F) -> glib::SignalHandlerId { self.cancel.connect_clicked(f) } } impl Progress { - #[inline] fn new( bar: gtk::ProgressBar, cancel: gtk::Button, @@ -571,7 +538,6 @@ type Playable = Media