Compare commits

1 Commits
v0.1.0 ... main

Author SHA1 Message Date
1c1ce85854 fix: resolve clippy warnings for Copy type methods
Some checks failed
CI / test (push) Failing after 9m51s
Change to_* methods to take self by value instead of &self
Since Color implements Copy, these methods should follow
the clippy::wrong_self_convention lint recommendation

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 07:56:00 +01:00

View File

@@ -79,7 +79,7 @@ impl Color {
Color::from_rgb(r + m, g + m, b + m)
}
pub fn to_hex(&self) -> String {
pub fn to_hex(self) -> String {
if self.a < 1.0 {
format!(
"#{:02x}{:02x}{:02x}{:02x}",
@@ -98,7 +98,7 @@ impl Color {
}
}
pub fn to_hsl(&self) -> (f64, f64, f64) {
pub fn to_hsl(self) -> (f64, f64, f64) {
let max = self.r.max(self.g).max(self.b);
let min = self.r.min(self.g).min(self.b);
let delta = max - min;
@@ -128,7 +128,7 @@ impl Color {
(h, s, l)
}
pub fn to_hsv(&self) -> (f64, f64, f64) {
pub fn to_hsv(self) -> (f64, f64, f64) {
let max = self.r.max(self.g).max(self.b);
let min = self.r.min(self.g).min(self.b);
let delta = max - min;
@@ -155,7 +155,7 @@ impl Color {
}
// Convert RGB to XYZ (D65 illuminant)
fn to_xyz(&self) -> (f64, f64, f64) {
fn to_xyz(self) -> (f64, f64, f64) {
let r = if self.r > 0.04045 {
((self.r + 0.055) / 1.055).powf(2.4)
} else {
@@ -181,7 +181,7 @@ impl Color {
(x * 100.0, y * 100.0, z * 100.0)
}
pub fn to_lab(&self) -> (f64, f64, f64) {
pub fn to_lab(self) -> (f64, f64, f64) {
let (x, y, z) = self.to_xyz();
let x = x / 95.047;
@@ -203,7 +203,7 @@ impl Color {
(l, a, b)
}
pub fn to_lch(&self) -> (f64, f64, f64) {
pub fn to_lch(self) -> (f64, f64, f64) {
let (l, a, b) = self.to_lab();
let c = (a * a + b * b).sqrt();
let h = b.atan2(a).to_degrees();