From a5d725cc82f0b3ca99d3d6fc157b0a28da4ddf9b Mon Sep 17 00:00:00 2001
From: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
Date: Mon, 30 Jan 2017 23:18:22 +0300
Subject: [PATCH] cleanup: Refactor away `DtorKind`

---
 src/librustc/ty/mod.rs     | 25 +------------------------
 src/librustc_trans/glue.rs |  2 +-
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index db21d35f990..5ab45e746e7 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 pub use self::Variance::*;
-pub use self::DtorKind::*;
 pub use self::AssociatedItemContainer::*;
 pub use self::BorrowKind::*;
 pub use self::IntVarValue::*;
@@ -120,21 +119,6 @@ pub struct Resolutions {
     pub maybe_unused_trait_imports: NodeSet,
 }
 
-#[derive(Copy, Clone)]
-pub enum DtorKind {
-    NoDtor,
-    TraitDtor
-}
-
-impl DtorKind {
-    pub fn is_present(&self) -> bool {
-        match *self {
-            TraitDtor => true,
-            _ => false
-        }
-    }
-}
-
 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
 pub enum AssociatedItemContainer {
     TraitContainer(DefId),
@@ -1480,7 +1464,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
 
     /// Returns whether this type has a destructor.
     pub fn has_dtor(&self) -> bool {
-        self.dtor_kind().is_present()
+        self.destructor.get().is_some()
     }
 
     /// Asserts this is a struct and returns the struct's unique
@@ -1543,13 +1527,6 @@ impl<'a, 'gcx, 'tcx> AdtDef {
         self.destructor.set(Some(dtor));
     }
 
-    pub fn dtor_kind(&self) -> DtorKind {
-        match self.destructor.get() {
-            Some(_) => TraitDtor,
-            None => NoDtor,
-        }
-    }
-
     /// Returns a simpler type such that `Self: Sized` if and only
     /// if that type is Sized, or `TyErr` if this type is recursive.
     ///
diff --git a/src/librustc_trans/glue.rs b/src/librustc_trans/glue.rs
index 350c8f950dd..1415ca6029f 100644
--- a/src/librustc_trans/glue.rs
+++ b/src/librustc_trans/glue.rs
@@ -235,7 +235,7 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi
             bcx.call(dtor, &[ptr.llval], None);
             bcx
         }
-        ty::TyAdt(def, ..) if def.dtor_kind().is_present() && !skip_dtor => {
+        ty::TyAdt(def, ..) if def.has_dtor() && !skip_dtor => {
             let shallow_drop = def.is_union();
             let tcx = bcx.tcx();