Commit d0f586c 1 parent 3fb94e0 commit d0f586c Copy full SHA for d0f586c
File tree 7 files changed +9
-10
lines changed
7 files changed +9
-10
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 @@ -1604,6 +1604,8 @@ mod cli {
1604
1604
#[ test]
1605
1605
#[ ignore = "Skipping test because it is flaky" ]
1606
1606
fn test_suggests_url_alternatives ( ) -> Result < ( ) > {
1607
+ let re = Regex :: new ( r"http://web\.archive\.org/web/.*google\.com/jobs\.html" ) . unwrap ( ) ;
1608
+
1607
1609
for _ in 0 ..3 {
1608
1610
// This can be flaky. Try up to 3 times
1609
1611
let mut cmd = main_command ( ) ;
@@ -1619,7 +1621,6 @@ mod cli {
1619
1621
// We're looking for a suggestion that
1620
1622
// - starts with http://web.archive.org/web/
1621
1623
// - ends with google.com/jobs.html
1622
- let re = Regex :: new ( r"http://web\.archive\.org/web/.*google\.com/jobs\.html" ) . unwrap ( ) ;
1623
1624
if re. is_match ( & String :: from_utf8_lossy ( & output. stdout ) ) {
1624
1625
// Test passed
1625
1626
return Ok ( ( ) ) ;
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