Skip to content

Commit fc530d4

Browse files
committed
Fix new clippy lints
1 parent 3fb94e0 commit fc530d4

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

lychee-bin/src/commands/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ async fn handle(
320320
fn ignore_cache(uri: &Uri, status: &Status, cache_exclude_status: &HashSet<u16>) -> bool {
321321
let status_code_excluded = status
322322
.code()
323-
.map_or(false, |code| cache_exclude_status.contains(&code.as_u16()));
323+
.is_some_and(|code| cache_exclude_status.contains(&code.as_u16()));
324324

325325
uri.is_file()
326326
|| status.is_excluded()

lychee-bin/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ async fn run(opts: &LycheeOptions) -> Result<i32> {
294294
.skip_ignored(!opts.config.no_ignore)
295295
.include_verbatim(opts.config.include_verbatim)
296296
// File a bug if you rely on this envvar! It's going to go away eventually.
297-
.use_html5ever(std::env::var("LYCHEE_USE_HTML5EVER").map_or(false, |x| x == "1"));
297+
.use_html5ever(std::env::var("LYCHEE_USE_HTML5EVER").is_ok_and(|x| x == "1"));
298298

299299
if opts.config.dump_inputs {
300300
let sources = collector.collect_sources(inputs);

lychee-lib/src/extract/html/html5gum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl LinkExtractor {
169169
return;
170170
}
171171

172-
if self.current_attributes.get("rel").map_or(false, |rel| {
172+
if self.current_attributes.get("rel").is_some_and(|rel| {
173173
rel.split(',').any(|r| {
174174
r.trim() == "nofollow" || r.trim() == "preconnect" || r.trim() == "dns-prefetch"
175175
})
@@ -189,7 +189,7 @@ impl LinkExtractor {
189189
if self
190190
.current_attributes
191191
.get("rel")
192-
.map_or(false, |rel| rel.contains("stylesheet"))
192+
.is_some_and(|rel| rel.contains("stylesheet"))
193193
{
194194
if let Some(href) = self.current_attributes.get("href") {
195195
if href.starts_with("/@") || href.starts_with('@') {

lychee-lib/src/filter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn is_example_domain(uri: &Uri) -> bool {
7474
domain == example
7575
|| domain
7676
.split_once('.')
77-
.map_or(false, |(_subdomain, tld_part)| tld_part == example)
77+
.is_some_and(|(_subdomain, tld_part)| tld_part == example)
7878
}) || EXAMPLE_TLDS
7979
.iter()
8080
.any(|&example_tld| domain.ends_with(example_tld))

lychee-lib/src/retry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl RetryExt for http::Error {
8888
inner
8989
.source()
9090
.and_then(<(dyn std::error::Error + 'static)>::downcast_ref)
91-
.map_or(false, should_retry_io)
91+
.is_some_and(should_retry_io)
9292
}
9393
}
9494

lychee-lib/src/types/file.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ impl<P: AsRef<Path>> From<P> for FileType {
5757
fn is_url(path: &Path) -> bool {
5858
path.to_str()
5959
.and_then(|s| Url::parse(s).ok())
60-
.map_or(false, |url| {
61-
url.scheme() == "http" || url.scheme() == "https"
62-
})
60+
.is_some_and(|url| url.scheme() == "http" || url.scheme() == "https")
6361
}
6462

6563
#[cfg(test)]

0 commit comments

Comments
 (0)