diff --git a/src/album.rs b/src/album.rs index 87b6fee..947a3fa 100644 --- a/src/album.rs +++ b/src/album.rs @@ -225,7 +225,7 @@ impl ListItem for Album { } fn open(&self, queue: Arc, library: Arc) -> Option> { - Some(AlbumView::new(queue, library, self).as_boxed_view_ext()) + Some(AlbumView::new(queue, library, self).into_boxed_view_ext()) } fn share_url(&self) -> Option { diff --git a/src/artist.rs b/src/artist.rs index 304efab..001efd1 100644 --- a/src/artist.rs +++ b/src/artist.rs @@ -222,7 +222,7 @@ impl ListItem for Artist { } fn open(&self, queue: Arc, library: Arc) -> Option> { - Some(ArtistView::new(queue, library, self).as_boxed_view_ext()) + Some(ArtistView::new(queue, library, self).into_boxed_view_ext()) } fn share_url(&self) -> Option { diff --git a/src/commands.rs b/src/commands.rs index d85eada..daa5a9f 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -228,7 +228,7 @@ impl CommandManager { s.call_on_name("main", |v: &mut Layout| { v.set_screen("search"); if let Some(results) = view { - v.push_view(results.as_boxed_view_ext()) + v.push_view(results.into_boxed_view_ext()) } }); Ok(None) diff --git a/src/library.rs b/src/library.rs index e9dce42..92d4775 100644 --- a/src/library.rs +++ b/src/library.rs @@ -104,7 +104,7 @@ impl Library { self.playlists() .iter() .find(|local| local.id == remote.id) - .and_then(|local| Some(local.snapshot_id != remote.snapshot_id)) + .map(|local| local.snapshot_id != remote.snapshot_id) .unwrap_or(true) } diff --git a/src/playlist.rs b/src/playlist.rs index 2909317..9eb1143 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -305,7 +305,7 @@ impl ListItem for Playlist { } fn open(&self, queue: Arc, library: Arc) -> Option> { - Some(PlaylistView::new(queue, library, self).as_boxed_view_ext()) + Some(PlaylistView::new(queue, library, self).into_boxed_view_ext()) } fn share_url(&self) -> Option { diff --git a/src/show.rs b/src/show.rs index a6063e1..227403a 100644 --- a/src/show.rs +++ b/src/show.rs @@ -155,7 +155,7 @@ impl ListItem for Show { } fn open(&self, queue: Arc, library: Arc) -> Option> { - Some(ShowView::new(queue, library, self).as_boxed_view_ext()) + Some(ShowView::new(queue, library, self).into_boxed_view_ext()) } fn share_url(&self) -> Option { diff --git a/src/track.rs b/src/track.rs index 9062043..ebfa079 100644 --- a/src/track.rs +++ b/src/track.rs @@ -269,7 +269,7 @@ impl ListItem for Track { self.artists.join(", "), self.title )) - .as_boxed_view_ext() + .into_boxed_view_ext() }) } diff --git a/src/traits.rs b/src/traits.rs index b598dbc..3ee1d83 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -77,11 +77,11 @@ impl ViewExt for NamedView { } pub trait IntoBoxedViewExt { - fn as_boxed_view_ext(self) -> Box; + fn into_boxed_view_ext(self) -> Box; } impl IntoBoxedViewExt for V { - fn as_boxed_view_ext(self) -> Box { + fn into_boxed_view_ext(self) -> Box { Box::new(self) } } diff --git a/src/ui/cover.rs b/src/ui/cover.rs index bc823ec..f926a6a 100644 --- a/src/ui/cover.rs +++ b/src/ui/cover.rs @@ -262,7 +262,7 @@ impl ViewExt for CoverView { GotoMode::Album => { if let Some(album) = track.album(queue.clone()) { let view = - AlbumView::new(queue, library, &album).as_boxed_view_ext(); + AlbumView::new(queue, library, &album).into_boxed_view_ext(); return Ok(CommandResult::View(view)); } } @@ -274,7 +274,7 @@ impl ViewExt for CoverView { // the cover image really doesn't play nice with the menu _ => { let view = ArtistView::new(queue, library, &artists[0]) - .as_boxed_view_ext(); + .into_boxed_view_ext(); Ok(CommandResult::View(view)) } }; diff --git a/src/ui/layout.rs b/src/ui/layout.rs index 0050d4f..bdd683b 100644 --- a/src/ui/layout.rs +++ b/src/ui/layout.rs @@ -75,7 +75,7 @@ impl Layout { } let s = id.into(); - self.screens.insert(s.clone(), view.as_boxed_view_ext()); + self.screens.insert(s.clone(), view.into_boxed_view_ext()); self.stack.insert(s.clone(), Vec::new()); self.focus = Some(s); } diff --git a/src/ui/listview.rs b/src/ui/listview.rs index 6a1bbc9..636d13c 100644 --- a/src/ui/listview.rs +++ b/src/ui/listview.rs @@ -496,7 +496,7 @@ impl ViewExt for ListView { GotoMode::Album => { if let Some(album) = item.album(queue.clone()) { let view = - AlbumView::new(queue, library, &album).as_boxed_view_ext(); + AlbumView::new(queue, library, &album).into_boxed_view_ext(); return Ok(CommandResult::View(view)); } } @@ -506,7 +506,7 @@ impl ViewExt for ListView { 0 => Ok(CommandResult::Consumed(None)), 1 => { let view = ArtistView::new(queue, library, &artists[0]) - .as_boxed_view_ext(); + .into_boxed_view_ext(); Ok(CommandResult::View(view)) } _ => { diff --git a/src/ui/tabview.rs b/src/ui/tabview.rs index 25bc0e0..aa45e3e 100644 --- a/src/ui/tabview.rs +++ b/src/ui/tabview.rs @@ -35,7 +35,7 @@ impl TabView { pub fn add_tab, V: IntoBoxedViewExt>(&mut self, id: S, title: S, view: V) { let tab = Tab { title: title.into(), - view: view.as_boxed_view_ext(), + view: view.into_boxed_view_ext(), }; self.tabs.push(tab); self.ids.insert(id.into(), self.tabs.len() - 1);