From c442cf148eea61d3636771073aee58a690133c81 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Wed, 5 Dec 2012 20:03:39 +1000 Subject: [PATCH] Fix some silly mistakes --- src/angle.rs | 2 +- src/color/color.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/angle.rs b/src/angle.rs index 1359471..03764da 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -12,7 +12,7 @@ use vec::Vec3; * The base trait for anglular units */ pub trait Angle: Add, - Sub + Sub, Mul, Div, // Div, // TODO: not sure how to implement this, or if it is even possible... diff --git a/src/color/color.rs b/src/color/color.rs index 7fdc813..522556f 100644 --- a/src/color/color.rs +++ b/src/color/color.rs @@ -625,11 +625,11 @@ pub impl HSV: Color { } } -pub impl HSV: MutableColor { +pub impl HSV: MutableColor { #[inline(always)] fn index_mut(&mut self, i: uint) -> &self/mut T { match i { - 0 => , + 0 => fail(~"can't swap the hue component at index 0 in a HSVA type"), 1 => &mut self.s, 2 => &mut self.v, _ => fail(fmt!("index out of bounds: expected an index from 0 to 2, but found %u", i)) @@ -645,7 +645,7 @@ pub impl HSV: MutableColor { #[inline(always)] fn invert_self(&mut self) { - self.h = self.h.inverse(); + self.h = self.h.opposite(); self.s = self.s.inverse(); self.v = self.v.inverse(); } @@ -764,11 +764,11 @@ pub impl HSVA: Color { } } -pub impl HSVA: MutableColor { +pub impl HSVA: MutableColor { #[inline(always)] fn index_mut(&mut self, i: uint) -> &self/mut T { match i { - 0 => , + 0 => fail(~"can't swap the hue component at index 0 in a HSVA type"), 1 => &mut self.s, 2 => &mut self.v, 3 => &mut self.a, @@ -778,14 +778,13 @@ pub impl HSVA: MutableColor { #[inline(always)] fn swap(&mut self, a: uint, b: uint) { - if a != 0 && b != 0 { fail(fmt!("can't swap the hue component (at index 0) in a HSVA type: found a: %u, b: %u", a, b)); } util::swap(self.index_mut(a), self.index_mut(b)); } #[inline(always)] fn invert_self(&mut self) { - self.h = self.h.inverse(); + self.h = self.h.opposite(); self.s = self.s.inverse(); self.v = self.v.inverse(); self.a = self.a.inverse();