aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-05-17 15:28:51 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-05-17 15:30:14 +0200
commit60aaac51750ef1234b37b3923d0e98d646d85a98 (patch)
treeaddd429466d4496f13d83b9bfef673e43560b5c4
parent2ab7f1366c6e4524341d72229a16cfda10c0857c (diff)
downloadservo-60aaac51750ef1234b37b3923d0e98d646d85a98.tar.gz
servo-60aaac51750ef1234b37b3923d0e98d646d85a98.zip
Remove the custom PartialEq implementations on TypeId enums
https://github.com/rust-lang/rust/pull/33593 made them useless.
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py4
-rw-r--r--components/script/dom/eventtarget.rs40
-rw-r--r--components/script/dom/htmlelement.rs23
3 files changed, 3 insertions, 64 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 2b169ba7f8c..b10170be835 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -6377,9 +6377,7 @@ class GlobalGenRoots():
if not config.getInterface(base).getExtendedAttribute("Abstract"):
variants.append(CGGeneric(base))
variants += [CGGeneric(type_id_variant(derivedName)) for derivedName in derived]
- derives = "Clone, Copy, Debug"
- if base != 'EventTarget' and base != 'HTMLElement':
- derives += ", PartialEq"
+ derives = "Clone, Copy, Debug, PartialEq"
typeIdCode.append(CGWrapper(CGIndenter(CGList(variants, ",\n"), 4),
pre="#[derive(%s)]\npub enum %sTypeId {\n" % (derives, base),
post="\n}\n\n"))
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 3b492be7d4a..3b20120628d 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::UnionTypes::EventOrString;
use dom::bindings::error::{Error, Fallible, report_pending_exception};
-use dom::bindings::inheritance::{Castable, EventTargetTypeId};
+use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, Reflector};
use dom::element::Element;
@@ -35,8 +35,8 @@ use std::ffi::CString;
use std::hash::BuildHasherDefault;
use std::mem;
use std::ops::{Deref, DerefMut};
+use std::ptr;
use std::rc::Rc;
-use std::{intrinsics, ptr};
use string_cache::Atom;
use url::Url;
use util::str::DOMString;
@@ -62,42 +62,6 @@ pub enum ListenerPhase {
Bubbling,
}
-impl PartialEq for EventTargetTypeId {
- #[inline]
- fn eq(&self, other: &EventTargetTypeId) -> bool {
- match (*self, *other) {
- (EventTargetTypeId::Node(this_type), EventTargetTypeId::Node(other_type)) => {
- this_type == other_type
- }
- _ => self.eq_slow(other)
- }
- }
-}
-
-impl EventTargetTypeId {
- #[allow(unsafe_code)]
- fn eq_slow(&self, other: &EventTargetTypeId) -> bool {
- match (*self, *other) {
- (EventTargetTypeId::Node(this_type), EventTargetTypeId::Node(other_type)) => {
- this_type == other_type
- }
- (EventTargetTypeId::WorkerGlobalScope(this_type),
- EventTargetTypeId::WorkerGlobalScope(other_type)) => {
- this_type == other_type
- }
- (EventTargetTypeId::XMLHttpRequestEventTarget(this_type),
- EventTargetTypeId::XMLHttpRequestEventTarget(other_type)) => {
- this_type == other_type
- }
- (_, _) => {
- unsafe {
- intrinsics::discriminant_value(self) == intrinsics::discriminant_value(other)
- }
- }
- }
- }
-}
-
/// https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler
#[derive(JSTraceable, Clone, PartialEq)]
pub struct InternalRawUncompiledHandler {
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index c8ca4e006b4..3ad8f977869 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -32,7 +32,6 @@ use dom::virtualmethods::VirtualMethods;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::default::Default;
-use std::intrinsics;
use std::rc::Rc;
use string_cache::Atom;
use style::element_state::*;
@@ -488,25 +487,3 @@ impl VirtualMethods for HTMLElement {
self.update_sequentially_focusable_status();
}
}
-
-impl PartialEq for HTMLElementTypeId {
- #[inline]
- #[allow(unsafe_code)]
- fn eq(&self, other: &HTMLElementTypeId) -> bool {
- match (*self, *other) {
- (HTMLElementTypeId::HTMLMediaElement(this_type),
- HTMLElementTypeId::HTMLMediaElement(other_type)) => {
- this_type == other_type
- }
- (HTMLElementTypeId::HTMLTableCellElement(this_type),
- HTMLElementTypeId::HTMLTableCellElement(other_type)) => {
- this_type == other_type
- }
- (_, _) => {
- unsafe {
- intrinsics::discriminant_value(self) == intrinsics::discriminant_value(other)
- }
- }
- }
- }
-}