about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-15 13:34:11 -0700
committerGitHub <noreply@github.com>2016-09-15 13:34:11 -0700
commit1265cbf4e05628c98f51afebe0b662c451173faa (patch)
treed22f9883386d441d7431306ec1029c2035b01133 /src/librustdoc
parentd1acabeaa204db9235d9e72c5bae4cfaa82da763 (diff)
parentb57f1099b577d4d388cc5236fb6990275c028b5b (diff)
downloadrust-1265cbf4e05628c98f51afebe0b662c451173faa.tar.gz
rust-1265cbf4e05628c98f51afebe0b662c451173faa.zip
Auto merge of #36393 - petrochenkov:ancient, r=eddyb
Remove some obsolete code from the compiler
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/clean/inline.rs11
-rw-r--r--src/librustdoc/doctree.rs21
-rw-r--r--src/librustdoc/html/render.rs2
3 files changed, 13 insertions, 21 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index f1b907e70d7..709e3698924 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -19,7 +19,7 @@ use rustc::middle::cstore;
 use rustc::hir::def::Def;
 use rustc::hir::def_id::DefId;
 use rustc::hir::print as pprust;
-use rustc::ty::{self, TyCtxt};
+use rustc::ty::{self, TyCtxt, VariantKind};
 use rustc::util::nodemap::FnvHashSet;
 
 use rustc_const_eval::lookup_const_by_id;
@@ -207,11 +207,10 @@ fn build_struct<'a, 'tcx>(cx: &DocContext, tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let variant = tcx.lookup_adt_def(did).struct_variant();
 
     clean::Struct {
-        struct_type: match &variant.fields[..] {
-            &[] => doctree::Unit,
-            &[_] if variant.kind == ty::VariantKind::Tuple => doctree::Newtype,
-            &[..] if variant.kind == ty::VariantKind::Tuple => doctree::Tuple,
-            _ => doctree::Plain,
+        struct_type: match variant.kind {
+            VariantKind::Struct => doctree::Plain,
+            VariantKind::Tuple => doctree::Tuple,
+            VariantKind::Unit => doctree::Unit,
         },
         generics: (t.generics, &predicates).clean(cx),
         fields: variant.fields.clean(cx),
diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs
index cc62fcfa0aa..c2404f4294e 100644
--- a/src/librustdoc/doctree.rs
+++ b/src/librustdoc/doctree.rs
@@ -82,14 +82,12 @@ impl Module {
 
 #[derive(Debug, Clone, RustcEncodable, RustcDecodable, Copy)]
 pub enum StructType {
-    /// A normal struct
+    /// A braced struct
     Plain,
     /// A tuple struct
     Tuple,
-    /// A newtype struct (tuple struct with one element)
-    Newtype,
     /// A unit struct
-    Unit
+    Unit,
 }
 
 pub enum TypeBound {
@@ -262,15 +260,10 @@ pub struct Import {
     pub whence: Span,
 }
 
-pub fn struct_type_from_def(sd: &hir::VariantData) -> StructType {
-    if !sd.is_struct() {
-        // We are in a tuple-struct
-        match sd.fields().len() {
-            0 => Unit,
-            1 => Newtype,
-            _ => Tuple
-        }
-    } else {
-        Plain
+pub fn struct_type_from_def(vdata: &hir::VariantData) -> StructType {
+    match *vdata {
+        hir::VariantData::Struct(..) => Plain,
+        hir::VariantData::Tuple(..) => Tuple,
+        hir::VariantData::Unit(..) => Unit,
     }
 }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 00704690751..8cc9bbb422a 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2546,7 +2546,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
             }
             write!(w, "}}")?;
         }
-        doctree::Tuple | doctree::Newtype => {
+        doctree::Tuple => {
             write!(w, "(")?;
             for (i, field) in fields.iter().enumerate() {
                 if i > 0 {