mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
A few minor lints and docs (#1436)
* A few minor lints and docs * Added required packages to compile on Debian-style linux * Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline) * a few spelling mistakes * fix fmt
This commit is contained in:
@@ -14,7 +14,7 @@ const OPACITY_PRECISION: usize = 3;
|
||||
|
||||
fn format_opacity(name: &str, opacity: f32) -> String {
|
||||
if (opacity - 1.).abs() > 10_f32.powi(-(OPACITY_PRECISION as i32)) {
|
||||
format!(r#" {}-opacity="{:.precision$}""#, name, opacity, precision = OPACITY_PRECISION)
|
||||
format!(r#" {name}-opacity="{opacity:.OPACITY_PRECISION$}""#)
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
@@ -187,7 +187,7 @@ impl Fill {
|
||||
Self::Solid(color) => format!(r##" fill="#{}"{}"##, color.rgb_hex(), format_opacity("fill", color.a())),
|
||||
Self::Gradient(gradient) => {
|
||||
let gradient_id = gradient.render_defs(svg_defs, multiplied_transform, bounds, transformed_bounds);
|
||||
format!(r##" fill="url('#{}')""##, gradient_id)
|
||||
format!(r##" fill="url('#{gradient_id}')""##)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -533,7 +533,7 @@ impl PathStyle {
|
||||
(_, None) => String::new(),
|
||||
};
|
||||
|
||||
format!("{}{}", fill_attribute, stroke_attribute)
|
||||
format!("{fill_attribute}{stroke_attribute}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ impl Subpath {
|
||||
(true, true, true) => 'C',
|
||||
(false, false, true) => 'L',
|
||||
(_, false, false) => 'Z',
|
||||
_ => panic!("Invalid shape {:#?}", self),
|
||||
_ => panic!("Invalid shape {self:#?}"),
|
||||
};
|
||||
|
||||
// Complete the last curve
|
||||
@@ -567,7 +567,7 @@ impl From<&Subpath> for BezPath {
|
||||
}
|
||||
}
|
||||
[None, None, None] => (PathEl::ClosePath, true),
|
||||
_ => panic!("Invalid path element {:#?}", subpath),
|
||||
_ => panic!("Invalid path element {subpath:#?}"),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user