Skip to content

Commit 2db763e

Browse files
committed
fix(clippy): fix broken clippy's
1 parent 70187b7 commit 2db763e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/settings.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ fn set_cookies_method(req: Request<Body>, remove_cookies: bool) -> Response<Body
159159
.unwrap_or_else(String::new); // Return an empty string if None
160160

161161
// If there are subscriptions to restore set them and delete any old subscriptions cookies, otherwise delete them all
162-
if subscriptions.is_some() {
163-
let sub_list: Vec<String> = subscriptions.expect("Subscriptions").split('+').map(str::to_string).collect();
162+
if let Some(subscriptions) = subscriptions {
163+
let sub_list: Vec<String> = subscriptions.split('+').map(str::to_string).collect();
164164

165165
// Start at 0 to keep track of what number we need to start deleting old subscription cookies from
166166
let mut subscriptions_number_to_delete_from = 0;
@@ -210,8 +210,8 @@ fn set_cookies_method(req: Request<Body>, remove_cookies: bool) -> Response<Body
210210
}
211211

212212
// If there are filters to restore set them and delete any old filters cookies, otherwise delete them all
213-
if filters.is_some() {
214-
let filters_list: Vec<String> = filters.expect("Filters").split('+').map(str::to_string).collect();
213+
if let Some(filters) = filters {
214+
let filters_list: Vec<String> = filters.split('+').map(str::to_string).collect();
215215

216216
// Start at 0 to keep track of what number we need to start deleting old subscription cookies from
217217
let mut filters_number_to_delete_from = 0;

src/utils.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,13 +1423,13 @@ pub async fn nsfw_landing(req: Request<Body>, req_url: String) -> Result<Respons
14231423
pub fn url_path_basename(path: &str) -> String {
14241424
let url_result = Url::parse(format!("https://libredd.it/{path}").as_str());
14251425

1426-
if url_result.is_err() {
1427-
path.to_string()
1428-
} else {
1429-
let mut url = url_result.unwrap();
1430-
url.path_segments_mut().unwrap().pop_if_empty();
1426+
match url_result {
1427+
Ok(mut url) => {
1428+
url.path_segments_mut().unwrap().pop_if_empty();
14311429

1432-
url.path_segments().unwrap().next_back().unwrap().to_string()
1430+
url.path_segments().unwrap().next_back().unwrap().to_string()
1431+
}
1432+
Err(_) => path.to_string(),
14331433
}
14341434
}
14351435

0 commit comments

Comments
 (0)