Skip to content

Commit 5654cde

Browse files
formatting
1 parent e78c451 commit 5654cde

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

src/librustdoc/html/render.rs

Lines changed: 1 addition & 4 deletions
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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -589,21 +589,21 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
589589

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

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

src/librustdoc/html/static/main.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,7 @@ function getSearchElement() {
850850
if (typePassesFilter(typeFilter, tmp[1]) === false) {
851851
continue;
852852
}
853-
tmp[0] = tmp[NAME];
854-
var tmp = checkType(tmp, val, literalSearch);
853+
tmp = checkType(tmp, val, literalSearch);
855854
if (literalSearch === true) {
856855
if (tmp === true) {
857856
return true;
@@ -876,12 +875,11 @@ function getSearchElement() {
876875
ret = [ret];
877876
}
878877
for (var x = 0; x < ret.length; ++x) {
879-
var r = ret[x];
880-
if (typePassesFilter(typeFilter, r[1]) === false) {
878+
var tmp = ret[x];
879+
if (typePassesFilter(typeFilter, tmp[1]) === false) {
881880
continue;
882881
}
883-
r[0] = r[NAME];
884-
var tmp = checkType(r, val, literalSearch);
882+
tmp = checkType(r, val, literalSearch);
885883
if (literalSearch === true) {
886884
if (tmp === true) {
887885
return true;

0 commit comments

Comments
 (0)