Skip to content

Commit

Permalink
Revert formatting to no spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Aug 8, 2024
1 parent 8ed8897 commit 402b317
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/core_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,23 +450,23 @@ macro_rules! trait_impls_without_alpha {
};
}

trait_impls_without_alpha!(Rgb, 3, [r, g, b], "rgb({}, {}, {})", "rgb(#{:0w$X}{:0w$X}{:0w$X})", "rgb(#{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Bgr, 3, [b, g, r], "bgr({}, {}, {})", "bgr(#{:0w$X}{:0w$X}{:0w$X})", "bgr(#{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Grb, 3, [g, r, b], "grb({}, {}, {})", "grb(#{:0w$X}{:0w$X}{:0w$X})", "grb(#{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Rgb, 3, [r, g, b], "rgb({},{},{})", "rgb(#{:0w$X}{:0w$X}{:0w$X})", "rgb(#{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Bgr, 3, [b, g, r], "bgr({},{},{})", "bgr(#{:0w$X}{:0w$X}{:0w$X})", "bgr(#{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Grb, 3, [g, r, b], "grb({},{},{})", "grb(#{:0w$X}{:0w$X}{:0w$X})", "grb(#{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Gray_v09, 1, [v], "gray({})", "gray(#{:0w$X})", "gray(#{:0w$x})");
trait_impls_without_alpha!(Rgbw, 4, [r, g, b, w], "rgbw({}, {}, {}, {})", "rgbw(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "rgbw(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_without_alpha!(Rgbw, 4, [r, g, b, w], "rgbw({},{},{},{})", "rgbw(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "rgbw(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");

use crate::formats::gray::Gray_v08;
trait_impls_without_alpha!(Gray_v08, 1, [0], "gray_v0.8({})", "gray_v0.8(#{:0w$X})", "gray_v0.8(#{:0w$x})");

trait_impls_with_alpha!(Rgba, 4, [r, g, b, a], "rgba({}, {}, {}, {})", "rgba(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "rgba(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Argb, 4, [a, r, g, b], "argb({}, {}, {}, {})", "argb(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "argb(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Bgra, 4, [b, g, r, a], "bgra({}, {}, {}, {})", "bgra(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "bgra(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Abgr, 4, [a, b, g, r], "abgr({}, {}, {}, {})", "abgr(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "abgr(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(GrayA, 2, [v, a], "graya({}, {})", "graya(#{:0w$X}{:0w$X})", "graya(#{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Rgba, 4, [r, g, b, a], "rgba({},{},{},{})", "rgba(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "rgba(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Argb, 4, [a, r, g, b], "argb({},{},{},{})", "argb(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "argb(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Bgra, 4, [b, g, r, a], "bgra({},{},{},{})", "bgra(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "bgra(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(Abgr, 4, [a, b, g, r], "abgr({},{},{},{})", "abgr(#{:0w$X}{:0w$X}{:0w$X}{:0w$X})", "abgr(#{:0w$x}{:0w$x}{:0w$x}{:0w$x})");
trait_impls_with_alpha!(GrayA, 2, [v, a], "graya({},{})", "graya(#{:0w$X}{:0w$X})", "graya(#{:0w$x}{:0w$x})");

use crate::formats::gray_alpha::GrayAlpha_v08;
trait_impls_with_alpha!(GrayAlpha_v08, 2, [0, 1], "graya_v0.8({}, {})", "graya_v0.8(#{:0w$X}{:0w$X})", "graya_v0.8(#{:0w$x}{:0w$x})");
trait_impls_with_alpha!(GrayAlpha_v08, 2, [0, 1], "graya_v0.8({},{})", "graya_v0.8(#{:0w$X}{:0w$X})", "graya_v0.8(#{:0w$x}{:0w$x})");

#[cfg(test)]
#[test]
Expand Down
18 changes: 9 additions & 9 deletions src/legacy/internal/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ mod rgb_test {
#[test]
#[allow(deprecated)]
fn test_fmt() {
let red_rgb = RGB::new(255u8, 0, 0);
let red_bgr = BGR::new(255u8, 0, 0);
assert_eq!("rgb(#FF0000)", &format!("{:X}", red_rgb));
assert_eq!("bgr(#0000FF)", &format!("{:X}", red_bgr));
assert_eq!("rgb(#ff0000)", &format!("{:x}", red_rgb));
assert_eq!("bgr(#0000ff)", &format!("{:x}", red_bgr));

assert_eq!("rgb(255, 0, 0)", &format!("{}", red_rgb));
assert_eq!("bgr(0, 0, 255)", &format!("{}", red_bgr));
let red_rgb = RGB::new(255u8, 1, 0);
let red_bgr = BGR::new(255u8, 1, 0);
assert_eq!("rgb(#FF0100)", &format!("{:X}", red_rgb));
assert_eq!("bgr(#0001FF)", &format!("{:X}", red_bgr));
assert_eq!("rgb(#ff0100)", &format!("{:x}", red_rgb));
assert_eq!("bgr(#0001ff)", &format!("{:x}", red_bgr));

assert_eq!("rgb(255,1,0)", &format!("{}", red_rgb));
assert_eq!("bgr(0,1,255)", &format!("{}", red_bgr));
}
}
4 changes: 2 additions & 2 deletions src/legacy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn rgb_works() {
assert_eq!(0xFF, [rgb].as_bytes()[5]);
}

assert_eq!("rgb(1, 2, 3)", format!("{}", RGB::new(1, 2, 3)));
assert_eq!("rgb(1,2,3)", format!("{}", RGB::new(1, 2, 3)));
}

#[test]
Expand Down Expand Up @@ -79,7 +79,7 @@ fn rgba_works() {

assert_eq!(rgba, rgba.iter().map(|ch| ch).collect());

assert_eq!("rgba(1, 2, 3, 4)", format!("{}", RGBA::new(1, 2, 3, 4)));
assert_eq!("rgba(1,2,3,4)", format!("{}", RGBA::new(1, 2, 3, 4)));

assert_eq!(rgba - rgba, RGBA::new(0, 0, 0, 0));
}
Expand Down

0 comments on commit 402b317

Please sign in to comment.