more clippy fixes

use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)
This commit is contained in:
Matthias Krüger 2020-03-29 20:19:14 +02:00
parent 2113659479
commit 08f2904dfa
14 changed files with 102 additions and 124 deletions

View file

@ -590,7 +590,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
for item in search_index {
item.parent_idx = item.parent.and_then(|defid| {
if defid_to_pathid.contains_key(&defid) {
defid_to_pathid.get(&defid).map(|x| *x)
defid_to_pathid.get(&defid).copied()
} else {
let pathid = lastpathid;
defid_to_pathid.insert(defid, pathid);