Skip to content

Commit 71b9512

Browse files
formatting
1 parent 5892d0d commit 71b9512

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

src/librustdoc/html/render.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,7 @@ pub struct TypeWithKind {
394394

395395
impl From<(Type, TypeKind)> for TypeWithKind {
396396
fn from(x: (Type, TypeKind)) -> TypeWithKind {
397-
TypeWithKind {
398-
ty: x.0,
399-
kind: x.1,
400-
}
397+
TypeWithKind { ty: x.0, kind: x.1 }
401398
}
402399
}
403400

src/librustdoc/html/render/cache.rs

+19-17
Original file line numberDiff line numberDiff line change
@@ -588,21 +588,21 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
588588

589589
for item in search_index {
590590
item.parent_idx = item.parent.and_then(|defid| {
591-
if defid_to_pathid.contains_key(&defid) {
592-
defid_to_pathid.get(&defid).map(|x| *x)
593-
} else {
594-
let pathid = lastpathid;
595-
defid_to_pathid.insert(defid, pathid);
596-
lastpathid += 1;
597-
598-
if let Some(&(ref fqp, short)) = paths.get(&defid) {
599-
crate_paths.push((short, fqp.last().unwrap().clone()));
600-
Some(pathid)
591+
if defid_to_pathid.contains_key(&defid) {
592+
defid_to_pathid.get(&defid).map(|x| *x)
601593
} else {
602-
None
594+
let pathid = lastpathid;
595+
defid_to_pathid.insert(defid, pathid);
596+
lastpathid += 1;
597+
598+
if let Some(&(ref fqp, short)) = paths.get(&defid) {
599+
crate_paths.push((short, fqp.last().unwrap().clone()));
600+
Some(pathid)
601+
} else {
602+
None
603+
}
603604
}
604-
}
605-
});
605+
});
606606

607607
// Omit the parent path if it is same to that of the prior item.
608608
if lastpath == item.path {
@@ -696,10 +696,12 @@ fn get_generics(clean_type: &clean::Type) -> Option<Vec<Generic>> {
696696
clean_type.generics().and_then(|types| {
697697
let r = types
698698
.iter()
699-
.filter_map(|t| if let Some(name) = get_index_type_name(t, false) {
700-
Some(Generic { name: name.to_ascii_lowercase(), defid: t.def_id(), idx: None })
701-
} else {
702-
None
699+
.filter_map(|t| {
700+
if let Some(name) = get_index_type_name(t, false) {
701+
Some(Generic { name: name.to_ascii_lowercase(), defid: t.def_id(), idx: None })
702+
} else {
703+
None
704+
}
703705
})
704706
.collect::<Vec<_>>();
705707
if r.is_empty() { None } else { Some(r) }

src/librustdoc/html/static/main.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,7 @@ function getSearchElement() {
853853
if (typePassesFilter(typeFilter, tmp[1]) === false) {
854854
continue;
855855
}
856-
tmp[0] = tmp[NAME];
857-
var tmp = checkType(tmp, val, literalSearch);
856+
tmp = checkType(tmp, val, literalSearch);
858857
if (literalSearch === true) {
859858
if (tmp === true) {
860859
return true;
@@ -879,12 +878,11 @@ function getSearchElement() {
879878
ret = [ret];
880879
}
881880
for (var x = 0; x < ret.length; ++x) {
882-
var r = ret[x];
883-
if (typePassesFilter(typeFilter, r[1]) === false) {
881+
var tmp = ret[x];
882+
if (typePassesFilter(typeFilter, tmp[1]) === false) {
884883
continue;
885884
}
886-
r[0] = r[NAME];
887-
var tmp = checkType(r, val, literalSearch);
885+
tmp = checkType(r, val, literalSearch);
888886
if (literalSearch === true) {
889887
if (tmp === true) {
890888
return true;

0 commit comments

Comments
 (0)