Simplify range declaration
This commit is contained in:
parent
a95d494f70
commit
56ce01e262
@ -42,19 +42,19 @@ impl Color {
|
|||||||
/// New Color with range checks
|
/// New Color with range checks
|
||||||
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Color {
|
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Color {
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
(0.0f32..=1.0f32).contains(&r),
|
(0.0..=1.0).contains(&r),
|
||||||
"Red component must be on [0, 1]"
|
"Red component must be on [0, 1]"
|
||||||
);
|
);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
(0.0f32..=1.0f32).contains(&g),
|
(0.0..=1.0).contains(&g),
|
||||||
"Green component must be on [0, 1]"
|
"Green component must be on [0, 1]"
|
||||||
);
|
);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
(0.0f32..=1.0f32).contains(&b),
|
(0.0..=1.0).contains(&b),
|
||||||
"Blue component must be on [0, 1]"
|
"Blue component must be on [0, 1]"
|
||||||
);
|
);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
(0.0f32..=1.0f32).contains(&a),
|
(0.0..=1.0).contains(&a),
|
||||||
"Alpha component must be on [0, 1]"
|
"Alpha component must be on [0, 1]"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user