mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 13:02:20 +00:00
Resolve most Clippy lint issues
This commit is contained in:
parent
8e769e37f6
commit
70dce1c230
25 changed files with 84 additions and 107 deletions
|
@ -291,7 +291,7 @@ impl GraphicElement {
|
|||
}
|
||||
GraphicElement::ImageFrame(image_frame) => {
|
||||
if image_frame.image.width * image_frame.image.height == 0 {
|
||||
return usvg::Node::Group(Box::new(usvg::Group::default()));
|
||||
return usvg::Node::Group(Box::default());
|
||||
}
|
||||
let png = image_frame.image.to_png();
|
||||
usvg::Node::Image(Box::new(usvg::Image {
|
||||
|
@ -338,7 +338,7 @@ impl GraphicElement {
|
|||
usvg::Node::Group(Box::new(group_element))
|
||||
}
|
||||
// TODO
|
||||
GraphicElement::Artboard(_board) => usvg::Node::Group(Box::new(usvg::Group::default())),
|
||||
GraphicElement::Artboard(_board) => usvg::Node::Group(Box::default()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ impl GraphicElementRendered for GraphicGroup {
|
|||
}
|
||||
|
||||
fn add_click_targets(&self, click_targets: &mut Vec<ClickTarget>) {
|
||||
for element in self.elements.iter().cloned() {
|
||||
for element in self.elements.iter() {
|
||||
let mut new_click_targets = Vec::new();
|
||||
element.add_click_targets(&mut new_click_targets);
|
||||
for click_target in new_click_targets.iter_mut() {
|
||||
|
@ -501,7 +501,7 @@ impl GraphicElementRendered for ImageFrame<Color> {
|
|||
fn to_usvg_node(&self) -> usvg::Node {
|
||||
let image_frame = self;
|
||||
if image_frame.image.width * image_frame.image.height == 0 {
|
||||
return usvg::Node::Group(Box::new(usvg::Group::default()));
|
||||
return usvg::Node::Group(Box::default());
|
||||
}
|
||||
let png = image_frame.image.to_png();
|
||||
usvg::Node::Image(Box::new(usvg::Image {
|
||||
|
|
|
@ -17,5 +17,5 @@ pub struct TextGeneratorNode<Text, FontName, Size> {
|
|||
#[node_fn(TextGeneratorNode)]
|
||||
fn generate_text<'a: 'input, T>(editor: EditorApi<'a, T>, text: String, font_name: Font, font_size: f64) -> crate::vector::VectorData {
|
||||
let buzz_face = editor.font_cache.get(&font_name).map(|data| load_face(data));
|
||||
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, font_size as f64, None))
|
||||
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, font_size, None))
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ pub struct CircleGenerator<Radius> {
|
|||
|
||||
#[node_macro::node_fn(CircleGenerator)]
|
||||
fn circle_generator(_input: (), radius: f64) -> VectorData {
|
||||
let radius: f64 = radius.into();
|
||||
let radius: f64 = radius;
|
||||
super::VectorData::from_subpath(Subpath::new_ellipse(DVec2::splat(-radius), DVec2::splat(radius)))
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ pub struct EllipseGenerator<RadiusX, RadiusY> {
|
|||
|
||||
#[node_macro::node_fn(EllipseGenerator)]
|
||||
fn ellipse_generator(_input: (), radius_x: f64, radius_y: f64) -> VectorData {
|
||||
let radius = DVec2::new(radius_x as f64, radius_y as f64);
|
||||
let radius = DVec2::new(radius_x, radius_y);
|
||||
let corner1 = -radius;
|
||||
let corner2 = radius;
|
||||
super::VectorData::from_subpath(Subpath::new_ellipse(corner1, corner2))
|
||||
|
@ -39,7 +39,7 @@ pub struct RectangleGenerator<SizeX, SizeY> {
|
|||
|
||||
#[node_macro::node_fn(RectangleGenerator)]
|
||||
fn square_generator(_input: (), size_x: f64, size_y: f64) -> VectorData {
|
||||
let size = DVec2::new(size_x as f64, size_y as f64);
|
||||
let size = DVec2::new(size_x, size_y);
|
||||
let corner1 = -size / 2.;
|
||||
let corner2 = size / 2.;
|
||||
|
||||
|
@ -55,7 +55,7 @@ pub struct RegularPolygonGenerator<Points, Radius> {
|
|||
#[node_macro::node_fn(RegularPolygonGenerator)]
|
||||
fn regular_polygon_generator(_input: (), points: u32, radius: f64) -> VectorData {
|
||||
let points = points.into();
|
||||
let radius: f64 = (radius * 2.).into();
|
||||
let radius: f64 = radius * 2.;
|
||||
super::VectorData::from_subpath(Subpath::new_regular_polygon(DVec2::splat(-radius), points, radius))
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ pub struct StarGenerator<Points, Radius, InnerRadius> {
|
|||
#[node_macro::node_fn(StarGenerator)]
|
||||
fn star_generator(_input: (), points: u32, radius: f64, inner_radius: f64) -> VectorData {
|
||||
let points = points.into();
|
||||
let diameter: f64 = (radius * 2.).into();
|
||||
let inner_diameter = (inner_radius * 2.).into();
|
||||
let diameter: f64 = radius * 2.;
|
||||
let inner_diameter = inner_radius * 2.;
|
||||
|
||||
super::VectorData::from_subpath(Subpath::new_star_polygon(DVec2::splat(-diameter), points, diameter, inner_diameter))
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ fn poisson_disk_points(mut vector_data: VectorData, separation_disk_diameter: f6
|
|||
|
||||
subpath.apply_transform(vector_data.transform);
|
||||
|
||||
let points = subpath.poisson_disk_points(separation_disk_diameter, || rng.gen::<f64>()).into_iter().map(|point| point.into());
|
||||
let points = subpath.poisson_disk_points(separation_disk_diameter, || rng.gen::<f64>()).into_iter();
|
||||
*subpath = Subpath::from_anchors(points, false);
|
||||
|
||||
subpath.apply_transform(vector_data.transform.inverse());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue