@@ -19,9 +19,9 @@ use views::{EncodableCrate, EncodableCrateLinks};
19
19
use models:: helpers:: with_count:: * ;
20
20
use schema:: * ;
21
21
22
- /// Hosts in this blacklist are known to not be hosting documentation,
22
+ /// Hosts in this list are known to not be hosting documentation,
23
23
/// and are possibly of malicious intent e.g. ad tracking networks, etc.
24
- const DOCUMENTATION_BLACKLIST : [ & str ; 1 ] = [ "rust-ci.org" ] ;
24
+ const DOCUMENTATION_BLOCKLIST : [ & str ; 1 ] = [ "rust-ci.org" ] ;
25
25
26
26
#[ derive( Debug , Insertable , Queryable , Identifiable , Associations , AsChangeset , Clone , Copy ) ]
27
27
#[ belongs_to( Crate ) ]
@@ -330,7 +330,7 @@ impl Crate {
330
330
let keyword_ids = keywords. map ( |kws| kws. iter ( ) . map ( |kw| kw. keyword . clone ( ) ) . collect ( ) ) ;
331
331
let category_ids = categories. map ( |cats| cats. iter ( ) . map ( |cat| cat. slug . clone ( ) ) . collect ( ) ) ;
332
332
let badges = badges. map ( |bs| bs. into_iter ( ) . map ( |b| b. encodable ( ) ) . collect ( ) ) ;
333
- let documentation = Crate :: remove_blacklisted_documentation_urls ( documentation) ;
333
+ let documentation = Crate :: remove_blocked_documentation_urls ( documentation) ;
334
334
335
335
EncodableCrate {
336
336
id : name. clone ( ) ,
@@ -360,8 +360,8 @@ impl Crate {
360
360
}
361
361
}
362
362
363
- /// Return `None` if the documentation URL host matches a blacklisted host
364
- fn remove_blacklisted_documentation_urls ( url : Option < String > ) -> Option < String > {
363
+ /// Return `None` if the documentation URL host matches a blocked host
364
+ fn remove_blocked_documentation_urls ( url : Option < String > ) -> Option < String > {
365
365
// Handles if documentation URL is None
366
366
let url = match url {
367
367
Some ( url) => url,
@@ -380,8 +380,8 @@ impl Crate {
380
380
None => return None ,
381
381
} ;
382
382
383
- // Match documentation URL host against blacklisted host array elements
384
- if DOCUMENTATION_BLACKLIST . contains ( & url_host) {
383
+ // Match documentation URL host against blocked host array elements
384
+ if DOCUMENTATION_BLOCKLIST . contains ( & url_host) {
385
385
None
386
386
} else {
387
387
Some ( url)
@@ -520,32 +520,32 @@ mod tests {
520
520
use models:: Crate ;
521
521
522
522
#[ test]
523
- fn documentation_blacklist_no_url_provided ( ) {
524
- assert_eq ! ( Crate :: remove_blacklisted_documentation_urls ( None ) , None ) ;
523
+ fn documentation_blocked_no_url_provided ( ) {
524
+ assert_eq ! ( Crate :: remove_blocked_documentation_urls ( None ) , None ) ;
525
525
}
526
526
527
527
#[ test]
528
- fn documentation_blacklist_invalid_url ( ) {
528
+ fn documentation_blocked_invalid_url ( ) {
529
529
assert_eq ! (
530
- Crate :: remove_blacklisted_documentation_urls ( Some ( String :: from( "not a url" ) ) ) ,
530
+ Crate :: remove_blocked_documentation_urls ( Some ( String :: from( "not a url" ) ) ) ,
531
531
None
532
532
) ;
533
533
}
534
534
535
535
#[ test]
536
- fn documentation_blacklist_url_contains_partial_match ( ) {
536
+ fn documentation_blocked_url_contains_partial_match ( ) {
537
537
assert_eq ! (
538
- Crate :: remove_blacklisted_documentation_urls ( Some ( String :: from(
538
+ Crate :: remove_blocked_documentation_urls ( Some ( String :: from(
539
539
"http://rust-ci.organists.com"
540
540
) ) , ) ,
541
541
Some ( String :: from( "http://rust-ci.organists.com" ) )
542
542
) ;
543
543
}
544
544
545
545
#[ test]
546
- fn documentation_blacklist_blacklisted_url ( ) {
546
+ fn documentation_blocked_url ( ) {
547
547
assert_eq ! (
548
- Crate :: remove_blacklisted_documentation_urls ( Some ( String :: from(
548
+ Crate :: remove_blocked_documentation_urls ( Some ( String :: from(
549
549
"http://rust-ci.org/crate/crate-0.1/doc/crate-0.1" ,
550
550
) , ) , ) ,
551
551
None
0 commit comments