diff --git a/lychee-bin/src/commands/check.rs b/lychee-bin/src/commands/check.rs index f7278116d0..68e7ede226 100644 --- a/lychee-bin/src/commands/check.rs +++ b/lychee-bin/src/commands/check.rs @@ -275,7 +275,7 @@ async fn handle( // - Skip caching excluded links; they might not be excluded in the next run. // - Skip caching links for which the status code has been explicitly excluded from the cache. let status = response.status(); - if ignore_cache(&uri, status, cache_exclude_status) { + if ignore_cache(&uri, status, &cache_exclude_status) { return response; } @@ -283,17 +283,17 @@ async fn handle( response } -fn ignore_cache(uri: &Uri, status: &Status, cache_exclude_status: HashSet) -> bool { +fn ignore_cache(uri: &Uri, status: &Status, cache_exclude_status: &HashSet) -> bool { let status_code = match status.code() { None => 0, Some(code) => code.as_u16(), }; - return uri.is_file() + uri.is_file() || status.is_excluded() || status.is_unsupported() || status.is_unknown() - || cache_exclude_status.contains(&status_code); + || cache_exclude_status.contains(&status_code) } fn show_progress( @@ -404,7 +404,7 @@ mod tests { ignore_cache( &Uri::try_from("https://[::1]").unwrap(), &Status::Ok(StatusCode::OK), - exclude.clone() + &exclude ) ); @@ -414,7 +414,7 @@ mod tests { ignore_cache( &Uri::try_from("file:///home").unwrap(), &Status::Ok(StatusCode::OK), - exclude.clone() + &exclude ) ); @@ -424,7 +424,7 @@ mod tests { ignore_cache( &Uri::try_from("https://[::1]").unwrap(), &Status::Unsupported(ErrorKind::EmptyUrl), - exclude.clone() + &exclude ) ); @@ -434,7 +434,7 @@ mod tests { ignore_cache( &Uri::try_from("https://[::1]").unwrap(), &Status::UnknownStatusCode(StatusCode::IM_A_TEAPOT), - exclude.clone() + &exclude ) ); @@ -445,7 +445,7 @@ mod tests { ignore_cache( &Uri::try_from("https://[::1]").unwrap(), &Status::Ok(StatusCode::OK), - exclude.clone() + &exclude ) ); }