Skip to content

Commit e2bfdaa

Browse files
Documentation cleanup
Converted comment above `fn remove_blacklisted_documentation_urls()` to a documentation comment and added and modified comments about case handling logic
1 parent 52117c0 commit e2bfdaa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/krate.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,25 +548,27 @@ impl Crate {
548548
}
549549
}
550550

551-
// Return None if the documentation URL host matches a blacklisted host
551+
/// Return `None` if the documentation URL host matches a blacklisted host
552552
fn remove_blacklisted_documentation_urls(url: Option<String>) -> Option<String> {
553+
// Handles if documentation URL is None
553554
let url = match url {
554555
Some(url) => url,
555556
None => return None,
556557
};
557558

558-
// Handles the case if the documentation URL does not parse successfully
559+
// Handles unsuccessful parsing of documentation URL
559560
let parsed_url = match Url::parse(&url) {
560561
Ok(parsed_url) => parsed_url,
561562
Err(_) => return None,
562563
};
563564

564-
// Unwrap is fine here since a None type is handled in the first match statement
565+
// Extract host string from documentation URL
565566
let url_host = match parsed_url.host_str() {
566567
Some(url_host) => url_host,
567568
None => return None,
568569
};
569570

571+
// Match documentation URL host against blacklisted host array elements
570572
if DOCUMENTATION_BLACKLIST.contains(&url_host) {
571573
None
572574
} else {

0 commit comments

Comments
 (0)