diff options
author | 2020-02-26 20:35:39 +0100 | |
---|---|---|
committer | 2020-02-26 20:35:39 +0100 | |
commit | 6cb7fb6d52a25dc69f44c0ed1bd8d0254b6b213f (patch) | |
tree | 9abd1b97ac6f28c2f489756cac93cb68ecde2982 /wgpu/src/image.rs | |
parent | 883a9f22e2e868fa0f85b1ac251392c12bf83696 (diff) | |
download | iced-6cb7fb6d52a25dc69f44c0ed1bd8d0254b6b213f.tar.gz iced-6cb7fb6d52a25dc69f44c0ed1bd8d0254b6b213f.tar.bz2 iced-6cb7fb6d52a25dc69f44c0ed1bd8d0254b6b213f.zip |
Remove unused code warnings in `iced_wgpu::image`
Diffstat (limited to 'wgpu/src/image.rs')
-rw-r--r-- | wgpu/src/image.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/wgpu/src/image.rs b/wgpu/src/image.rs index 7155b540..dc19cfbf 100644 --- a/wgpu/src/image.rs +++ b/wgpu/src/image.rs @@ -3,13 +3,16 @@ mod raster; #[cfg(feature = "svg")] mod vector; -use crate::{ - texture::{self, atlas}, - Transformation, -}; +use crate::{texture, Transformation}; use iced_native::{image, svg, Rectangle}; -use std::{cell::RefCell, mem}; +use std::mem; + +#[cfg(any(feature = "image", feature = "svg"))] +use std::cell::RefCell; + +#[cfg(any(feature = "image", feature = "svg"))] +use crate::texture::atlas; #[derive(Debug)] pub struct Pipeline { @@ -271,7 +274,7 @@ impl Pipeline { target: &wgpu::TextureView, _scale: f32, ) { - let mut instances: Vec<Instance> = Vec::new(); + let instances: &mut Vec<Instance> = &mut Vec::new(); #[cfg(feature = "image")] let mut raster_cache = self.raster_cache.borrow_mut(); @@ -290,7 +293,7 @@ impl Pipeline { encoder, &mut self.texture_atlas, ) { - add_instances(image, atlas_entry, &mut instances); + add_instances(image, atlas_entry, instances); } }; } @@ -305,7 +308,7 @@ impl Pipeline { encoder, &mut self.texture_atlas, ) { - add_instances(image, atlas_entry, &mut instances); + add_instances(image, atlas_entry, instances); } }; } @@ -476,6 +479,7 @@ struct Uniforms { transform: [f32; 16], } +#[cfg(any(feature = "image", feature = "svg"))] fn add_instances( image: &Image, entry: &atlas::Entry, @@ -512,6 +516,7 @@ fn add_instances( } } +#[cfg(any(feature = "image", feature = "svg"))] #[inline] fn add_instance( position: [f32; 2], |