Skip to content

Commit

Permalink
Remove some useless string conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
Radiicall committed Dec 22, 2023
1 parent cfac04a commit 50dc1d2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions jellyfin-rpc/src/services/jellyfin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ impl Content {
let raw_artists = now_playing_item["Artists"]
.as_array()?
.iter()
.map(|a| a.as_str().unwrap().to_string())
.collect::<Vec<String>>();
.map(|a| a.as_str().unwrap())
.collect::<Vec<&str>>();

let artists = Self::get_artists(raw_artists);

Expand Down Expand Up @@ -310,8 +310,8 @@ impl Content {
let raw_artists = now_playing_item["Artists"]
.as_array()?
.iter()
.map(|a| a.as_str().unwrap().to_string())
.collect::<Vec<String>>();
.map(|a| a.as_str().unwrap())
.collect::<Vec<&str>>();

let artists = Self::get_artists(raw_artists);

Expand All @@ -329,7 +329,7 @@ impl Content {
Some(())
}

fn get_artists(raw_artists: Vec<String>) -> String {
fn get_artists(raw_artists: Vec<&str>) -> String {
let mut artists = String::new();
for (i, artist) in raw_artists.iter().enumerate() {
if i != 0 {
Expand Down Expand Up @@ -434,8 +434,8 @@ impl Content {
&genre_array
.as_array()?
.iter()
.map(|genre| genre.as_str().unwrap().to_string())
.collect::<Vec<String>>()
.map(|genre| genre.as_str().unwrap())
.collect::<Vec<&str>>()
.join(", "),
);
Some(genres)
Expand Down

0 comments on commit 50dc1d2

Please sign in to comment.