diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 79c2adc4c213f..c18fea942e919 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -394,10 +394,7 @@ pub struct TypeWithKind { impl From<(Type, TypeKind)> for TypeWithKind { fn from(x: (Type, TypeKind)) -> TypeWithKind { - TypeWithKind { - ty: x.0, - kind: x.1, - } + TypeWithKind { ty: x.0, kind: x.1 } } } diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index 9dae5c1b05495..bd703235f5ddb 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -588,21 +588,21 @@ 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) - } else { - let pathid = lastpathid; - defid_to_pathid.insert(defid, pathid); - lastpathid += 1; - - if let Some(&(ref fqp, short)) = paths.get(&defid) { - crate_paths.push((short, fqp.last().unwrap().clone())); - Some(pathid) + if defid_to_pathid.contains_key(&defid) { + defid_to_pathid.get(&defid).map(|x| *x) } else { - None + let pathid = lastpathid; + defid_to_pathid.insert(defid, pathid); + lastpathid += 1; + + if let Some(&(ref fqp, short)) = paths.get(&defid) { + crate_paths.push((short, fqp.last().unwrap().clone())); + Some(pathid) + } else { + None + } } - } - }); + }); // Omit the parent path if it is same to that of the prior item. if lastpath == item.path { @@ -696,10 +696,12 @@ fn get_generics(clean_type: &clean::Type) -> Option> { clean_type.generics().and_then(|types| { 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 + .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 + } }) .collect::>(); if r.is_empty() { None } else { Some(r) } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 735044af5afc0..fdb143e18e653 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -853,8 +853,7 @@ function getSearchElement() { if (typePassesFilter(typeFilter, tmp[1]) === false) { continue; } - tmp[0] = tmp[NAME]; - var tmp = checkType(tmp, val, literalSearch); + tmp = checkType(tmp, val, literalSearch); if (literalSearch === true) { if (tmp === true) { return true; @@ -879,12 +878,11 @@ function getSearchElement() { ret = [ret]; } for (var x = 0; x < ret.length; ++x) { - var r = ret[x]; - if (typePassesFilter(typeFilter, r[1]) === false) { + var tmp = ret[x]; + if (typePassesFilter(typeFilter, tmp[1]) === false) { continue; } - r[0] = r[NAME]; - var tmp = checkType(r, val, literalSearch); + tmp = checkType(r, val, literalSearch); if (literalSearch === true) { if (tmp === true) { return true;