Skip to content

Commit 9ac524d

Browse files
fix: clippy warning large size between variants (#191)
1 parent 8982703 commit 9ac524d

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

packages/blitz-dom/src/document.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ impl BaseDocument {
609609
match kind {
610610
ImageType::Image => {
611611
node.element_data_mut().unwrap().node_specific_data =
612-
NodeSpecificData::Image(Box::new(ImageData::Svg(*tree)));
612+
NodeSpecificData::Image(Box::new(ImageData::Svg(tree)));
613613

614614
// Clear layout cache
615615
node.cache.clear();
@@ -620,7 +620,7 @@ impl BaseDocument {
620620
.and_then(|el| el.background_images.get_mut(idx))
621621
{
622622
bg_image.status = Status::Ok;
623-
bg_image.image = ImageData::Svg(*tree);
623+
bg_image.image = ImageData::Svg(tree);
624624
}
625625
}
626626
}

packages/blitz-dom/src/layout/construct.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ pub(crate) fn collect_layout_children(
8383

8484
#[cfg(feature = "svg")]
8585
if matches!(tag_name, "svg") {
86-
use crate::node::ImageData;
87-
8886
let mut outer_html = doc.get_node(container_node_id).unwrap().outer_html();
8987

9088
// HACK: usvg fails to parse SVGs that don't have the SVG xmlns set. So inject it
@@ -100,8 +98,7 @@ pub(crate) fn collect_layout_children(
10098
.unwrap()
10199
.element_data_mut()
102100
.unwrap()
103-
.node_specific_data =
104-
NodeSpecificData::Image(Box::new(ImageData::Svg(svg)));
101+
.node_specific_data = NodeSpecificData::Image(Box::new(svg.into()));
105102
}
106103
Err(err) => {
107104
println!("{} SVG parse failed", container_node_id);

packages/blitz-dom/src/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ impl RasterImageData {
559559
pub enum ImageData {
560560
Raster(RasterImageData),
561561
#[cfg(feature = "svg")]
562-
Svg(usvg::Tree),
562+
Svg(Box<usvg::Tree>),
563563
None,
564564
}
565565
impl From<Arc<DynamicImage>> for ImageData {
@@ -570,7 +570,7 @@ impl From<Arc<DynamicImage>> for ImageData {
570570
#[cfg(feature = "svg")]
571571
impl From<usvg::Tree> for ImageData {
572572
fn from(value: usvg::Tree) -> Self {
573-
Self::Svg(value)
573+
Self::Svg(Box::new(value))
574574
}
575575
}
576576

packages/blitz-renderer-vello/src/renderer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct ActiveRenderState {
2727
surface: RenderSurface<'static>,
2828
}
2929

30+
#[allow(clippy::large_enum_variant)]
3031
pub enum RenderState {
3132
Active(ActiveRenderState),
3233
Suspended,

0 commit comments

Comments
 (0)