Skip to content

Commit

Permalink
Let resolve_color() take its parameter by reference (#116)
Browse files Browse the repository at this point in the history
This way the callers don't have to clone it if they don't have ownership
or want to use the value later.

Signed-off-by: Oriol Brufau <[email protected]>
  • Loading branch information
Loirooriol authored Jan 31, 2025
1 parent 06e3f12 commit 816c355
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions style/properties/properties.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1874,9 +1874,9 @@ impl ComputedValues {
///
/// Usage example:
/// let top_color =
/// style.resolve_color(style.get_border().clone_border_top_color());
/// style.resolve_color(&style.get_border().clone_border_top_color());
#[inline]
pub fn resolve_color(&self, color: computed::Color) -> crate::color::AbsoluteColor {
pub fn resolve_color(&self, color: &computed::Color) -> crate::color::AbsoluteColor {
let current_color = self.get_inherited_text().clone_color();
color.resolve_to_absolute(&current_color)
}
Expand Down
2 changes: 1 addition & 1 deletion style/values/resolved/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl ToResolvedValue for computed::Color {

#[inline]
fn to_resolved_value(self, context: &Context) -> Self::ResolvedValue {
context.style.resolve_color(self)
context.style.resolve_color(&self)
}

#[inline]
Expand Down

0 comments on commit 816c355

Please sign in to comment.