Minor refactoring/cleanup

This commit is contained in:
Graham Esau 2019-12-08 12:00:21 +00:00
parent ba79de696a
commit 1e9f36122d
2 changed files with 11 additions and 12 deletions

View file

@ -14,14 +14,14 @@ pub fn get_title_and_desc_from_docs(attrs: &[Attribute]) -> (Option<String>, Opt
.trim_start_matches('#')
.trim()
.to_owned();
let maybe_desc = split.next().and_then(get_description);
let maybe_desc = split.next().and_then(merge_description_lines);
(none_if_empty(title), maybe_desc)
} else {
(None, get_description(&docs))
(None, merge_description_lines(&docs))
}
}
fn get_description(docs: &str) -> Option<String> {
fn merge_description_lines(docs: &str) -> Option<String> {
let desc = docs
.trim()
.split("\n\n")