Skip to content

Commit e8a702b

Browse files
committed
Prefer readability in field names
1 parent 975d535 commit e8a702b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

common/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,10 @@ impl Flag {
736736
#[cfg_attr(feature = "serde", serde(deny_unknown_fields))]
737737
#[repr(C)]
738738
pub struct Color {
739-
pub r: u8,
740-
pub g: u8,
741-
pub b: u8,
742-
pub a: u8,
739+
pub red: u8,
740+
pub green: u8,
741+
pub blue: u8,
742+
pub alpha: u8,
743743
}
744744

745745
// The following is based on the technique described here:
@@ -1367,13 +1367,13 @@ macro_rules! color_property_methods {
13671367
#[test]
13681368
fn setter_should_update_the_property() {
13691369
let mut node = Node::new(Role::Unknown);
1370-
node.$setter(Color { r: 255, g: 255, b: 255, a: 255 });
1371-
assert_eq!(node.$getter(), Some(Color { r: 255, g: 255, b: 255, a: 255 }));
1370+
node.$setter(Color { red: 255, green: 255, blue: 255, alpha: 255 });
1371+
assert_eq!(node.$getter(), Some(Color { red: 255, green: 255, blue: 255, alpha: 255 }));
13721372
}
13731373
#[test]
13741374
fn clearer_should_reset_the_property() {
13751375
let mut node = Node::new(Role::Unknown);
1376-
node.$setter(Color { r: 255, g: 255, b: 255, a: 255 });
1376+
node.$setter(Color { red: 255, green: 255, blue: 255, alpha: 255 });
13771377
node.$clearer();
13781378
assert!(node.$getter().is_none());
13791379
}

consumer/src/text.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,8 @@ inherited_properties! {
11781178
(language, &'a str, set_language, "en", "fr"),
11791179
(font_size, f64, set_font_size, 12.0, 24.0),
11801180
(font_weight, f64, set_font_weight, 400.0, 700.0),
1181-
(background_color, Color, set_background_color, accesskit::Color { r: 255, g: 255, b: 255, a: 255 }, accesskit::Color { r: 255, g: 0, b: 0, a: 255 }),
1182-
(foreground_color, Color, set_foreground_color, accesskit::Color { r: 0, g: 0, b: 0, a: 255 }, accesskit::Color { r: 0, g: 0, b: 255, a: 255 }),
1181+
(background_color, Color, set_background_color, accesskit::Color { red: 255, green: 255, blue: 255, alpha: 255 }, accesskit::Color { red: 255, green: 0, blue: 0, alpha: 255 }),
1182+
(foreground_color, Color, set_foreground_color, accesskit::Color { red: 0, green: 0, blue: 0, alpha: 255 }, accesskit::Color { red: 0, green: 0, blue: 255, alpha: 255 }),
11831183
(overline, TextDecoration, set_overline, accesskit::TextDecoration::Solid, accesskit::TextDecoration::Dotted),
11841184
(strikethrough, TextDecoration, set_strikethrough, accesskit::TextDecoration::Dotted, accesskit::TextDecoration::Dashed),
11851185
(underline, TextDecoration, set_underline, accesskit::TextDecoration::Dashed, accesskit::TextDecoration::Double),

0 commit comments

Comments
 (0)