Eliminate pointless copies of ImageResponseMsg in the image task.

This commit is contained in:
Cameron Zwarich 2014-05-24 21:17:05 -07:00
parent 10d9bad973
commit 853d7c4819

View file

@ -58,13 +58,12 @@ pub enum ImageResponseMsg {
impl Eq for ImageResponseMsg {
fn eq(&self, other: &ImageResponseMsg) -> bool {
// FIXME: Bad copies
match (self.clone(), other.clone()) {
(ImageReady(..), ImageReady(..)) => fail!("unimplemented comparison"),
(ImageNotReady, ImageNotReady) => true,
(ImageFailed, ImageFailed) => true,
match (self, other) {
(&ImageReady(..), &ImageReady(..)) => fail!("unimplemented comparison"),
(&ImageNotReady, &ImageNotReady) => true,
(&ImageFailed, &ImageFailed) => true,
(ImageReady(..), _) | (ImageNotReady, _) | (ImageFailed, _) => false
(&ImageReady(..), _) | (&ImageNotReady, _) | (&ImageFailed, _) => false
}
}