Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Mar 3, 2020
1 parent 5892d0d commit 71b9512
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
5 changes: 1 addition & 4 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}

Expand Down
36 changes: 19 additions & 17 deletions src/librustdoc/html/render/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -696,10 +696,12 @@ fn get_generics(clean_type: &clean::Type) -> Option<Vec<Generic>> {
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::<Vec<_>>();
if r.is_empty() { None } else { Some(r) }
Expand Down
10 changes: 4 additions & 6 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 71b9512

Please sign in to comment.