Remove explicit and not needed inline calls.

This code is not performance critical and the compiler will already
inline whatever it thinks it might benefit it.
This commit is contained in:
Jordan Petridis 2018-05-13 22:08:25 +03:00
parent 54fafa07a2
commit d47bbd6131
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
11 changed files with 0 additions and 116 deletions

View File

@ -143,7 +143,6 @@ impl App {
}); });
} }
#[inline]
pub fn run(self) { pub fn run(self) {
WindowGeometry::from_settings(&self.settings).apply(&self.window); WindowGeometry::from_settings(&self.settings).apply(&self.window);

View File

@ -81,7 +81,6 @@ impl HomeStack {
Ok(()) Ok(())
} }
#[inline]
fn switch_visible(&mut self, s: State) { fn switch_visible(&mut self, s: State) {
use self::State::*; use self::State::*;
@ -97,7 +96,6 @@ impl HomeStack {
} }
} }
#[inline]
fn determine_state(&mut self) -> Result<(), DataError> { fn determine_state(&mut self) -> Result<(), DataError> {
if is_episodes_populated()? { if is_episodes_populated()? {
self.switch_visible(State::Home); self.switch_visible(State::Home);

View File

@ -134,7 +134,6 @@ impl PopulatedStack {
self.container.clone() self.container.clone()
} }
#[inline]
pub fn switch_visible(&mut self, state: PopulatedState, animation: gtk::StackTransitionType) { pub fn switch_visible(&mut self, state: PopulatedState, animation: gtk::StackTransitionType) {
use self::PopulatedState::*; use self::PopulatedState::*;

View File

@ -63,7 +63,6 @@ impl ShowStack {
self.determine_state() self.determine_state()
} }
#[inline]
fn switch_visible(&mut self, s: ShowState) { fn switch_visible(&mut self, s: ShowState) {
use self::ShowState::*; use self::ShowState::*;
@ -79,7 +78,6 @@ impl ShowStack {
}; };
} }
#[inline]
fn determine_state(&mut self) -> Result<(), Error> { fn determine_state(&mut self) -> Result<(), Error> {
use self::ShowState::*; use self::ShowState::*;

View File

@ -62,7 +62,6 @@ use app::Action;
/// let list = gtk::ListBox::new(); /// let list = gtk::ListBox::new();
/// lazy_load(widgets, list, |w| w, || {}); /// lazy_load(widgets, list, |w| w, || {});
/// ``` /// ```
#[inline]
pub fn lazy_load<T, C, F, W, U>(data: T, container: C, mut contructor: F, callback: U) pub fn lazy_load<T, C, F, W, U>(data: T, container: C, mut contructor: F, callback: U)
where where
T: IntoIterator + 'static, T: IntoIterator + 'static,
@ -82,7 +81,6 @@ where
/// This is a more flexible version of `lazy_load` with less constrains. /// 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 /// If you just want to lazy add `widgets` to a `container` check if
/// `lazy_load` fits your needs first. /// `lazy_load` fits your needs first.
#[inline]
#[cfg_attr(feature = "cargo-clippy", allow(redundant_closure))] #[cfg_attr(feature = "cargo-clippy", allow(redundant_closure))]
pub fn lazy_load_full<T, F, U>(data: T, mut func: F, finish_callback: U) pub fn lazy_load_full<T, F, U>(data: T, mut func: F, finish_callback: U)
where where
@ -233,7 +231,6 @@ lazy_static! {
// GObjects do not implement Send trait, so SendCell is a way around that. // 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. // Also lazy_static requires Sync trait, so that's what the mutexes are.
// TODO: maybe use something that would just scale to requested size? // TODO: maybe use something that would just scale to requested size?
#[inline]
pub fn set_image_from_path(image: &gtk::Image, podcast_id: i32, size: u32) -> Result<(), Error> { pub fn set_image_from_path(image: &gtk::Image, podcast_id: i32, size: u32) -> Result<(), Error> {
// Check if there's an active download about this show cover. // 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. // 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: &gtk::Image, podcast_id: i32, size: u32) -> Re
Ok(()) Ok(())
} }
#[inline]
// FIXME: the signature should be `fn foo(s: Url) -> Result<Url, Error>` // FIXME: the signature should be `fn foo(s: Url) -> Result<Url, Error>`
pub fn itunes_to_rss(url: &str) -> Result<String, Error> { pub fn itunes_to_rss(url: &str) -> Result<String, Error> {
let id = itunes_id_from_url(url).ok_or_else(|| format_err!("Failed to find an Itunes ID."))?; let id = itunes_id_from_url(url).ok_or_else(|| format_err!("Failed to find an Itunes ID."))?;
lookup_id(id) lookup_id(id)
} }
#[inline]
fn itunes_id_from_url(url: &str) -> Option<u32> { fn itunes_id_from_url(url: &str) -> Option<u32> {
lazy_static! { lazy_static! {
static ref RE: Regex = Regex::new(r"/id([0-9]+)").unwrap(); static ref RE: Regex = Regex::new(r"/id([0-9]+)").unwrap();
@ -325,7 +320,6 @@ fn itunes_id_from_url(url: &str) -> Option<u32> {
foo.parse::<u32>().ok() foo.parse::<u32>().ok()
} }
#[inline]
fn lookup_id(id: u32) -> Result<String, Error> { fn lookup_id(id: u32) -> Result<String, Error> {
let url = format!("https://itunes.apple.com/lookup?id={}&entity=podcast", id); let url = format!("https://itunes.apple.com/lookup?id={}&entity=podcast", id);
let req: Value = reqwest::get(&url)?.json()?; let req: Value = reqwest::get(&url)?.json()?;

View File

@ -6,7 +6,6 @@ pub struct EmptyView {
} }
impl Default for EmptyView { impl Default for EmptyView {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/empty_view.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/empty_view.ui");
let view: gtk::Box = builder.get_object("empty_view").unwrap(); let view: gtk::Box = builder.get_object("empty_view").unwrap();
@ -16,7 +15,6 @@ impl Default for EmptyView {
} }
impl EmptyView { impl EmptyView {
#[inline]
pub fn new() -> EmptyView { pub fn new() -> EmptyView {
EmptyView::default() EmptyView::default()
} }

View File

@ -32,7 +32,6 @@ pub struct EpisodeWidget {
} }
impl Default for EpisodeWidget { impl Default for EpisodeWidget {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episode_widget.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episode_widget.ui");
@ -79,14 +78,12 @@ impl Default for EpisodeWidget {
} }
impl EpisodeWidget { impl EpisodeWidget {
#[inline]
pub fn new(episode: EpisodeWidgetQuery, sender: &Sender<Action>) -> EpisodeWidget { pub fn new(episode: EpisodeWidgetQuery, sender: &Sender<Action>) -> EpisodeWidget {
let mut widget = EpisodeWidget::default(); let mut widget = EpisodeWidget::default();
widget.init(episode, sender); widget.init(episode, sender);
widget widget
} }
#[inline]
fn init(&mut self, episode: EpisodeWidgetQuery, sender: &Sender<Action>) { fn init(&mut self, episode: EpisodeWidgetQuery, sender: &Sender<Action>) {
// Set the date label. // Set the date label.
self.set_date(episode.epoch()); self.set_date(episode.epoch());
@ -107,7 +104,6 @@ impl EpisodeWidget {
self.connect_buttons(&episode, sender); self.connect_buttons(&episode, sender);
} }
#[inline]
fn connect_buttons(&self, episode: &Arc<Mutex<EpisodeWidgetQuery>>, sender: &Sender<Action>) { fn connect_buttons(&self, episode: &Arc<Mutex<EpisodeWidgetQuery>>, sender: &Sender<Action>) {
let title = self.title.clone(); let title = self.title.clone();
if let Ok(media) = self.media.try_borrow_mut() { if let Ok(media) = self.media.try_borrow_mut() {
@ -140,7 +136,6 @@ impl EpisodeWidget {
} }
} }
#[inline]
/// Determine the title state. /// Determine the title state.
fn set_title(&mut self, episode: &EpisodeWidgetQuery) { fn set_title(&mut self, episode: &EpisodeWidgetQuery) {
let mut machine = self.title.borrow_mut(); let mut machine = self.title.borrow_mut();
@ -150,14 +145,12 @@ impl EpisodeWidget {
}); });
} }
#[inline]
/// Set the date label depending on the current time. /// Set the date label depending on the current time.
fn set_date(&mut self, epoch: i32) { fn set_date(&mut self, epoch: i32) {
let machine = &mut self.date; let machine = &mut self.date;
take_mut::take(machine, |date| date.determine_state(i64::from(epoch))); take_mut::take(machine, |date| date.determine_state(i64::from(epoch)));
} }
#[inline]
/// Set the duration label. /// Set the duration label.
fn set_duration(&mut self, seconds: Option<i32>) { fn set_duration(&mut self, seconds: Option<i32>) {
let machine = &mut self.duration; let machine = &mut self.duration;
@ -165,7 +158,6 @@ impl EpisodeWidget {
} }
} }
#[inline]
fn determine_media_state( fn determine_media_state(
media_machine: &Rc<RefCell<MediaMachine>>, media_machine: &Rc<RefCell<MediaMachine>>,
episode: &EpisodeWidgetQuery, episode: &EpisodeWidgetQuery,
@ -241,7 +233,6 @@ fn determine_media_state(
Ok(()) Ok(())
} }
#[inline]
fn on_download_clicked(ep: &EpisodeWidgetQuery, sender: &Sender<Action>) -> Result<(), Error> { fn on_download_clicked(ep: &EpisodeWidgetQuery, sender: &Sender<Action>) -> Result<(), Error> {
let pd = dbqueries::get_podcast_from_id(ep.podcast_id())?; let pd = dbqueries::get_podcast_from_id(ep.podcast_id())?;
let download_fold = get_download_folder(&pd.title())?; let download_fold = get_download_folder(&pd.title())?;
@ -255,7 +246,6 @@ fn on_download_clicked(ep: &EpisodeWidgetQuery, sender: &Sender<Action>) -> Resu
Ok(()) Ok(())
} }
#[inline]
fn on_play_bttn_clicked( fn on_play_bttn_clicked(
episode: &mut EpisodeWidgetQuery, episode: &mut EpisodeWidgetQuery,
title: &Rc<RefCell<TitleMachine>>, title: &Rc<RefCell<TitleMachine>>,
@ -273,7 +263,6 @@ fn on_play_bttn_clicked(
Ok(()) Ok(())
} }
#[inline]
fn open_uri(rowid: i32) -> Result<(), Error> { fn open_uri(rowid: i32) -> Result<(), Error> {
let uri = dbqueries::get_episode_local_uri_from_id(rowid)? let uri = dbqueries::get_episode_local_uri_from_id(rowid)?
.ok_or_else(|| format_err!("Expected Some found None."))?; .ok_or_else(|| format_err!("Expected Some found None."))?;
@ -303,7 +292,6 @@ fn update_progressbar_callback(
timeout_add(300, callback); timeout_add(300, callback);
} }
#[inline]
#[allow(if_same_then_else)] #[allow(if_same_then_else)]
fn progress_bar_helper( fn progress_bar_helper(
prog: &Arc<Mutex<manager::Progress>>, prog: &Arc<Mutex<manager::Progress>>,
@ -363,7 +351,6 @@ fn update_total_size_callback(
timeout_add(500, callback); timeout_add(500, callback);
} }
#[inline]
fn total_size_helper( fn total_size_helper(
prog: &Arc<Mutex<manager::Progress>>, prog: &Arc<Mutex<manager::Progress>>,
media: &Rc<RefCell<MediaMachine>>, media: &Rc<RefCell<MediaMachine>>,

View File

@ -61,7 +61,6 @@ pub struct Title<S> {
impl<S> Title<S> { impl<S> Title<S> {
#[allow(unused_must_use)] #[allow(unused_must_use)]
#[inline]
// This does not need to be &mut since gtk-rs does not model ownership // 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. // But I think it wouldn't hurt if we treat it as a Rust api.
fn set_title(&mut self, s: &str) { fn set_title(&mut self, s: &str) {
@ -70,7 +69,6 @@ impl<S> Title<S> {
} }
impl Title<Normal> { impl Title<Normal> {
#[inline]
fn new(title: gtk::Label) -> Self { fn new(title: gtk::Label) -> Self {
Title { Title {
title, title,
@ -80,7 +78,6 @@ impl Title<Normal> {
} }
impl From<Title<Normal>> for Title<GreyedOut> { impl From<Title<Normal>> for Title<GreyedOut> {
#[inline]
fn from(f: Title<Normal>) -> Self { fn from(f: Title<Normal>) -> Self {
f.title f.title
.get_style_context() .get_style_context()
@ -94,7 +91,6 @@ impl From<Title<Normal>> for Title<GreyedOut> {
} }
impl From<Title<GreyedOut>> for Title<Normal> { impl From<Title<GreyedOut>> for Title<Normal> {
#[inline]
fn from(f: Title<GreyedOut>) -> Self { fn from(f: Title<GreyedOut>) -> Self {
f.title f.title
.get_style_context() .get_style_context()
@ -114,13 +110,11 @@ pub enum TitleMachine {
} }
impl TitleMachine { impl TitleMachine {
#[inline]
pub fn new(label: gtk::Label, is_played: bool) -> Self { pub fn new(label: gtk::Label, is_played: bool) -> Self {
let m = TitleMachine::Normal(Title::<Normal>::new(label)); let m = TitleMachine::Normal(Title::<Normal>::new(label));
m.determine_state(is_played) m.determine_state(is_played)
} }
#[inline]
pub fn determine_state(self, is_played: bool) -> Self { pub fn determine_state(self, is_played: bool) -> Self {
use self::TitleMachine::*; use self::TitleMachine::*;
@ -132,7 +126,6 @@ impl TitleMachine {
} }
} }
#[inline]
pub fn set_title(&mut self, s: &str) { pub fn set_title(&mut self, s: &str) {
use self::TitleMachine::*; use self::TitleMachine::*;
@ -156,7 +149,6 @@ pub struct Date<S> {
} }
impl<S> Date<S> { impl<S> Date<S> {
#[inline]
fn into_usual(self, epoch: i64) -> Date<Usual> { fn into_usual(self, epoch: i64) -> Date<Usual> {
let ts = Utc.timestamp(epoch, 0); let ts = Utc.timestamp(epoch, 0);
self.date.set_text(ts.format("%e %b").to_string().trim()); self.date.set_text(ts.format("%e %b").to_string().trim());
@ -168,7 +160,6 @@ impl<S> Date<S> {
} }
} }
#[inline]
fn into_year_shown(self, epoch: i64) -> Date<YearShown> { fn into_year_shown(self, epoch: i64) -> Date<YearShown> {
let ts = Utc.timestamp(epoch, 0); let ts = Utc.timestamp(epoch, 0);
self.date.set_text(ts.format("%e %b %Y").to_string().trim()); self.date.set_text(ts.format("%e %b %Y").to_string().trim());
@ -182,7 +173,6 @@ impl<S> Date<S> {
} }
impl Date<UnInitialized> { impl Date<UnInitialized> {
#[inline]
fn new(date: gtk::Label, epoch: i64) -> Self { fn new(date: gtk::Label, epoch: i64) -> Self {
let ts = Utc.timestamp(epoch, 0); let ts = Utc.timestamp(epoch, 0);
date.set_text(ts.format("%e %b %Y").to_string().trim()); date.set_text(ts.format("%e %b %Y").to_string().trim());
@ -203,13 +193,11 @@ pub enum DateMachine {
} }
impl DateMachine { impl DateMachine {
#[inline]
pub fn new(label: gtk::Label, epoch: i64) -> Self { pub fn new(label: gtk::Label, epoch: i64) -> Self {
let m = DateMachine::UnInitialized(Date::<UnInitialized>::new(label, epoch)); let m = DateMachine::UnInitialized(Date::<UnInitialized>::new(label, epoch));
m.determine_state(epoch) m.determine_state(epoch)
} }
#[inline]
pub fn determine_state(self, epoch: i64) -> Self { pub fn determine_state(self, epoch: i64) -> Self {
use self::DateMachine::*; use self::DateMachine::*;
@ -239,7 +227,6 @@ pub struct Duration<S: Visibility> {
} }
impl<S: Visibility> Duration<S> { impl<S: Visibility> Duration<S> {
#[inline]
// This needs a better name. // This needs a better name.
// TODO: make me mut // TODO: make me mut
fn set_duration(&self, minutes: i64) { fn set_duration(&self, minutes: i64) {
@ -248,7 +235,6 @@ impl<S: Visibility> Duration<S> {
} }
impl Duration<Hidden> { impl Duration<Hidden> {
#[inline]
fn new(duration: gtk::Label, separator: gtk::Label) -> Self { fn new(duration: gtk::Label, separator: gtk::Label) -> Self {
duration.hide(); duration.hide();
separator.hide(); separator.hide();
@ -262,7 +248,6 @@ impl Duration<Hidden> {
} }
impl From<Duration<Hidden>> for Duration<Shown> { impl From<Duration<Hidden>> for Duration<Shown> {
#[inline]
fn from(f: Duration<Hidden>) -> Self { fn from(f: Duration<Hidden>) -> Self {
f.duration.show(); f.duration.show();
f.separator.show(); f.separator.show();
@ -276,7 +261,6 @@ impl From<Duration<Hidden>> for Duration<Shown> {
} }
impl From<Duration<Shown>> for Duration<Hidden> { impl From<Duration<Shown>> for Duration<Hidden> {
#[inline]
fn from(f: Duration<Shown>) -> Self { fn from(f: Duration<Shown>) -> Self {
f.duration.hide(); f.duration.hide();
f.separator.hide(); f.separator.hide();
@ -296,13 +280,11 @@ pub enum DurationMachine {
} }
impl DurationMachine { impl DurationMachine {
#[inline]
pub fn new(duration: gtk::Label, separator: gtk::Label, seconds: Option<i32>) -> Self { pub fn new(duration: gtk::Label, separator: gtk::Label, seconds: Option<i32>) -> Self {
let m = DurationMachine::Hidden(Duration::<Hidden>::new(duration, separator)); let m = DurationMachine::Hidden(Duration::<Hidden>::new(duration, separator));
m.determine_state(seconds) m.determine_state(seconds)
} }
#[inline]
pub fn determine_state(self, seconds: Option<i32>) -> Self { pub fn determine_state(self, seconds: Option<i32>) -> Self {
match (self, seconds) { match (self, seconds) {
(d @ DurationMachine::Hidden(_), None) => d, (d @ DurationMachine::Hidden(_), None) => d,
@ -337,7 +319,6 @@ pub struct Size<S> {
} }
impl<S> Size<S> { impl<S> Size<S> {
#[inline]
fn set_size(self, s: &str) -> Size<Shown> { fn set_size(self, s: &str) -> Size<Shown> {
self.size.set_text(s); self.size.set_text(s);
self.size.show(); self.size.show();
@ -349,7 +330,6 @@ impl<S> Size<S> {
} }
} }
#[inline]
// https://play.rust-lang.org/?gist=1acffaf62743eeb85be1ae6ecf474784&version=stable // https://play.rust-lang.org/?gist=1acffaf62743eeb85be1ae6ecf474784&version=stable
// It might be possible to make a generic definition with Specialization. // It might be possible to make a generic definition with Specialization.
// https://github.com/rust-lang/rust/issues/31844 // https://github.com/rust-lang/rust/issues/31844
@ -364,7 +344,6 @@ impl<S> Size<S> {
} }
} }
#[inline]
fn into_hidden(self) -> Size<Hidden> { fn into_hidden(self) -> Size<Hidden> {
self.size.hide(); self.size.hide();
self.separator.hide(); self.separator.hide();
@ -378,7 +357,6 @@ impl<S> Size<S> {
} }
impl Size<UnInitialized> { impl Size<UnInitialized> {
#[inline]
fn new(size: gtk::Label, separator: gtk::Label) -> Self { fn new(size: gtk::Label, separator: gtk::Label) -> Self {
size.hide(); size.hide();
separator.hide(); separator.hide();
@ -412,7 +390,6 @@ pub struct DownloadPlay<S> {
} }
impl<S> DownloadPlay<S> { impl<S> DownloadPlay<S> {
#[inline]
// https://play.rust-lang.org/?gist=1acffaf62743eeb85be1ae6ecf474784&version=stable // https://play.rust-lang.org/?gist=1acffaf62743eeb85be1ae6ecf474784&version=stable
// It might be possible to make a generic definition with Specialization. // It might be possible to make a generic definition with Specialization.
// https://github.com/rust-lang/rust/issues/31844 // https://github.com/rust-lang/rust/issues/31844
@ -427,7 +404,6 @@ impl<S> DownloadPlay<S> {
} }
} }
#[inline]
fn into_fetchable(self) -> DownloadPlay<Download> { fn into_fetchable(self) -> DownloadPlay<Download> {
self.play.hide(); self.play.hide();
self.download.show(); self.download.show();
@ -439,7 +415,6 @@ impl<S> DownloadPlay<S> {
} }
} }
#[inline]
fn into_hidden(self) -> DownloadPlay<Hidden> { fn into_hidden(self) -> DownloadPlay<Hidden> {
self.play.hide(); self.play.hide();
self.download.hide(); self.download.hide();
@ -451,7 +426,6 @@ impl<S> DownloadPlay<S> {
} }
} }
#[inline]
fn download_connect_clicked<F: Fn(&gtk::Button) + 'static>( fn download_connect_clicked<F: Fn(&gtk::Button) + 'static>(
&self, &self,
f: F, f: F,
@ -459,14 +433,12 @@ impl<S> DownloadPlay<S> {
self.download.connect_clicked(f) self.download.connect_clicked(f)
} }
#[inline]
fn play_connect_clicked<F: Fn(&gtk::Button) + 'static>(&self, f: F) -> glib::SignalHandlerId { fn play_connect_clicked<F: Fn(&gtk::Button) + 'static>(&self, f: F) -> glib::SignalHandlerId {
self.play.connect_clicked(f) self.play.connect_clicked(f)
} }
} }
impl DownloadPlay<UnInitialized> { impl DownloadPlay<UnInitialized> {
#[inline]
fn new(play: gtk::Button, download: gtk::Button) -> Self { fn new(play: gtk::Button, download: gtk::Button) -> Self {
play.hide(); play.hide();
download.hide(); download.hide();
@ -489,7 +461,6 @@ pub struct Progress<S> {
} }
impl<S> Progress<S> { impl<S> Progress<S> {
#[inline]
fn into_shown(self) -> Progress<Shown> { fn into_shown(self) -> Progress<Shown> {
self.bar.show(); self.bar.show();
self.cancel.show(); self.cancel.show();
@ -505,7 +476,6 @@ impl<S> Progress<S> {
} }
} }
#[inline]
fn into_hidden(self) -> Progress<Hidden> { fn into_hidden(self) -> Progress<Hidden> {
self.bar.hide(); self.bar.hide();
self.cancel.hide(); self.cancel.hide();
@ -522,7 +492,6 @@ impl<S> Progress<S> {
} }
#[allow(unused_must_use)] #[allow(unused_must_use)]
#[inline]
// This does not need to be &mut since gtk-rs does not model ownership // 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. // 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) { fn update_progress(&mut self, local_size: &str, fraction: f64) {
@ -530,14 +499,12 @@ impl<S> Progress<S> {
self.bar.set_fraction(fraction); self.bar.set_fraction(fraction);
} }
#[inline]
fn cancel_connect_clicked<F: Fn(&gtk::Button) + 'static>(&self, f: F) -> glib::SignalHandlerId { fn cancel_connect_clicked<F: Fn(&gtk::Button) + 'static>(&self, f: F) -> glib::SignalHandlerId {
self.cancel.connect_clicked(f) self.cancel.connect_clicked(f)
} }
} }
impl Progress<UnInitialized> { impl Progress<UnInitialized> {
#[inline]
fn new( fn new(
bar: gtk::ProgressBar, bar: gtk::ProgressBar,
cancel: gtk::Button, cancel: gtk::Button,
@ -571,7 +538,6 @@ type Playable<Y> = Media<Play, Y, Hidden>;
type InProgress = Media<Hidden, Shown, Shown>; type InProgress = Media<Hidden, Shown, Shown>;
impl<X, Y, Z> Media<X, Y, Z> { impl<X, Y, Z> Media<X, Y, Z> {
#[inline]
fn set_size(self, s: &str) -> Media<X, Shown, Z> { fn set_size(self, s: &str) -> Media<X, Shown, Z> {
Media { Media {
dl: self.dl, dl: self.dl,
@ -580,7 +546,6 @@ impl<X, Y, Z> Media<X, Y, Z> {
} }
} }
#[inline]
fn hide_size(self) -> Media<X, Hidden, Z> { fn hide_size(self) -> Media<X, Hidden, Z> {
Media { Media {
dl: self.dl, dl: self.dl,
@ -589,7 +554,6 @@ impl<X, Y, Z> Media<X, Y, Z> {
} }
} }
#[inline]
fn into_new(self, size: &str) -> New<Shown> { fn into_new(self, size: &str) -> New<Shown> {
Media { Media {
dl: self.dl.into_fetchable(), dl: self.dl.into_fetchable(),
@ -598,7 +562,6 @@ impl<X, Y, Z> Media<X, Y, Z> {
} }
} }
#[inline]
fn into_new_without(self) -> New<Hidden> { fn into_new_without(self) -> New<Hidden> {
Media { Media {
dl: self.dl.into_fetchable(), dl: self.dl.into_fetchable(),
@ -607,7 +570,6 @@ impl<X, Y, Z> Media<X, Y, Z> {
} }
} }
#[inline]
fn into_playable(self, size: &str) -> Playable<Shown> { fn into_playable(self, size: &str) -> Playable<Shown> {
Media { Media {
dl: self.dl.into_playable(), dl: self.dl.into_playable(),
@ -616,7 +578,6 @@ impl<X, Y, Z> Media<X, Y, Z> {
} }
} }
#[inline]
fn into_playable_without(self) -> Playable<Hidden> { fn into_playable_without(self) -> Playable<Hidden> {
Media { Media {
dl: self.dl.into_playable(), dl: self.dl.into_playable(),
@ -627,7 +588,6 @@ impl<X, Y, Z> Media<X, Y, Z> {
} }
impl<X, Z> Media<X, Shown, Z> { impl<X, Z> Media<X, Shown, Z> {
#[inline]
fn into_progress(self) -> InProgress { fn into_progress(self) -> InProgress {
Media { Media {
dl: self.dl.into_hidden(), dl: self.dl.into_hidden(),
@ -638,7 +598,6 @@ impl<X, Z> Media<X, Shown, Z> {
} }
impl<X, Z> Media<X, Hidden, Z> { impl<X, Z> Media<X, Hidden, Z> {
#[inline]
fn into_progress(self) -> InProgress { fn into_progress(self) -> InProgress {
Media { Media {
dl: self.dl.into_hidden(), dl: self.dl.into_hidden(),
@ -649,7 +608,6 @@ impl<X, Z> Media<X, Hidden, Z> {
} }
impl<X, Z> Media<X, UnInitialized, Z> { impl<X, Z> Media<X, UnInitialized, Z> {
#[inline]
fn into_progress(self, size: Option<String>) -> InProgress { fn into_progress(self, size: Option<String>) -> InProgress {
if let Some(s) = size { if let Some(s) = size {
Media { Media {
@ -668,7 +626,6 @@ impl<X, Z> Media<X, UnInitialized, Z> {
} }
impl InProgress { impl InProgress {
#[inline]
#[allow(unused_must_use)] #[allow(unused_must_use)]
// This does not need to be &mut since gtk-rs does not model ownership // 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. // But I think it wouldn't hurt if we treat it as a Rust api.
@ -686,7 +643,6 @@ pub enum ButtonsState {
} }
impl ButtonsState { impl ButtonsState {
#[inline]
pub fn determine_state(self, size: Option<String>, is_downloaded: bool) -> Self { pub fn determine_state(self, size: Option<String>, is_downloaded: bool) -> Self {
use self::ButtonsState::*; use self::ButtonsState::*;
@ -721,7 +677,6 @@ impl ButtonsState {
} }
} }
#[inline]
fn into_progress(self) -> InProgress { fn into_progress(self) -> InProgress {
use self::ButtonsState::*; use self::ButtonsState::*;
@ -733,7 +688,6 @@ impl ButtonsState {
} }
} }
#[inline]
fn set_size(self, size: Option<String>) -> Self { fn set_size(self, size: Option<String>) -> Self {
use self::ButtonsState::*; use self::ButtonsState::*;
@ -749,7 +703,6 @@ impl ButtonsState {
} }
} }
#[inline]
pub fn download_connect_clicked<F: Fn(&gtk::Button) + 'static>( pub fn download_connect_clicked<F: Fn(&gtk::Button) + 'static>(
&self, &self,
f: F, f: F,
@ -764,7 +717,6 @@ impl ButtonsState {
} }
} }
#[inline]
pub fn play_connect_clicked<F: Fn(&gtk::Button) + 'static>( pub fn play_connect_clicked<F: Fn(&gtk::Button) + 'static>(
&self, &self,
f: F, f: F,
@ -779,7 +731,6 @@ impl ButtonsState {
} }
} }
#[inline]
fn cancel_connect_clicked<F: Fn(&gtk::Button) + 'static>(&self, f: F) -> glib::SignalHandlerId { fn cancel_connect_clicked<F: Fn(&gtk::Button) + 'static>(&self, f: F) -> glib::SignalHandlerId {
use self::ButtonsState::*; use self::ButtonsState::*;
@ -801,7 +752,6 @@ pub enum MediaMachine {
impl MediaMachine { impl MediaMachine {
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] #[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[inline]
pub fn new( pub fn new(
play: gtk::Button, play: gtk::Button,
download: gtk::Button, download: gtk::Button,
@ -819,7 +769,6 @@ impl MediaMachine {
MediaMachine::UnInitialized(Media { dl, progress, size }) MediaMachine::UnInitialized(Media { dl, progress, size })
} }
#[inline]
pub fn download_connect_clicked<F: Fn(&gtk::Button) + 'static>( pub fn download_connect_clicked<F: Fn(&gtk::Button) + 'static>(
&self, &self,
f: F, f: F,
@ -833,7 +782,6 @@ impl MediaMachine {
} }
} }
#[inline]
pub fn play_connect_clicked<F: Fn(&gtk::Button) + 'static>( pub fn play_connect_clicked<F: Fn(&gtk::Button) + 'static>(
&self, &self,
f: F, f: F,
@ -847,7 +795,6 @@ impl MediaMachine {
} }
} }
#[inline]
pub fn cancel_connect_clicked<F: Fn(&gtk::Button) + 'static>( pub fn cancel_connect_clicked<F: Fn(&gtk::Button) + 'static>(
&self, &self,
f: F, f: F,
@ -861,7 +808,6 @@ impl MediaMachine {
} }
} }
#[inline]
pub fn determine_state(self, bytes: Option<i32>, is_active: bool, is_downloaded: bool) -> Self { pub fn determine_state(self, bytes: Option<i32>, is_active: bool, is_downloaded: bool) -> Self {
use self::ButtonsState::*; use self::ButtonsState::*;
use self::MediaMachine::*; use self::MediaMachine::*;
@ -900,7 +846,6 @@ impl MediaMachine {
} }
} }
#[inline]
pub fn set_size(self, bytes: Option<i32>) -> Self { pub fn set_size(self, bytes: Option<i32>) -> Self {
use self::MediaMachine::*; use self::MediaMachine::*;
let size = size_helper(bytes); let size = size_helper(bytes);
@ -913,7 +858,6 @@ impl MediaMachine {
} }
} }
#[inline]
pub fn update_progress(&mut self, local_size: &str, fraction: f64) { pub fn update_progress(&mut self, local_size: &str, fraction: f64) {
use self::MediaMachine::*; use self::MediaMachine::*;
@ -925,7 +869,6 @@ impl MediaMachine {
} }
} }
#[inline]
fn size_helper(bytes: Option<i32>) -> Option<String> { fn size_helper(bytes: Option<i32>) -> Option<String> {
let s = bytes?; let s = bytes?;
if s == 0 { if s == 0 {

View File

@ -48,7 +48,6 @@ pub struct HomeView {
} }
impl Default for HomeView { impl Default for HomeView {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episodes_view.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episodes_view.ui");
let container: gtk::Box = builder.get_object("container").unwrap(); let container: gtk::Box = builder.get_object("container").unwrap();
@ -85,7 +84,6 @@ impl Default for HomeView {
// TODO: REFACTOR ME // TODO: REFACTOR ME
impl HomeView { impl HomeView {
#[inline]
pub fn new(sender: Sender<Action>) -> Result<Rc<HomeView>, Error> { pub fn new(sender: Sender<Action>) -> Result<Rc<HomeView>, Error> {
use self::ListSplit::*; use self::ListSplit::*;
@ -121,7 +119,6 @@ impl HomeView {
Ok(view) Ok(view)
} }
#[inline]
/// Set scrolled window vertical adjustment. /// Set scrolled window vertical adjustment.
fn set_vadjustment(&self) -> Result<(), Error> { fn set_vadjustment(&self) -> Result<(), Error> {
let guard = EPISODES_VIEW_VALIGNMENT let guard = EPISODES_VIEW_VALIGNMENT
@ -138,7 +135,6 @@ impl HomeView {
Ok(()) Ok(())
} }
#[inline]
/// Save the vertical scrollbar position. /// Save the vertical scrollbar position.
pub fn save_alignment(&self) -> Result<(), Error> { pub fn save_alignment(&self) -> Result<(), Error> {
if let Ok(mut guard) = EPISODES_VIEW_VALIGNMENT.lock() { if let Ok(mut guard) = EPISODES_VIEW_VALIGNMENT.lock() {
@ -153,13 +149,11 @@ impl HomeView {
} }
} }
#[inline]
fn add_to_box(widget: &EpisodesViewWidget, listbox: &gtk::ListBox, box_: &gtk::Box) { fn add_to_box(widget: &EpisodesViewWidget, listbox: &gtk::ListBox, box_: &gtk::Box) {
listbox.add(&widget.container); listbox.add(&widget.container);
box_.show(); box_.show();
} }
#[inline]
fn split(now: &DateTime<Utc>, epoch: i64) -> ListSplit { fn split(now: &DateTime<Utc>, epoch: i64) -> ListSplit {
let ep = Utc.timestamp(epoch, 0); let ep = Utc.timestamp(epoch, 0);
@ -184,7 +178,6 @@ struct EpisodesViewWidget {
} }
impl Default for EpisodesViewWidget { impl Default for EpisodesViewWidget {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = let builder =
gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episodes_view_widget.ui"); gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episodes_view_widget.ui");
@ -220,7 +213,6 @@ impl EpisodesViewWidget {
view view
} }
#[inline]
fn init(&self, podcast_id: i32) { fn init(&self, podcast_id: i32) {
self.set_cover(podcast_id) self.set_cover(podcast_id)
.map_err(|err| error!("Failed to set a cover: {}", err)) .map_err(|err| error!("Failed to set a cover: {}", err))
@ -229,7 +221,6 @@ impl EpisodesViewWidget {
self.container.pack_start(&self.episode, true, true, 6); self.container.pack_start(&self.episode, true, true, 6);
} }
#[inline]
fn set_cover(&self, podcast_id: i32) -> Result<(), Error> { fn set_cover(&self, podcast_id: i32) -> Result<(), Error> {
utils::set_image_from_path(&self.image, podcast_id, 64) utils::set_image_from_path(&self.image, podcast_id, 64)
} }

View File

@ -40,7 +40,6 @@ pub struct ShowWidget {
} }
impl Default for ShowWidget { impl Default for ShowWidget {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/show_widget.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/show_widget.ui");
let container: gtk::Box = builder.get_object("container").unwrap(); let container: gtk::Box = builder.get_object("container").unwrap();
@ -68,7 +67,6 @@ impl Default for ShowWidget {
} }
impl ShowWidget { impl ShowWidget {
#[inline]
pub fn new(pd: Arc<Podcast>, sender: Sender<Action>) -> Rc<ShowWidget> { pub fn new(pd: Arc<Podcast>, sender: Sender<Action>) -> Rc<ShowWidget> {
let mut pdw = ShowWidget::default(); let mut pdw = ShowWidget::default();
pdw.init(&pd, &sender); pdw.init(&pd, &sender);
@ -80,7 +78,6 @@ impl ShowWidget {
pdw pdw
} }
#[inline]
pub fn init(&mut self, pd: &Arc<Podcast>, sender: &Sender<Action>) { pub fn init(&mut self, pd: &Arc<Podcast>, sender: &Sender<Action>) {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/show_widget.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/show_widget.ui");
@ -120,19 +117,16 @@ impl ShowWidget {
self.settings.set_popover(&show_menu); self.settings.set_popover(&show_menu);
} }
#[inline]
/// Set the show cover. /// Set the show cover.
fn set_cover(&self, pd: &Arc<Podcast>) -> Result<(), Error> { fn set_cover(&self, pd: &Arc<Podcast>) -> Result<(), Error> {
utils::set_image_from_path(&self.cover, pd.id(), 256) utils::set_image_from_path(&self.cover, pd.id(), 256)
} }
#[inline]
/// Set the descripton text. /// Set the descripton text.
fn set_description(&self, text: &str) { fn set_description(&self, text: &str) {
self.description.set_markup(&markup_from_raw(text)); self.description.set_markup(&markup_from_raw(text));
} }
#[inline]
/// Save the scrollabar vajustment to the cache. /// Save the scrollabar vajustment to the cache.
pub fn save_vadjustment(&self, oldid: i32) -> Result<(), Error> { pub fn save_vadjustment(&self, oldid: i32) -> Result<(), Error> {
if let Ok(mut guard) = SHOW_WIDGET_VALIGNMENT.lock() { if let Ok(mut guard) = SHOW_WIDGET_VALIGNMENT.lock() {
@ -146,7 +140,6 @@ impl ShowWidget {
Ok(()) Ok(())
} }
#[inline]
/// Set scrolled window vertical adjustment. /// Set scrolled window vertical adjustment.
fn set_vadjustment(&self, pd: &Arc<Podcast>) -> Result<(), Error> { fn set_vadjustment(&self, pd: &Arc<Podcast>) -> Result<(), Error> {
let guard = SHOW_WIDGET_VALIGNMENT let guard = SHOW_WIDGET_VALIGNMENT
@ -176,7 +169,6 @@ impl ShowWidget {
} }
} }
#[inline]
/// Populate the listbox with the shows episodes. /// Populate the listbox with the shows episodes.
fn populate_listbox( fn populate_listbox(
show: &Rc<ShowWidget>, show: &Rc<ShowWidget>,
@ -231,7 +223,6 @@ fn populate_listbox(
Ok(()) Ok(())
} }
#[inline]
fn on_unsub_button_clicked(pd: Arc<Podcast>, unsub_button: &gtk::Button, sender: &Sender<Action>) { fn on_unsub_button_clicked(pd: Arc<Podcast>, unsub_button: &gtk::Button, sender: &Sender<Action>) {
// hack to get away without properly checking for none. // hack to get away without properly checking for none.
// if pressed twice would panic. // if pressed twice would panic.
@ -252,7 +243,6 @@ fn on_unsub_button_clicked(pd: Arc<Podcast>, unsub_button: &gtk::Button, sender:
unsub_button.set_sensitive(true); unsub_button.set_sensitive(true);
} }
#[inline]
fn on_played_button_clicked(pd: Arc<Podcast>, episodes: &gtk::ListBox, sender: &Sender<Action>) { fn on_played_button_clicked(pd: Arc<Podcast>, episodes: &gtk::ListBox, sender: &Sender<Action>) {
if dim_titles(episodes).is_none() { if dim_titles(episodes).is_none() {
error!("Something went horribly wrong when dimming the titles."); error!("Something went horribly wrong when dimming the titles.");
@ -265,7 +255,6 @@ fn on_played_button_clicked(pd: Arc<Podcast>, episodes: &gtk::ListBox, sender: &
.ok(); .ok();
} }
#[inline]
fn mark_all_watched(pd: &Podcast, sender: &Sender<Action>) -> Result<(), Error> { fn mark_all_watched(pd: &Podcast, sender: &Sender<Action>) -> Result<(), Error> {
dbqueries::update_none_to_played_now(pd)?; dbqueries::update_none_to_played_now(pd)?;
// Not all widgets migth have been loaded when the mark_all is hit // Not all widgets migth have been loaded when the mark_all is hit
@ -274,7 +263,6 @@ fn mark_all_watched(pd: &Podcast, sender: &Sender<Action>) -> Result<(), Error>
sender.send(Action::RefreshEpisodesView).map_err(From::from) sender.send(Action::RefreshEpisodesView).map_err(From::from)
} }
#[inline]
pub fn mark_all_notif(pd: Arc<Podcast>, sender: &Sender<Action>) -> InAppNotification { pub fn mark_all_notif(pd: Arc<Podcast>, sender: &Sender<Action>) -> InAppNotification {
let id = pd.id(); let id = pd.id();
let callback = clone!(sender => move || { let callback = clone!(sender => move || {
@ -294,7 +282,6 @@ pub fn mark_all_notif(pd: Arc<Podcast>, sender: &Sender<Action>) -> InAppNotific
InAppNotification::new(text, callback, undo_callback) InAppNotification::new(text, callback, undo_callback)
} }
#[inline]
pub fn remove_show_notif(pd: Arc<Podcast>, sender: Sender<Action>) -> InAppNotification { pub fn remove_show_notif(pd: Arc<Podcast>, sender: Sender<Action>) -> InAppNotification {
let text = format!("Unsubscribed from {}", pd.title()); let text = format!("Unsubscribed from {}", pd.title());
@ -335,7 +322,6 @@ pub fn remove_show_notif(pd: Arc<Podcast>, sender: Sender<Action>) -> InAppNotif
InAppNotification::new(&text, callback, undo_callback) InAppNotification::new(&text, callback, undo_callback)
} }
#[inline]
// Ideally if we had a custom widget this would have been as simple as: // Ideally if we had a custom widget this would have been as simple as:
// `for row in listbox { ep = row.get_episode(); ep.dim_title(); }` // `for row in listbox { ep = row.get_episode(); ep.dim_title(); }`
// But now I can't think of a better way to do it than hardcoding the title // But now I can't think of a better way to do it than hardcoding the title

View File

@ -20,7 +20,6 @@ pub struct ShowsView {
} }
impl Default for ShowsView { impl Default for ShowsView {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/shows_view.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/shows_view.ui");
let container: gtk::Box = builder.get_object("fb_parent").unwrap(); let container: gtk::Box = builder.get_object("fb_parent").unwrap();
@ -36,14 +35,12 @@ impl Default for ShowsView {
} }
impl ShowsView { impl ShowsView {
#[inline]
pub fn new(sender: Sender<Action>) -> Result<Rc<Self>, Error> { pub fn new(sender: Sender<Action>) -> Result<Rc<Self>, Error> {
let pop = Rc::new(ShowsView::default()); let pop = Rc::new(ShowsView::default());
pop.init(sender)?; pop.init(sender)?;
Ok(pop) Ok(pop)
} }
#[inline]
pub fn init(&self, sender: Sender<Action>) -> Result<(), Error> { pub fn init(&self, sender: Sender<Action>) -> Result<(), Error> {
self.flowbox.connect_child_activated(move |_, child| { self.flowbox.connect_child_activated(move |_, child| {
on_child_activate(child, &sender) on_child_activate(child, &sender)
@ -54,7 +51,6 @@ impl ShowsView {
self.populate_flowbox() self.populate_flowbox()
} }
#[inline]
fn populate_flowbox(&self) -> Result<(), Error> { fn populate_flowbox(&self) -> Result<(), Error> {
let ignore = get_ignored_shows()?; let ignore = get_ignored_shows()?;
let podcasts = dbqueries::get_podcasts_filter(&ignore)?; let podcasts = dbqueries::get_podcasts_filter(&ignore)?;
@ -70,7 +66,6 @@ impl ShowsView {
} }
} }
#[inline]
fn on_child_activate(child: &gtk::FlowBoxChild, sender: &Sender<Action>) -> Result<(), Error> { fn on_child_activate(child: &gtk::FlowBoxChild, sender: &Sender<Action>) -> Result<(), Error> {
use gtk::WidgetExt; use gtk::WidgetExt;
@ -94,7 +89,6 @@ struct ShowsChild {
} }
impl Default for ShowsChild { impl Default for ShowsChild {
#[inline]
fn default() -> Self { fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/shows_child.ui"); let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/shows_child.ui");
@ -113,14 +107,12 @@ impl Default for ShowsChild {
} }
impl ShowsChild { impl ShowsChild {
#[inline]
pub fn new(pd: &Podcast) -> ShowsChild { pub fn new(pd: &Podcast) -> ShowsChild {
let child = ShowsChild::default(); let child = ShowsChild::default();
child.init(pd); child.init(pd);
child child
} }
#[inline]
fn init(&self, pd: &Podcast) { fn init(&self, pd: &Podcast) {
self.container.set_tooltip_text(pd.title()); self.container.set_tooltip_text(pd.title());
WidgetExt::set_name(&self.child, &pd.id().to_string()); WidgetExt::set_name(&self.child, &pd.id().to_string());
@ -130,7 +122,6 @@ impl ShowsChild {
.ok(); .ok();
} }
#[inline]
fn set_cover(&self, podcast_id: i32) -> Result<(), Error> { fn set_cover(&self, podcast_id: i32) -> Result<(), Error> {
set_image_from_path(&self.cover, podcast_id, 256) set_image_from_path(&self.cover, podcast_id, 256)
} }