]> git.lizzy.rs Git - rust.git/commitdiff
formatting
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 23 Feb 2020 18:09:00 +0000 (19:09 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Mon, 16 Mar 2020 17:30:26 +0000 (18:30 +0100)
src/librustdoc/html/render.rs
src/librustdoc/html/render/cache.rs
src/librustdoc/html/static/main.js

index 8d60e087e048f6a8e3ec1dfb991cf4635671a99c..d21fdeb492e190b8ee9a0e834e81cd8254065f57 100644 (file)
@@ -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 }
     }
 }
 
index 746146c50847978ab5f4f92b3e23a198d1b6fadd..90bbc8929c03ee094f490f331041c3e99ebb861d 100644 (file)
@@ -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) }
index c936be1cfb35b43800acb9ae08aeb4a0343ed4a3..fc07e9f8b033e45ff95e10b60cc933c15f511312 100644 (file)
@@ -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;