Remove unused code warnings in iced_wgpu::image

This commit is contained in:
Héctor Ramón Jiménez 2020-02-26 20:35:39 +01:00
parent 883a9f22e2
commit 6cb7fb6d52

View file

@ -3,13 +3,16 @@ mod raster;
#[cfg(feature = "svg")] #[cfg(feature = "svg")]
mod vector; mod vector;
use crate::{ use crate::{texture, Transformation};
texture::{self, atlas},
Transformation,
};
use iced_native::{image, svg, Rectangle}; 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)] #[derive(Debug)]
pub struct Pipeline { pub struct Pipeline {
@ -271,7 +274,7 @@ impl Pipeline {
target: &wgpu::TextureView, target: &wgpu::TextureView,
_scale: f32, _scale: f32,
) { ) {
let mut instances: Vec<Instance> = Vec::new(); let instances: &mut Vec<Instance> = &mut Vec::new();
#[cfg(feature = "image")] #[cfg(feature = "image")]
let mut raster_cache = self.raster_cache.borrow_mut(); let mut raster_cache = self.raster_cache.borrow_mut();
@ -290,7 +293,7 @@ impl Pipeline {
encoder, encoder,
&mut self.texture_atlas, &mut self.texture_atlas,
) { ) {
add_instances(image, atlas_entry, &mut instances); add_instances(image, atlas_entry, instances);
} }
}; };
} }
@ -305,7 +308,7 @@ impl Pipeline {
encoder, encoder,
&mut self.texture_atlas, &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], transform: [f32; 16],
} }
#[cfg(any(feature = "image", feature = "svg"))]
fn add_instances( fn add_instances(
image: &Image, image: &Image,
entry: &atlas::Entry, entry: &atlas::Entry,
@ -512,6 +516,7 @@ fn add_instances(
} }
} }
#[cfg(any(feature = "image", feature = "svg"))]
#[inline] #[inline]
fn add_instance( fn add_instance(
position: [f32; 2], position: [f32; 2],