Rollup merge of #70990 - GuillaumeGomez:rustdoc-cleanup, r=ollie27

Improve rustdoc source code a bit

Very small clean up. I realized that there were too many nested conditions whereas we could just use `and_then`.

r? @kinnison

cc @ollie27
This commit is contained in:
Dylan DPC 2020-04-16 00:39:24 +02:00 committed by GitHub
commit 9433d899a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 29 deletions

View file

@ -697,11 +697,11 @@ fn get_generics(clean_type: &clean::Type) -> Option<Vec<Generic>> {
let r = types
.iter()
.filter_map(|t| {
if let Some(name) = get_index_type_name(t, false) {
Some(Generic { name: name.to_ascii_lowercase(), defid: t.def_id(), idx: None })
} else {
None
}
get_index_type_name(t, false).map(|name| Generic {
name: name.to_ascii_lowercase(),
defid: t.def_id(),
idx: None,
})
})
.collect::<Vec<_>>();
if r.is_empty() { None } else { Some(r) }