diff --git a/wgpu-bindings/Cargo.toml b/wgpu-bindings/Cargo.toml index c65a44564..c6ef77ba4 100644 --- a/wgpu-bindings/Cargo.toml +++ b/wgpu-bindings/Cargo.toml @@ -5,6 +5,7 @@ authors = [ "Dzmitry Malyshau ", "Joshua Groves ", ] +edition = "2018" [features] default = [] diff --git a/wgpu-native/Cargo.toml b/wgpu-native/Cargo.toml index 1acee3ebc..9a0496e34 100644 --- a/wgpu-native/Cargo.toml +++ b/wgpu-native/Cargo.toml @@ -5,6 +5,7 @@ authors = [ "Dzmitry Malyshau ", "Joshua Groves ", ] +edition = "2018" [lib] crate-type = ["lib", "cdylib", "staticlib"] diff --git a/wgpu-native/src/binding_model.rs b/wgpu-native/src/binding_model.rs index 728926b5a..247b7458c 100644 --- a/wgpu-native/src/binding_model.rs +++ b/wgpu-native/src/binding_model.rs @@ -1,6 +1,6 @@ use hal; -use {BindGroupLayoutId, BufferId, SamplerId, TextureViewId}; +use crate::{BindGroupLayoutId, BufferId, SamplerId, TextureViewId}; bitflags! { #[repr(transparent)] diff --git a/wgpu-native/src/command/allocator.rs b/wgpu-native/src/command/allocator.rs index 8f9cbe233..3d594e74a 100644 --- a/wgpu-native/src/command/allocator.rs +++ b/wgpu-native/src/command/allocator.rs @@ -1,6 +1,6 @@ use super::CommandBuffer; -use track::Tracker; -use {DeviceId, LifeGuard, Stored}; +use crate::track::Tracker; +use crate::{DeviceId, LifeGuard, Stored}; use hal::command::RawCommandBuffer; use hal::pool::RawCommandPool; diff --git a/wgpu-native/src/command/compute.rs b/wgpu-native/src/command/compute.rs index 45e375fe0..3206efbd9 100644 --- a/wgpu-native/src/command/compute.rs +++ b/wgpu-native/src/command/compute.rs @@ -1,5 +1,5 @@ -use registry::{Items, HUB}; -use {BindGroupId, CommandBufferId, ComputePassId, ComputePipelineId, Stored}; +use crate::registry::{Items, HUB}; +use crate::{BindGroupId, CommandBufferId, ComputePassId, ComputePipelineId, Stored}; use hal; use hal::command::RawCommandBuffer; diff --git a/wgpu-native/src/command/mod.rs b/wgpu-native/src/command/mod.rs index f6c95f3ff..6ec2e158b 100644 --- a/wgpu-native/src/command/mod.rs +++ b/wgpu-native/src/command/mod.rs @@ -9,11 +9,11 @@ pub use self::render::*; use hal::command::RawCommandBuffer; use hal::{self, Device}; -use device::{FramebufferKey, RenderPassKey}; -use registry::{Items, HUB}; -use track::{BufferTracker, TextureTracker}; -use {conv, resource}; -use { +use crate::device::{FramebufferKey, RenderPassKey}; +use crate::registry::{Items, HUB}; +use crate::track::{BufferTracker, TextureTracker}; +use crate::{conv, resource}; +use crate::{ BufferId, BufferUsageFlags, Color, CommandBufferId, ComputePassId, DeviceId, LifeGuard, Origin3d, RenderPassId, Stored, TextureId, TextureUsageFlags, TextureViewId, WeaklyStored, B, }; diff --git a/wgpu-native/src/command/render.rs b/wgpu-native/src/command/render.rs index 20cbce235..780f84519 100644 --- a/wgpu-native/src/command/render.rs +++ b/wgpu-native/src/command/render.rs @@ -1,6 +1,6 @@ -use registry::{Items, HUB}; -use track::{BufferTracker, TextureTracker}; -use {CommandBuffer, CommandBufferId, RenderPassId, Stored}; +use crate::registry::{Items, HUB}; +use crate::track::{BufferTracker, TextureTracker}; +use crate::{CommandBuffer, CommandBufferId, RenderPassId, Stored}; use hal; use hal::command::RawCommandBuffer; diff --git a/wgpu-native/src/conv.rs b/wgpu-native/src/conv.rs index 50bd5799a..d77d24006 100644 --- a/wgpu-native/src/conv.rs +++ b/wgpu-native/src/conv.rs @@ -1,13 +1,13 @@ use hal; -use {binding_model, command, pipeline, resource, Color, Extent3d}; +use crate::{binding_model, command, pipeline, resource, Color, Extent3d}; pub fn map_buffer_usage( usage: resource::BufferUsageFlags, ) -> (hal::buffer::Usage, hal::memory::Properties) { use hal::buffer::Usage as U; use hal::memory::Properties as P; - use resource::BufferUsageFlags as W; + use crate::resource::BufferUsageFlags as W; let mut hal_memory = P::empty(); if usage.contains(W::MAP_READ) { @@ -45,7 +45,7 @@ pub fn map_texture_usage( aspects: hal::format::Aspects, ) -> hal::image::Usage { use hal::image::Usage as U; - use resource::TextureUsageFlags as W; + use crate::resource::TextureUsageFlags as W; let mut value = U::empty(); if usage.contains(W::TRANSFER_SRC) { @@ -73,7 +73,7 @@ pub fn map_texture_usage( } pub fn map_binding_type(binding_ty: binding_model::BindingType) -> hal::pso::DescriptorType { - use binding_model::BindingType::*; + use crate::binding_model::BindingType::*; use hal::pso::DescriptorType as H; match binding_ty { UniformBuffer => H::UniformBuffer, @@ -86,7 +86,7 @@ pub fn map_binding_type(binding_ty: binding_model::BindingType) -> hal::pso::Des pub fn map_shader_stage_flags( shader_stage_flags: binding_model::ShaderStageFlags, ) -> hal::pso::ShaderStageFlags { - use binding_model::ShaderStageFlags as F; + use crate::binding_model::ShaderStageFlags as F; use hal::pso::ShaderStageFlags as H; let mut value = H::empty(); @@ -104,7 +104,7 @@ pub fn map_shader_stage_flags( pub fn map_primitive_topology(primitive_topology: pipeline::PrimitiveTopology) -> hal::Primitive { use hal::Primitive as H; - use pipeline::PrimitiveTopology::*; + use crate::pipeline::PrimitiveTopology::*; match primitive_topology { PointList => H::PointList, LineList => H::LineList, @@ -131,7 +131,7 @@ pub fn map_blend_state_descriptor( fn map_color_write_flags(flags: pipeline::ColorWriteFlags) -> hal::pso::ColorMask { use hal::pso::ColorMask as H; - use pipeline::ColorWriteFlags as F; + use crate::pipeline::ColorWriteFlags as F; let mut value = H::empty(); if flags.contains(F::RED) { @@ -151,7 +151,7 @@ fn map_color_write_flags(flags: pipeline::ColorWriteFlags) -> hal::pso::ColorMas fn map_blend_descriptor(blend_desc: &pipeline::BlendDescriptor) -> hal::pso::BlendOp { use hal::pso::BlendOp as H; - use pipeline::BlendOperation::*; + use crate::pipeline::BlendOperation::*; match blend_desc.operation { Add => H::Add { src: map_blend_factor(blend_desc.src_factor), @@ -172,7 +172,7 @@ fn map_blend_descriptor(blend_desc: &pipeline::BlendDescriptor) -> hal::pso::Ble fn map_blend_factor(blend_factor: pipeline::BlendFactor) -> hal::pso::Factor { use hal::pso::Factor as H; - use pipeline::BlendFactor::*; + use crate::pipeline::BlendFactor::*; match blend_factor { Zero => H::Zero, One => H::One, @@ -226,7 +226,7 @@ fn map_stencil_face( fn map_compare_function(compare_function: resource::CompareFunction) -> hal::pso::Comparison { use hal::pso::Comparison as H; - use resource::CompareFunction::*; + use crate::resource::CompareFunction::*; match compare_function { Never => H::Never, Less => H::Less, @@ -241,7 +241,7 @@ fn map_compare_function(compare_function: resource::CompareFunction) -> hal::pso fn map_stencil_operation(stencil_operation: pipeline::StencilOperation) -> hal::pso::StencilOp { use hal::pso::StencilOp as H; - use pipeline::StencilOperation::*; + use crate::pipeline::StencilOperation::*; match stencil_operation { Keep => H::Keep, Zero => H::Zero, @@ -256,7 +256,7 @@ fn map_stencil_operation(stencil_operation: pipeline::StencilOperation) -> hal:: pub fn map_texture_format(texture_format: resource::TextureFormat) -> hal::format::Format { use hal::format::Format as H; - use resource::TextureFormat::*; + use crate::resource::TextureFormat::*; match texture_format { R8g8b8a8Unorm => H::Rgba8Unorm, R8g8b8a8Uint => H::Rgba8Uint, @@ -279,7 +279,7 @@ pub fn map_texture_dimension_size( }: Extent3d, ) -> hal::image::Kind { use hal::image::Kind as H; - use resource::TextureDimension::*; + use crate::resource::TextureDimension::*; match dimension { D1 => { assert_eq!(height, 1); @@ -294,7 +294,7 @@ pub fn map_texture_view_dimension( dimension: resource::TextureViewDimension, ) -> hal::image::ViewKind { use hal::image::ViewKind as H; - use resource::TextureViewDimension::*; + use crate::resource::TextureViewDimension::*; match dimension { D1 => H::D1, D2 => H::D2, @@ -307,7 +307,7 @@ pub fn map_texture_view_dimension( pub fn map_texture_aspect_flags(aspect: resource::TextureAspectFlags) -> hal::format::Aspects { use hal::format::Aspects; - use resource::TextureAspectFlags as Taf; + use crate::resource::TextureAspectFlags as Taf; let mut flags = Aspects::empty(); if aspect.contains(Taf::COLOR) { @@ -324,7 +324,7 @@ pub fn map_texture_aspect_flags(aspect: resource::TextureAspectFlags) -> hal::fo pub fn map_buffer_state(usage: resource::BufferUsageFlags) -> hal::buffer::State { use hal::buffer::Access as A; - use resource::BufferUsageFlags as W; + use crate::resource::BufferUsageFlags as W; let mut access = A::empty(); if usage.contains(W::TRANSFER_SRC) { @@ -354,7 +354,7 @@ pub fn map_texture_state( aspects: hal::format::Aspects, ) -> hal::image::State { use hal::image::{Access as A, Layout as L}; - use resource::TextureUsageFlags as W; + use crate::resource::TextureUsageFlags as W; let is_color = aspects.contains(hal::format::Aspects::COLOR); let layout = match usage { diff --git a/wgpu-native/src/device.rs b/wgpu-native/src/device.rs index dab8caceb..ea32968fe 100644 --- a/wgpu-native/src/device.rs +++ b/wgpu-native/src/device.rs @@ -1,7 +1,7 @@ -use registry::{Items, HUB}; -use track::{BufferTracker, TextureTracker}; -use {back, binding_model, command, conv, pipeline, resource}; -use { +use crate::registry::{Items, HUB}; +use crate::track::{BufferTracker, TextureTracker}; +use crate::{back, binding_model, command, conv, pipeline, resource}; +use crate::{ BindGroupLayoutId, BlendStateId, BufferId, CommandBuffer, CommandBufferId, DepthStencilStateId, DeviceId, LifeGuard, PipelineLayoutId, QueueId, RefCount, RenderPipelineId, ShaderModuleId, Stored, SubmissionIndex, TextureId, TextureUsageFlags, TextureViewId, WeaklyStored, diff --git a/wgpu-native/src/instance.rs b/wgpu-native/src/instance.rs index f73c2f42e..a181f94e2 100644 --- a/wgpu-native/src/instance.rs +++ b/wgpu-native/src/instance.rs @@ -1,7 +1,7 @@ use hal::{self, Instance as _Instance, PhysicalDevice as _PhysicalDevice}; -use registry::{Items, HUB}; -use {AdapterId, Device, DeviceId, InstanceId}; +use crate::registry::{Items, HUB}; +use crate::{AdapterId, Device, DeviceId, InstanceId}; #[repr(C)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] diff --git a/wgpu-native/src/lib.rs b/wgpu-native/src/lib.rs index 7798b503f..064285221 100644 --- a/wgpu-native/src/lib.rs +++ b/wgpu-native/src/lib.rs @@ -40,7 +40,7 @@ pub use self::pipeline::*; pub use self::resource::*; use back::Backend as B; -pub use registry::Id; +pub use crate::registry::Id; use std::ptr; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/wgpu-native/src/pipeline.rs b/wgpu-native/src/pipeline.rs index d3a77f340..b56728f06 100644 --- a/wgpu-native/src/pipeline.rs +++ b/wgpu-native/src/pipeline.rs @@ -1,7 +1,7 @@ use hal; -use resource; +use crate::resource; -use {BlendStateId, ByteArray, DepthStencilStateId, PipelineLayoutId, ShaderModuleId}; +use crate::{BlendStateId, ByteArray, DepthStencilStateId, PipelineLayoutId, ShaderModuleId}; #[repr(C)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] diff --git a/wgpu-native/src/registry/mod.rs b/wgpu-native/src/registry/mod.rs index aec87bce3..af9a5cd03 100644 --- a/wgpu-native/src/registry/mod.rs +++ b/wgpu-native/src/registry/mod.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use parking_lot::RwLock; -use { +use crate::{ AdapterHandle, BindGroupHandle, BindGroupLayoutHandle, BlendStateHandle, BufferHandle, CommandBufferHandle, ComputePassHandle, ComputePipelineHandle, DepthStencilStateHandle, DeviceHandle, InstanceHandle, PipelineLayoutHandle, RenderPassHandle, RenderPipelineHandle, diff --git a/wgpu-native/src/resource.rs b/wgpu-native/src/resource.rs index 64d12d339..3799f17c9 100644 --- a/wgpu-native/src/resource.rs +++ b/wgpu-native/src/resource.rs @@ -1,4 +1,4 @@ -use {DeviceId, Extent3d, LifeGuard, Stored, TextureId}; +use crate::{DeviceId, Extent3d, LifeGuard, Stored, TextureId}; use hal; diff --git a/wgpu-native/src/track.rs b/wgpu-native/src/track.rs index de393b1ed..4f85c9741 100644 --- a/wgpu-native/src/track.rs +++ b/wgpu-native/src/track.rs @@ -1,5 +1,5 @@ -use resource::{BufferUsageFlags, TextureUsageFlags}; -use {BufferId, RefCount, Stored, TextureId, WeaklyStored}; +use crate::resource::{BufferUsageFlags, TextureUsageFlags}; +use crate::{BufferId, RefCount, Stored, TextureId, WeaklyStored}; use std::collections::hash_map::{Entry, HashMap}; use std::hash::Hash; diff --git a/wgpu-rs/Cargo.toml b/wgpu-rs/Cargo.toml index 90880b795..3a64e84e2 100644 --- a/wgpu-rs/Cargo.toml +++ b/wgpu-rs/Cargo.toml @@ -5,6 +5,7 @@ authors = [ "Dzmitry Malyshau ", "Joshua Groves ", ] +edition = "2018" [lib]