Skip to content

Commit 245efa9

Browse files
authored
ci: fix ci failure (#717)
Minor changes to make CI pass. This also removes the need for `once_cel`as a dependency. (At least a direct one)
1 parent 0d429f8 commit 245efa9

11 files changed

Lines changed: 68 additions & 68 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spotify_player/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ notify-rust = { version = "4.11.6", optional = true, default-features = false, f
4848
] }
4949
flume = "0.11.1"
5050
serde_json = "1.0.140"
51-
once_cell = "1.21.3"
5251
regex = "1.11.1"
5352
daemonize = { version = "0.5.0", optional = true }
5453
ttl_cache = "0.5.1"

spotify_player/src/cli/client.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{
22
collections::HashSet,
3+
fmt::Write as _,
34
fs::{create_dir_all, remove_dir_all},
45
io::Write,
56
net::SocketAddr,
@@ -511,7 +512,7 @@ async fn handle_playlist_request(client: &Client, command: PlaylistCommand) -> R
511512

512513
let mut out = String::new();
513514
for pl in resp {
514-
out += &format!("{}: {}\n", pl.id.id(), pl.name);
515+
writeln!(out, "{}: {}", pl.id.id(), pl.name).unwrap();
515516
}
516517
out = out.trim().to_string();
517518

@@ -587,10 +588,7 @@ async fn handle_playlist_request(client: &Client, command: PlaylistCommand) -> R
587588
}
588589
} else {
589590
remove_dir_all(&to_dir)?;
590-
result += &format!(
591-
"Not following playlist '{}'. Deleted its import data in the cache folder...\n",
592-
to_id.id()
593-
);
591+
writeln!(result, "Not following playlist '{}'. Deleted its import data in the cache folder...", to_id.id()).unwrap();
594592
}
595593
}
596594

@@ -656,13 +654,15 @@ async fn playlist_import(
656654
let mut new_tracks_hash_set = &from_hash_set - &to_hash_set;
657655

658656
let mut result = String::new();
659-
result += &format!(
660-
"Importing from {}:{} to {}:{}...\n",
657+
writeln!(
658+
result,
659+
"Importing from {}:{} to {}:{}...",
661660
import_from.id(),
662661
from_name,
663662
import_to.id(),
664663
to_name
665-
);
664+
)
665+
.unwrap();
666666

667667
let mut track_buff = Vec::new();
668668
if from_file.exists() {
@@ -700,17 +700,21 @@ async fn playlist_import(
700700
.playlist_remove_all_occurrences_of_items(import_to.as_ref(), track_buff, None)
701701
.await?;
702702
}
703-
result += &format!("Tracks deleted from {from_name}: \n");
703+
writeln!(result, "Tracks deleted from {from_name}: \n").unwrap();
704704
} else {
705-
result += &format!("Tracks that are no longer in {from_name} since last import: \n");
705+
writeln!(
706+
result,
707+
"Tracks that are no longer in {from_name} since last import: "
708+
)
709+
.unwrap();
706710
}
707711

708712
for t in &deleted_hash_set {
709-
result += &format!(" {}: {}\n", t.id.id(), t.name);
713+
writeln!(result, " {}: {}", t.id.id(), t.name).unwrap();
710714
}
711715
}
712716

713-
result += &format!("New tracks imported to {to_name}: \n");
717+
writeln!(result, "New tracks imported to {to_name}: ").unwrap();
714718

715719
track_buff = Vec::new();
716720
for t in &new_tracks_hash_set {
@@ -723,7 +727,7 @@ async fn playlist_import(
723727
track_buff = Vec::new();
724728
}
725729

726-
result += &format!(" {}: {}\n", t.id.id(), t.name);
730+
writeln!(result, " {}: {}", t.id.id(), t.name).unwrap();
727731
}
728732

729733
if !track_buff.is_empty() {

spotify_player/src/client/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl Client {
301301
PlayerRequest::TransferPlayback(..) => {
302302
anyhow::bail!("`TransferPlayback` should be handled earlier")
303303
}
304-
};
304+
}
305305

306306
Ok(Some(playback))
307307
}
@@ -592,7 +592,7 @@ impl Client {
592592
)
593593
.await?;
594594
}
595-
};
595+
}
596596

597597
tracing::info!(
598598
"Successfully handled the client request, took: {}ms",
@@ -1768,7 +1768,7 @@ impl Client {
17681768
text += &episode.show.name;
17691769
}
17701770
},
1771-
_ => continue,
1771+
&_ => {}
17721772
}
17731773
}
17741774
if ptr < format_str.len() {

spotify_player/src/event/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ fn handle_global_action(
509509
}
510510
}
511511
}
512-
};
512+
}
513513

514514
Ok(false)
515515
}

