[librsvg: 1/5] Don't derive Copy for FontSize/LetterSpacing/LineHeight




commit c46eb556780798ca882a286c536689ce387c7e05
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Jul 12 12:58:53 2021 -0500

    Don't derive Copy for FontSize/LetterSpacing/LineHeight
    
    Clippy said this:
    
    warning: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take 
`self` by value
       --> src/font_props.rs:451:20
        |
    451 |     pub fn to_user(&self, params: &NormalizeParams) -> f64 {
        |                    ^^^^^
        |
        = help: consider choosing a less ambiguous name
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
    
    as it prefers "to_foo(self) -> Owned" for self types that are Copy.
    However, having to_user() appear to consume the self makes me
    uncomfortable (even if the type is Copy).
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/570>

 src/font_props.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/font_props.rs b/src/font_props.rs
index 161c3a7d..d081f85e 100644
--- a/src/font_props.rs
+++ b/src/font_props.rs
@@ -178,7 +178,7 @@ fn parse_font_spec_identifiers<'i>(parser: &mut Parser<'i, '_>) -> Result<Font,
 ///
 /// https://www.w3.org/TR/css-fonts-3/#font-size-prop
 #[allow(clippy::upper_case_acronyms)]
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum FontSize {
     Smaller,
     Larger,
@@ -371,7 +371,7 @@ impl FontWeight {
 /// https://www.w3.org/TR/SVG/text.html#LetterSpacingProperty
 ///
 /// https://www.w3.org/TR/css-text-3/#letter-spacing-property
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum LetterSpacing {
     Normal,
     Value(Length<Horizontal>),
@@ -418,7 +418,7 @@ impl Parse for LetterSpacing {
 /// https://drafts.csswg.org/css2/visudet.html#propdef-line-height
 ///
 /// https://www.w3.org/TR/CSS2/visudet.html#propdef-line-height
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum LineHeight {
     Normal,
     Number(f32),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]