Skip to content

Commit 3057fa2

Browse files
committed
fix clippy errors
1 parent edd1f0e commit 3057fa2

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/settings.rs

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

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

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

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

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

src/utils.rs

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

1447-
if url_result.is_err() {
1448-
path.to_string()
1449-
} else {
1450-
let mut url = url_result.unwrap();
1447+
if let Ok(mut url) = url_result {
14511448
url.path_segments_mut().unwrap().pop_if_empty();
1452-
14531449
url.path_segments().unwrap().next_back().unwrap().to_string()
1450+
} else {
1451+
path.to_string()
14541452
}
14551453
}
14561454

0 commit comments

Comments
 (0)