spotify_player/src/event/page.rs

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -425,42 +425,40 @@ fn handle_command_for_browse_page(
425425
return Ok(true);
426426
}
427427
match command {
428-
Command::ChooseSelected => {
429-
match page_state {
430-
PageState::Browse { state } => match state {
431-
BrowsePageUIState::CategoryList { .. } => {
432-
let categories = ui.search_filtered_items(&data.browse.categories);
433-
client_pub.send(ClientRequest::GetBrowseCategoryPlaylists(
434-
categories[selected].clone(),
435-
))?;
436-
ui.new_page(PageState::Browse {
437-
state: BrowsePageUIState::CategoryPlaylistList {
438-
category: categories[selected].clone(),
439-
state: ListState::default(),
440-
},
441-
});
442-
}
443-
BrowsePageUIState::CategoryPlaylistList { category, .. } => {
444-
let playlists =
445-
data.browse
446-
.category_playlists
447-
.get(&category.id)
448-
.context(format!(
449-
"expect to have playlists data for {category} category"
450-
))?;
451-
let context_id = ContextId::Playlist(
452-
ui.search_filtered_items(playlists)[selected].id.clone(),
453-
);
454-
ui.new_page(PageState::Context {
455-
id: None,
456-
context_page_type: ContextPageType::Browsing(context_id),
457-
state: None,
458-
});
459-
}
460-
},
461-
_ => anyhow::bail!("expect a browse page state"),
462-
};
463-
}
428+
Command::ChooseSelected => match page_state {
429+
PageState::Browse { state } => match state {
430+
BrowsePageUIState::CategoryList { .. } => {
431+
let categories = ui.search_filtered_items(&data.browse.categories);
432+
client_pub.send(ClientRequest::GetBrowseCategoryPlaylists(
433+
categories[selected].clone(),
434+
))?;
435+
ui.new_page(PageState::Browse {
436+
state: BrowsePageUIState::CategoryPlaylistList {
437+
category: categories[selected].clone(),
438+
state: ListState::default(),
439+
},
440+
});
441+
}
442+
BrowsePageUIState::CategoryPlaylistList { category, .. } => {
443+
let playlists =
444+
data.browse
445+
.category_playlists
446+
.get(&category.id)
447+
.context(format!(
448+
"expect to have playlists data for {category} category"
449+
))?;
450+
let context_id = ContextId::Playlist(
451+
ui.search_filtered_items(playlists)[selected].id.clone(),
452+
);
453+
ui.new_page(PageState::Context {
454+
id: None,
455+
context_page_type: ContextPageType::Browsing(context_id),
456+
state: None,
457+
});
458+
}
459+
},
460+
_ => anyhow::bail!("expect a browse page state"),
461+
},
464462
Command::Search => {
465463
ui.new_search_popup();
466464
}

spotify_player/src/event/popup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ fn handle_command_for_list_popup(
457457
on_close_func(ui);
458458
}
459459
_ => return Ok(false),
460-
};
460+
}
461461
Ok(true)
462462
}
463463

spotify_player/src/event/window.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn handle_playlist_modify_command(
238238
snapshot_id: None,
239239
})?;
240240
ui.current_page_mut().select(id + 1);
241-
};
241+
}
242242
return Ok(true);
243243
}
244244
Command::ShowActionsOnSelectedItem => {
@@ -480,7 +480,7 @@ pub fn handle_command_for_playlist_list_window(
480480
state.playlist_folder_id = f.target_id;
481481
}
482482
_ => return false,
483-
};
483+
}
484484
}
485485
PlaylistFolderItem::Playlist(p) => {
486486
let context_id = ContextId::Playlist(p.id.clone());

spotify_player/src/media_control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn update_control_metadata(
6060
*prev_info = episode_info;
6161
}
6262
}
63-
};
63+
}
6464
}
6565
}
6666

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
pub use super::*;
2-
use once_cell::sync::Lazy;
2+
use std::sync::LazyLock;
33

4-
pub static USER_TOP_TRACKS_ID: Lazy<TracksId> =
5-
Lazy::new(|| TracksId::new("tracks:user-top-tracks", "Top Tracks"));
4+
pub static USER_TOP_TRACKS_ID: LazyLock<TracksId> =
5+
LazyLock::new(|| TracksId::new("tracks:user-top-tracks", "Top Tracks"));
66

7-
pub static USER_RECENTLY_PLAYED_TRACKS_ID: Lazy<TracksId> = Lazy::new(|| {
7+
pub static USER_RECENTLY_PLAYED_TRACKS_ID: LazyLock<TracksId> = LazyLock::new(|| {
88
TracksId::new(
99
"tracks:user-recently-played-tracks",
1010
"Recently Played Tracks",
1111
)
1212
});
1313

14-
pub static USER_LIKED_TRACKS_ID: Lazy<TracksId> =
15-
Lazy::new(|| TracksId::new("tracks:user-liked-tracks", "Liked Tracks"));
14+
pub static USER_LIKED_TRACKS_ID: LazyLock<TracksId> =
15+
LazyLock::new(|| TracksId::new("tracks:user-liked-tracks", "Liked Tracks"));

0 commit comments

Comments
 (0)