]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/html/render/mod.rs
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
[rust.git] / src / librustdoc / html / render / mod.rs
index fdadc68998dc663f98609c190841b75d3f09f5f8..dd592de41bd6c142c98f40828f001f3d239ea483 100644 (file)
 #[derive(Debug)]
 crate struct IndexItemFunctionType {
     inputs: Vec<TypeWithKind>,
-    output: Option<Vec<TypeWithKind>>,
+    output: Vec<TypeWithKind>,
 }
 
 impl Serialize for IndexItemFunctionType {
@@ -126,21 +126,16 @@ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
         S: Serializer,
     {
         // If we couldn't figure out a type, just write `null`.
-        let mut iter = self.inputs.iter();
-        if match self.output {
-            Some(ref output) => iter.chain(output.iter()).any(|i| i.ty.name.is_none()),
-            None => iter.any(|i| i.ty.name.is_none()),
-        } {
+        let has_missing = self.inputs.iter().chain(self.output.iter()).any(|i| i.ty.name.is_none());
+        if has_missing {
             serializer.serialize_none()
         } else {
             let mut seq = serializer.serialize_seq(None)?;
             seq.serialize_element(&self.inputs)?;
-            if let Some(output) = &self.output {
-                if output.len() > 1 {
-                    seq.serialize_element(&output)?;
-                } else {
-                    seq.serialize_element(&output[0])?;
-                }
+            match self.output.as_slice() {
+                [] => {}
+                [one] => seq.serialize_element(one)?,
+                all => seq.serialize_element(all)?,
             }
             seq.end()
         }
@@ -2166,7 +2161,7 @@ fn sidebar_deref_methods(
         }
 
         // Recurse into any further impls that might exist for `target`
-        if let Some(target_did) = target.def_id_no_primitives() {
+        if let Some(target_did) = target.def_id(c) {
             if let Some(target_impls) = c.impls.get(&target_did) {
                 if let Some(target_deref_impl) = target_impls.iter().find(|i| {
                     i.inner_impl()