clippy fixes

This commit is contained in:
euzu
2024-12-31 12:31:40 +01:00
parent 8ff9b0a859
commit ca75ea9f82
3 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -199,7 +199,7 @@ async fn xtream_player_api_stream(
}
let extension = stream_ext.unwrap_or_else(
|| extract_extension_from_url(&pli.url).map_or_else(String::new, |ext| ext.to_string()));
|| extract_extension_from_url(&pli.url).map_or_else(String::new, std::string::ToString::to_string));
let query_path = if stream_req.action_path.is_empty() {
format!("{}{extension}", pli.provider_id)
+1 -1
View File
@@ -400,7 +400,7 @@ fn get_strm_url(credentials_and_server_info: Option<&(ProxyUserCredentials, ApiP
_ => None,
} {
let url = str_item_info.url.as_str();
let ext = extract_extension_from_url(url).map_or_else(String::new, |ext| ext.to_string());
let ext = extract_extension_from_url(url).map_or_else(String::new, std::string::ToString::to_string);
format!("{}/{stream_type}/{}/{}/{}{ext}",
server_info.get_base_url(),
user.username,
+3 -5
View File
@@ -370,11 +370,9 @@ pub fn extract_extension_from_url(url: &str) -> Option<&str> {
return Some(&path[last_dot_pos..]);
}
}
} else {
if let Some(last_dot_pos) = url.rfind('.') {
if last_dot_pos > url.rfind('/').unwrap_or(0) {
return Some(&url[last_dot_pos..]);
}
} else if let Some(last_dot_pos) = url.rfind('.') {
if last_dot_pos > url.rfind('/').unwrap_or(0) {
return Some(&url[last_dot_pos..]);
}
}
None