Skip to content

Commit 90645b6

Browse files
committed
Add attribute to skip formula formatting
Revert rustfmt changes to improve equation readability
1 parent 66d9e9d commit 90645b6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

palette/src/lab.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ where
313313
{
314314
type Scalar = T;
315315

316+
#[rustfmt::skip]
316317
fn get_color_difference(&self, other: &Lab<Wp, T>) -> Self::Scalar {
317318
let c_bar = ((self.a * self.a + self.b * self.b).sqrt()
318319
+ (other.a * other.a + other.b * other.b).sqrt())
@@ -379,10 +380,8 @@ where
379380
let t: T = from_f64::<T>(1.0)
380381
- from_f64::<T>(0.17) * ((h_bar_prime - from_f64(30.0)) * pi_over_180).cos()
381382
+ from_f64::<T>(0.24) * ((h_bar_prime * from_f64(2.0)) * pi_over_180).cos()
382-
+ from_f64::<T>(0.32)
383-
* ((h_bar_prime * from_f64(3.0) + from_f64(6.0)) * pi_over_180).cos()
384-
- from_f64::<T>(0.20)
385-
* ((h_bar_prime * from_f64(4.0) - from_f64(63.0)) * pi_over_180).cos();
383+
+ from_f64::<T>(0.32) * ((h_bar_prime * from_f64(3.0) + from_f64(6.0)) * pi_over_180).cos()
384+
- from_f64::<T>(0.20) * ((h_bar_prime * from_f64(4.0) - from_f64(63.0)) * pi_over_180).cos();
386385
let s_l = from_f64::<T>(1.0)
387386
+ ((from_f64::<T>(0.015) * (l_bar - from_f64(50.0)) * (l_bar - from_f64(50.0)))
388387
/ ((l_bar - from_f64(50.0)) * (l_bar - from_f64(50.0)) + from_f64(20.0)).sqrt());

palette/src/lch.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ where
312312
{
313313
type Scalar = T;
314314

315+
#[rustfmt::skip]
315316
fn get_color_difference(&self, other: &Lch<Wp, T>) -> Self::Scalar {
316317
let self_a = clamp(
317318
self.chroma.max(T::zero()) * self.hue.to_radians().cos(),
@@ -396,10 +397,8 @@ where
396397
let t: T = from_f64::<T>(1.0)
397398
- from_f64::<T>(0.17) * ((h_bar_prime - from_f64(30.0)) * pi_over_180).cos()
398399
+ from_f64::<T>(0.24) * ((h_bar_prime * from_f64(2.0)) * pi_over_180).cos()
399-
+ from_f64::<T>(0.32)
400-
* ((h_bar_prime * from_f64(3.0) + from_f64(6.0)) * pi_over_180).cos()
401-
- from_f64::<T>(0.20)
402-
* ((h_bar_prime * from_f64(4.0) - from_f64(63.0)) * pi_over_180).cos();
400+
+ from_f64::<T>(0.32) * ((h_bar_prime * from_f64(3.0) + from_f64(6.0)) * pi_over_180).cos()
401+
- from_f64::<T>(0.20) * ((h_bar_prime * from_f64(4.0) - from_f64(63.0)) * pi_over_180).cos();
403402
let s_l = from_f64::<T>(1.0)
404403
+ ((from_f64::<T>(0.015) * (l_bar - from_f64(50.0)) * (l_bar - from_f64(50.0)))
405404
/ ((l_bar - from_f64(50.0)) * (l_bar - from_f64(50.0)) + from_f64(20.0)).sqrt());

0 commit comments

Comments
 (0)