]> git.lizzy.rs Git - rust.git/commitdiff
formatting
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 10 Jan 2020 13:46:28 +0000 (14:46 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 15 Jan 2020 12:43:09 +0000 (13:43 +0100)
src/librustdoc/clean/inline.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/render.rs
src/librustdoc/html/render/cache.rs

index fc75bf35b250d0e3e9c518f96fa105a390026c98..e54e716e042febf9da6468dcaf21c09847fb4308 100644 (file)
@@ -284,11 +284,9 @@ fn build_type_alias_type(cx: &DocContext<'_>, did: DefId) -> Option<clean::Type>
 
 pub fn build_ty(cx: &DocContext, did: DefId) -> Option<clean::Type> {
     match cx.tcx.def_kind(did)? {
-        DefKind::Struct |
-        DefKind::Union |
-        DefKind::Enum |
-        DefKind::Const |
-        DefKind::Static => Some(cx.tcx.type_of(did).clean(cx)),
+        DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::Const | DefKind::Static => {
+            Some(cx.tcx.type_of(did).clean(cx))
+        }
         DefKind::TyAlias => build_type_alias_type(cx, did),
         _ => None,
     }
index 0cc4c55f49be82b335a5ff945298e61945415455..027975a6d3288a59e9e740cbfa37b1ffe85c9799 100644 (file)
@@ -1124,14 +1124,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
             hir::ImplItemKind::TyAlias(ref ty) => {
                 let type_ = ty.clean(cx);
                 let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
-                TypedefItem(
-                    Typedef {
-                        type_,
-                        generics: Generics::default(),
-                        item_type,
-                    },
-                    true,
-                )
+                TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true)
             }
             hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem(
                 OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default() },
@@ -2011,14 +2004,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
             visibility: self.vis.clean(cx),
             stability: cx.stability(self.id).clean(cx),
             deprecation: cx.deprecation(self.id).clean(cx),
-            inner: TypedefItem(
-                Typedef {
-                    type_,
-                    generics: self.gen.clean(cx),
-                    item_type,
-                },
-                false,
-            ),
+            inner: TypedefItem(Typedef { type_, generics: self.gen.clean(cx), item_type }, false),
         }
     }
 }
index 69e268f3f80c1688f9e64cef00b06d327b2eecd9..86d59a0cccd9a2c5812e2fd4aba5d0f89ef7d6b1 100644 (file)
@@ -3474,12 +3474,10 @@ fn render_deref_methods(
         .items
         .iter()
         .filter_map(|item| match item.inner {
-            clean::TypedefItem(ref t, true) => {
-                Some(match *t {
-                    clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
-                    _ => (&t.type_, &t.type_),
-                })
-            }
+            clean::TypedefItem(ref t, true) => Some(match *t {
+                clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
+                _ => (&t.type_, &t.type_),
+            }),
             _ => None,
         })
         .next()
@@ -4133,12 +4131,10 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
                     .items
                     .iter()
                     .filter_map(|item| match item.inner {
-                        clean::TypedefItem(ref t, true) => {
-                            Some(match *t {
-                                clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
-                                _ => (&t.type_, &t.type_),
-                            })
-                        }
+                        clean::TypedefItem(ref t, true) => Some(match *t {
+                            clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
+                            _ => (&t.type_, &t.type_),
+                        }),
                         _ => None,
                     })
                     .next()
index cdfd6b3073adfc9e230a5449e4a02055186fbf31..fd9c47d0c4a44623ad8ecaf6cab81a117dbd63a2 100644 (file)
@@ -574,7 +574,8 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
     // has since been learned.
     for &(did, ref item) in orphan_impl_items {
         if let Some(&(ref fqp, _)) = paths.get(&did) {
-            if item.name.is_none() { // this is most likely from a typedef
+            if item.name.is_none() {
+                // this is most likely from a typedef
                 continue;
             }
             search_index.push(IndexItem {
@@ -596,22 +597,20 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
 
     for item in search_index {
         item.parent_idx = match item.parent {
-            Some(nodeid) => {
-                Some(if nodeid_to_pathid.contains_key(&nodeid) {
-                    *nodeid_to_pathid.get(&nodeid).expect("no pathid")
-                } else {
-                    let pathid = lastpathid;
-                    nodeid_to_pathid.insert(nodeid, pathid);
-                    lastpathid += 1;
+            Some(nodeid) => Some(if nodeid_to_pathid.contains_key(&nodeid) {
+                *nodeid_to_pathid.get(&nodeid).expect("no pathid")
+            } else {
+                let pathid = lastpathid;
+                nodeid_to_pathid.insert(nodeid, pathid);
+                lastpathid += 1;
 
-                    if let Some(&(ref fqp, short)) = paths.get(&nodeid) {
-                        crate_paths.push((short, fqp.last().expect("no fqp").clone()));
-                    } else {
-                        continue
-                    }
-                    pathid
-                })
-            }
+                if let Some(&(ref fqp, short)) = paths.get(&nodeid) {
+                    crate_paths.push((short, fqp.last().expect("no fqp").clone()));
+                } else {
+                    continue;
+                }
+                pathid
+            }),
             None => None,
         };