about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-02-23 19:09:00 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-03-16 18:30:26 +0100
commit5654cde729c99f894507141c391e0e8b2311e2fb (patch)
tree57f23cdb953a9c78a0daf3ee6fe2f0ea65a41c96
parente78c451733f90307cbb34bc6527b0ad4d6c26915 (diff)
downloadrust-5654cde729c99f894507141c391e0e8b2311e2fb.tar.gz
rust-5654cde729c99f894507141c391e0e8b2311e2fb.zip
formatting
-rw-r--r--src/librustdoc/html/render.rs5
-rw-r--r--src/librustdoc/html/render/cache.rs36
-rw-r--r--src/librustdoc/html/static/main.js10
3 files changed, 24 insertions, 27 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 8d60e087e04..d21fdeb492e 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 746146c5084..90bbc8929c0 100644
--- a/src/librustdoc/html/render/cache.rs
+++ b/src/librustdoc/html/render/cache.rs
@@ -589,21 +589,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 {
@@ -697,10 +697,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) }
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index c936be1cfb3..fc07e9f8b03 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -850,8 +850,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;
@@ -876,12 +875,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;