style(clippy): enforce clippy use_self lint

Clippy's `use_self` line ensures that `Self` is used instead of the real
name whenever possible. This makes searching easier and cleans up the
code a bit.
This commit is contained in:
Thomas Frans
2023-09-27 21:53:13 +02:00
committed by Henrik Friedrichsen
parent 01e01b59e4
commit fe8f8e78ee
25 changed files with 170 additions and 172 deletions

View File

@@ -56,12 +56,8 @@ pub struct Spotify {
}
impl Spotify {
pub fn new(
events: EventManager,
credentials: Credentials,
cfg: Arc<config::Config>,
) -> Spotify {
let mut spotify = Spotify {
pub fn new(events: EventManager, credentials: Credentials, cfg: Arc<config::Config>) -> Self {
let mut spotify = Self {
events,
credentials,
cfg: cfg.clone(),
@@ -402,19 +398,19 @@ pub enum UriType {
}
impl UriType {
pub fn from_uri(s: &str) -> Option<UriType> {
pub fn from_uri(s: &str) -> Option<Self> {
if s.starts_with("spotify:album:") {
Some(UriType::Album)
Some(Self::Album)
} else if s.starts_with("spotify:artist:") {
Some(UriType::Artist)
Some(Self::Artist)
} else if s.starts_with("spotify:track:") {
Some(UriType::Track)
Some(Self::Track)
} else if s.starts_with("spotify:") && s.contains(":playlist:") {
Some(UriType::Playlist)
Some(Self::Playlist)
} else if s.starts_with("spotify:show:") {
Some(UriType::Show)
Some(Self::Show)
} else if s.starts_with("spotify:episode:") {
Some(UriType::Episode)
Some(Self::Episode)
} else {
None
}