Commit fc530d4 1 parent 3fb94e0 commit fc530d4 Copy full SHA for fc530d4
File tree 6 files changed +7
-9
lines changed
6 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ async fn handle(
320
320
fn ignore_cache ( uri : & Uri , status : & Status , cache_exclude_status : & HashSet < u16 > ) -> bool {
321
321
let status_code_excluded = status
322
322
. 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 ( ) ) ) ;
324
324
325
325
uri. is_file ( )
326
326
|| status. is_excluded ( )
Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ async fn run(opts: &LycheeOptions) -> Result<i32> {
294
294
. skip_ignored ( !opts. config . no_ignore )
295
295
. include_verbatim ( opts. config . include_verbatim )
296
296
// 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" ) ) ;
298
298
299
299
if opts. config . dump_inputs {
300
300
let sources = collector. collect_sources ( inputs) ;
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ impl LinkExtractor {
169
169
return ;
170
170
}
171
171
172
- if self . current_attributes . get ( "rel" ) . map_or ( false , |rel| {
172
+ if self . current_attributes . get ( "rel" ) . is_some_and ( |rel| {
173
173
rel. split ( ',' ) . any ( |r| {
174
174
r. trim ( ) == "nofollow" || r. trim ( ) == "preconnect" || r. trim ( ) == "dns-prefetch"
175
175
} )
@@ -189,7 +189,7 @@ impl LinkExtractor {
189
189
if self
190
190
. current_attributes
191
191
. get ( "rel" )
192
- . map_or ( false , |rel| rel. contains ( "stylesheet" ) )
192
+ . is_some_and ( |rel| rel. contains ( "stylesheet" ) )
193
193
{
194
194
if let Some ( href) = self . current_attributes . get ( "href" ) {
195
195
if href. starts_with ( "/@" ) || href. starts_with ( '@' ) {
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ pub fn is_example_domain(uri: &Uri) -> bool {
74
74
domain == example
75
75
|| domain
76
76
. split_once ( '.' )
77
- . map_or ( false , |( _subdomain, tld_part) | tld_part == example)
77
+ . is_some_and ( |( _subdomain, tld_part) | tld_part == example)
78
78
} ) || EXAMPLE_TLDS
79
79
. iter ( )
80
80
. any ( |& example_tld| domain. ends_with ( example_tld) )
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ impl RetryExt for http::Error {
88
88
inner
89
89
. source ( )
90
90
. and_then ( <( dyn std:: error:: Error + ' static ) >:: downcast_ref)
91
- . map_or ( false , should_retry_io)
91
+ . is_some_and ( should_retry_io)
92
92
}
93
93
}
94
94
Original file line number Diff line number Diff line change @@ -57,9 +57,7 @@ impl<P: AsRef<Path>> From<P> for FileType {
57
57
fn is_url ( path : & Path ) -> bool {
58
58
path. to_str ( )
59
59
. 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" )
63
61
}
64
62
65
63
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments