Generate PartialEq automatically

This commit is contained in:
Guillaume Gomez 2016-01-03 18:07:09 +01:00
parent efb145e744
commit 99ac1a81cc
8 changed files with 6 additions and 42 deletions

View file

@ -2339,6 +2339,12 @@ impl IDLInterface for %(name)s {
%(check)s
}
}
impl PartialEq for %(name)s {
fn eq(&self, other: &%(name)s) -> bool {
self as *const %(name)s == &*other
}
}
""" % {'check': check, 'name': name}

View file

@ -208,12 +208,6 @@ pub struct Document {
css_errors_store: DOMRefCell<Vec<CSSError>>,
}
impl PartialEq for Document {
fn eq(&self, other: &Document) -> bool {
self as *const Document == &*other
}
}
#[derive(JSTraceable, HeapSizeOf)]
struct ImagesFilter;
impl CollectionFilter for ImagesFilter {

View file

@ -104,12 +104,6 @@ pub struct Element {
state: Cell<ElementState>,
}
impl PartialEq for Element {
fn eq(&self, other: &Element) -> bool {
self as *const Element == &*other
}
}
#[derive(PartialEq, HeapSizeOf)]
pub enum ElementCreator {
ParserCreated,

View file

@ -53,12 +53,6 @@ pub struct HTMLCanvasElement {
context: DOMRefCell<Option<CanvasContext>>,
}
impl PartialEq for HTMLCanvasElement {
fn eq(&self, other: &HTMLCanvasElement) -> bool {
self as *const HTMLCanvasElement == &*other
}
}
impl HTMLCanvasElement {
fn new_inherited(localName: Atom,
prefix: Option<DOMString>,

View file

@ -46,12 +46,6 @@ pub struct HTMLElement {
dataset: MutNullableHeap<JS<DOMStringMap>>,
}
impl PartialEq for HTMLElement {
fn eq(&self, other: &HTMLElement) -> bool {
self as *const HTMLElement == &*other
}
}
impl HTMLElement {
pub fn new_inherited(tag_name: Atom, prefix: Option<DOMString>,
document: &Document) -> HTMLElement {

View file

@ -45,12 +45,6 @@ pub struct HTMLFormElement {
marked_for_reset: Cell<bool>,
}
impl PartialEq for HTMLFormElement {
fn eq(&self, other: &HTMLFormElement) -> bool {
self as *const HTMLFormElement == &*other
}
}
impl HTMLFormElement {
fn new_inherited(localName: Atom,
prefix: Option<DOMString>,

View file

@ -73,12 +73,6 @@ pub struct HTMLInputElement {
activation_state: DOMRefCell<InputActivationState>,
}
impl PartialEq for HTMLInputElement {
fn eq(&self, other: &HTMLInputElement) -> bool {
self as *const HTMLInputElement == &*other
}
}
#[derive(JSTraceable)]
#[must_root]
#[derive(HeapSizeOf)]

View file

@ -122,12 +122,6 @@ pub struct Node {
unique_id: DOMRefCell<Option<Box<Uuid>>>,
}
impl PartialEq for Node {
fn eq(&self, other: &Node) -> bool {
self as *const Node == &*other
}
}
bitflags! {
#[doc = "Flags for node items."]
#[derive(JSTraceable, HeapSizeOf)]