diff --git a/backend/src/api/endpoints/xmltv_api.rs b/backend/src/api/endpoints/xmltv_api.rs index 8369651d2..dc3f86124 100644 --- a/backend/src/api/endpoints/xmltv_api.rs +++ b/backend/src/api/endpoints/xmltv_api.rs @@ -521,10 +521,10 @@ mod tests { fn test_parse_timezone() { // This will depend on current DST; we just check it’s within a valid range let berlin = parse_timeshift(Some(&"Europe/Berlin".to_string())).unwrap(); - assert!(berlin == 60 || berlin == 120, "Berlin offset should be 60 or 120, got {}", berlin); + assert!(berlin == 60 || berlin == 120, "Berlin offset should be 60 or 120, got {berlin}"); let new_york = parse_timeshift(Some(&"America/New_York".to_string())).unwrap(); - assert!(new_york == -300 || new_york == -240, "New York offset should be -300 or -240, got {}", new_york); + assert!(new_york == -300 || new_york == -240, "New York offset should be -300 or -240, got {new_york}"); let tokyo = parse_timeshift(Some(&"Asia/Tokyo".to_string())).unwrap(); assert_eq!(tokyo, 540); // always UTC+9 diff --git a/backend/src/processing/parser/xmltv.rs b/backend/src/processing/parser/xmltv.rs index 8cf35cd5e..3053e3318 100644 --- a/backend/src/processing/parser/xmltv.rs +++ b/backend/src/processing/parser/xmltv.rs @@ -531,8 +531,7 @@ pub fn flatten_tvguide(tv_guides: &[Epg]) -> Option { #[cfg(test)] mod tests { use std::borrow::Cow; - use std::collections::{HashSet}; - use std::io; + use std::collections::HashSet; use std::path::PathBuf; use crate::model::{EpgSmartMatchConfig, PersistedEpgSource, TVGuide}; use crate::processing::parser::xmltv::normalize_channel_name; @@ -554,7 +553,7 @@ mod tests { #[test] - fn parse_test() -> io::Result<()> { + fn parse_test() { let run_test = async move || { //let file_path = PathBuf::from("/tmp/epg.xml.gz"); let file_path = PathBuf::from("/tmp/invalid_epg.xml"); @@ -568,19 +567,18 @@ mod tests { let channel_ids = HashSet::from(["342".to_string()]); match tv_guide.filter(&mut id_cache).await { - None => assert!(false, "No epg filtered"), + None => panic!("No epg filtered"), Some(epgs) => { for epg in epgs { - assert_eq!(epg.children.len(), channel_ids.len() * 2, "Epg size does not match") + assert_eq!(epg.children.len(), channel_ids.len() * 2, "Epg size does not match"); } } } } }; - let _result = tokio::runtime::Runtime::new() + tokio::runtime::Runtime::new() .unwrap() .block_on(run_test()); - Ok(()) } #[test] @@ -641,4 +639,4 @@ mod tests { println!("{}", metaphone.encode(&normalize_channel_name("BG | ODISEA ᵁᴴᴰ ³⁸⁴⁰ᴾ", &epg_smart_cfg))); } -} \ No newline at end of file +} diff --git a/backend/src/processing/parser/xtream.rs b/backend/src/processing/parser/xtream.rs index ab07cc403..e45e33ddb 100644 --- a/backend/src/processing/parser/xtream.rs +++ b/backend/src/processing/parser/xtream.rs @@ -222,11 +222,10 @@ mod tests { let file_content = fs::read_to_string("/tmp/series-info.json").expect("Unable to read file"); match serde_json::from_str::(&file_content) { Ok(series_info) => { - println!("{:#?}", series_info); - assert!(true); + println!("{series_info:#?}"); }, Err(err) => { - assert!(false, "Failed to parse json file: {err}"); + panic!("Failed to parse json file: {err}"); } } @@ -236,16 +235,15 @@ mod tests { async fn test_read_json_stream_into_struct() -> std::io::Result<()> { let reader = Box::pin(async_file_reader(tokio::fs::File::open("/tmp/vod_streams.json").await?)); match map_to_xtream_streams(XtreamCluster::Video, reader).await { - Ok(_streams) => { - println!("{:?}", _streams.get(1)); - println!("{:?}", _streams.get(100)); - println!("{:?}", _streams.get(200)); - assert!(true); + Ok(streams) => { + println!("{:?}", streams.get(1)); + println!("{:?}", streams.get(100)); + println!("{:?}", streams.get(200)); }, Err(err) => { - assert!(false, "Failed to parse json file: {err}"); + panic!("Failed to parse json file: {err}"); } - }; + } Ok(()) } -} \ No newline at end of file +} diff --git a/backend/src/processing/processor/playlist.rs b/backend/src/processing/processor/playlist.rs index 38080b07e..ebecd9512 100644 --- a/backend/src/processing/processor/playlist.rs +++ b/backend/src/processing/processor/playlist.rs @@ -61,8 +61,8 @@ pub fn apply_filter_to_playlist(playlist: &mut [PlaylistGroup], filter: &Filter) } pub fn apply_favourites_to_playlist( - _playlist: &mut Vec, - _favourites_cfg: Option<&Vec>, + _playlist: &mut [PlaylistGroup], + _favourites_cfg: Option<&[ConfigFavourites]>, ) { // if let Some(favourites) = favourites_cfg { // let mut fav_groups: HashMap> = HashMap::new(); @@ -100,7 +100,7 @@ pub fn apply_favourites_to_playlist( fn filter_playlist(playlist: &mut [PlaylistGroup], target: &ConfigTarget) -> Option> { if let Some(mut filtered_playlist) = apply_filter_to_playlist(playlist, &target.filter) { - apply_favourites_to_playlist(&mut filtered_playlist, target.favourites.as_ref()); + apply_favourites_to_playlist(&mut filtered_playlist, target.favourites.as_deref()); Some(filtered_playlist) } else { None diff --git a/backend/src/repository/user_repository.rs b/backend/src/repository/user_repository.rs index 8efd43f03..fc88f2d6c 100644 --- a/backend/src/repository/user_repository.rs +++ b/backend/src/repository/user_repository.rs @@ -490,10 +490,10 @@ mod tests { api_proxy: Arc::new(ArcSwapAny::default()), paths: Arc::new(ArcSwap::from(Arc::new(ConfigPaths { config_path: temp_dir().to_string_lossy().to_string(), - config_file_path: "".to_string(), - sources_file_path: "".to_string(), + config_file_path: String::new(), + sources_file_path: String::new(), mapping_file_path: None, - api_proxy_file_path: "".to_string(), + api_proxy_file_path: String::new(), custom_stream_response_path: None, }))), file_locks: Arc::new(FileLockManager::default()), diff --git a/backend/src/utils/geoip.rs b/backend/src/utils/geoip.rs index 07af9ddf8..5e692a978 100644 --- a/backend/src/utils/geoip.rs +++ b/backend/src/utils/geoip.rs @@ -114,7 +114,7 @@ mod test { if let Some(cc) = geo_ip.lookup("72.13.24.23") { assert_eq!(cc, "US"); } else { - assert!(false); + panic!("GeoIP lookup returned no result"); } } -} \ No newline at end of file +} diff --git a/frontend/src/app/components/api_user/playlist.rs b/frontend/src/app/components/api_user/playlist.rs index e566fe92f..d7cce4d2b 100644 --- a/frontend/src/app/components/api_user/playlist.rs +++ b/frontend/src/app/components/api_user/playlist.rs @@ -92,7 +92,7 @@ pub fn ApiUserPlaylist() -> Html { // Selection reference let selections = - use_mut_ref(|| HashMap::>>::new()); + use_mut_ref(HashMap::>>::new); let handle_tab_select = { let active_tab_clone = active_tab.clone(); diff --git a/frontend/src/app/components/playlist/assistant/playlist.rs b/frontend/src/app/components/playlist/assistant/playlist.rs index 262c50426..a1d8e021d 100644 --- a/frontend/src/app/components/playlist/assistant/playlist.rs +++ b/frontend/src/app/components/playlist/assistant/playlist.rs @@ -3,6 +3,7 @@ use std::fmt; use std::str::FromStr; use yew::prelude::*; +#[allow(dead_code)] enum PlaylistAssistantStep { Name, Type, diff --git a/frontend/src/app/components/playlist/assistant/playlist_assistant_context.rs b/frontend/src/app/components/playlist/assistant/playlist_assistant_context.rs index 8ce0eb8df..9fb4ca831 100644 --- a/frontend/src/app/components/playlist/assistant/playlist_assistant_context.rs +++ b/frontend/src/app/components/playlist/assistant/playlist_assistant_context.rs @@ -1,5 +1,6 @@ use yew::UseStateHandle; +#[allow(dead_code)] #[derive(Clone, PartialEq)] pub struct PlaylistAssistantContext { pub custom_class: UseStateHandle, diff --git a/frontend/src/app/components/userlist/user_table.rs b/frontend/src/app/components/userlist/user_table.rs index 7616674a2..8801ca2b4 100644 --- a/frontend/src/app/components/userlist/user_table.rs +++ b/frontend/src/app/components/userlist/user_table.rs @@ -221,7 +221,7 @@ pub fn UserTable(props: &UserTableProps) -> Html { ) }; - let is_sortable = Callback::::from(move |col| is_col_sortable(col)); + let is_sortable = Callback::::from(is_col_sortable); let on_sort = { let users = props.users.clone();