diff --git a/src/db_operations.rs b/src/db_operations.rs index 504e830..b4207d8 100644 --- a/src/db_operations.rs +++ b/src/db_operations.rs @@ -16,14 +16,14 @@ pub struct DatabaseRequest { } impl SearchType { - pub fn is_where(self: &Self) -> bool { + pub fn is_where(&self) -> bool { match self { SearchType::Where => true, SearchType::Like => false, } } - pub fn is_like(self: &Self) -> bool { + pub fn is_like(&self) -> bool { match self { SearchType::Where => false, SearchType::Like => true, @@ -111,7 +111,7 @@ impl DBObject { Ok(DBObject { conn }) } - pub fn save_tag(self: &Self, tag: &ItemTag) -> Result<(), DatabaseCreationError> { + pub fn save_tag(&self, tag: &ItemTag) -> Result<(), DatabaseCreationError> { self.conn.execute( "INSERT OR IGNORE INTO musicinfo (path, title, artist, album, album_artist) VALUES ( ?1, ?2, ?3, ?4, ?5 )", params![tag.path, tag.title, tag.artist, tag.album, tag.album_artist], @@ -122,7 +122,7 @@ impl DBObject { /// Returns a vector of ItemTags that fulfil the requested query /// pub fn get( - self: &Self, + &self, request: &DatabaseRequest, ) -> Result>, rusqlite::Error> { assert!(!request.search_tag.is_empty(), "There must be at least one field filled in the PartialItem. Use `get_all()` if you want the full table"); diff --git a/src/message_types.rs b/src/message_types.rs index a9d7d9c..cda13ed 100644 --- a/src/message_types.rs +++ b/src/message_types.rs @@ -44,27 +44,27 @@ impl Default for PartialTag { } impl PartialTag { - pub fn has_path(self: &Self) -> bool { + pub fn has_path(&self) -> bool { self.path.is_some() } - pub fn has_title(self: &Self) -> bool { + pub fn has_title(&self) -> bool { self.title.is_some() } - pub fn has_artist(self: &Self) -> bool { + pub fn has_artist(&self) -> bool { self.artist.is_some() } - pub fn has_album(self: &Self) -> bool { + pub fn has_album(&self) -> bool { self.album.is_some() } - pub fn has_album_artist(self: &Self) -> bool { + pub fn has_album_artist(&self) -> bool { self.album_artist.is_some() } - pub fn is_empty(self: &Self) -> bool { + pub fn is_empty(&self) -> bool { return self.path.is_none() && self.title.is_none() && self.artist.is_none() diff --git a/src/music_player.rs b/src/music_player.rs index a691d5e..6097aff 100644 --- a/src/music_player.rs +++ b/src/music_player.rs @@ -36,17 +36,17 @@ impl<'a> MusicPlayer<'a> { return mp; } - pub fn pause(self: &Self) -> () { + pub fn pause(&self) { self.playing_sink.pause(); } - pub fn play(self: &Self) -> () { + pub fn play(&self) { self.playing_sink.play(); println!("playing"); } // TODO: set these to return results - pub fn change_now_playing(self: &mut Self, item: ItemTag) -> Result<(), MusicPlayerError> { + pub fn change_now_playing(&mut self, item: ItemTag) -> Result<(), MusicPlayerError> { println!("\n\n switching now playing to: {}", item.path.clone()); let file = File::open(item.path.clone());