diff --git a/ash/Cargo.toml b/ash/Cargo.toml index 0e2bb56..2d2fec2 100644 --- a/ash/Cargo.toml +++ b/ash/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/MaikKlein/ash" readme = "../README.md" keywords = ["vulkan", "graphic"] documentation = "https://docs.rs/ash" +edition = "2018" [dependencies] shared_library = "0.1.9" diff --git a/ash/src/device.rs b/ash/src/device.rs index 5684678..c2ef365 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; use std::mem; use std::os::raw::c_void; use std::ptr; -use vk; -use RawPtr; #[allow(non_camel_case_types)] pub trait DeviceV1_1: DeviceV1_0 { diff --git a/ash/src/entry.rs b/ash/src/entry.rs index ca6cef3..be3d52d 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -1,5 +1,7 @@ -use instance::Instance; -use prelude::*; +use crate::instance::Instance; +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; use shared_library::dynamic_library::DynamicLibrary; use std::error::Error; use std::fmt; @@ -9,8 +11,6 @@ use std::os::raw::c_void; use std::path::Path; use std::ptr; use std::sync::Arc; -use vk; -use RawPtr; #[cfg(windows)] const LIB_PATH: &'static str = "vulkan-1.dll"; diff --git a/ash/src/extensions/experimental/amd.rs b/ash/src/extensions/experimental/amd.rs index a68f057..33292c3 100644 --- a/ash/src/extensions/experimental/amd.rs +++ b/ash/src/extensions/experimental/amd.rs @@ -23,9 +23,9 @@ * **********************************************************************************************************************/ +use crate::vk::*; use std::fmt; use std::os::raw::*; -use vk::*; // Extension: `VK_AMD_gpa_interface` diff --git a/ash/src/extensions/ext/debug_marker.rs b/ash/src/extensions/ext/debug_marker.rs index 11f6ce6..eeead34 100644 --- a/ash/src/extensions/ext/debug_marker.rs +++ b/ash/src/extensions/ext/debug_marker.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{DeviceV1_0, InstanceV1_0}; +use crate::vk; use std::ffi::CStr; use std::mem; -use version::{DeviceV1_0, InstanceV1_0}; -use vk; #[derive(Clone)] pub struct DebugMarker { diff --git a/ash/src/extensions/ext/debug_report.rs b/ash/src/extensions/ext/debug_report.rs index 1d50117..e22cb73 100644 --- a/ash/src/extensions/ext/debug_report.rs +++ b/ash/src/extensions/ext/debug_report.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; -use version::{EntryV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct DebugReport { diff --git a/ash/src/extensions/ext/debug_utils.rs b/ash/src/extensions/ext/debug_utils.rs index a8acffd..8760121 100644 --- a/ash/src/extensions/ext/debug_utils.rs +++ b/ash/src/extensions/ext/debug_utils.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::{vk, RawPtr}; use std::ffi::CStr; use std::mem; -use version::{EntryV1_0, InstanceV1_0}; -use {vk, RawPtr}; #[derive(Clone)] pub struct DebugUtils { diff --git a/ash/src/extensions/khr/android_surface.rs b/ash/src/extensions/khr/android_surface.rs index d9d343d..c9286e2 100644 --- a/ash/src/extensions/khr/android_surface.rs +++ b/ash/src/extensions/khr/android_surface.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; -use version::{EntryV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct AndroidSurface { diff --git a/ash/src/extensions/khr/display_swapchain.rs b/ash/src/extensions/khr/display_swapchain.rs index 29c3b5d..c11690b 100644 --- a/ash/src/extensions/khr/display_swapchain.rs +++ b/ash/src/extensions/khr/display_swapchain.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{DeviceV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; -use version::{DeviceV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct DisplaySwapchain { diff --git a/ash/src/extensions/khr/surface.rs b/ash/src/extensions/khr/surface.rs index 03e4867..2ff85b6 100644 --- a/ash/src/extensions/khr/surface.rs +++ b/ash/src/extensions/khr/surface.rs @@ -1,11 +1,11 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; use std::ptr; -use version::{EntryV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct Surface { diff --git a/ash/src/extensions/khr/swapchain.rs b/ash/src/extensions/khr/swapchain.rs index ade5d04..1470246 100644 --- a/ash/src/extensions/khr/swapchain.rs +++ b/ash/src/extensions/khr/swapchain.rs @@ -1,11 +1,11 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{DeviceV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; use std::ptr; -use version::{DeviceV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct Swapchain { diff --git a/ash/src/extensions/mvk/ios_surface.rs b/ash/src/extensions/mvk/ios_surface.rs index 4aac1c5..c86f439 100644 --- a/ash/src/extensions/mvk/ios_surface.rs +++ b/ash/src/extensions/mvk/ios_surface.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; -use version::{EntryV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct IOSSurface { diff --git a/ash/src/extensions/mvk/macos_surface.rs b/ash/src/extensions/mvk/macos_surface.rs index 9dbf44b..992f864 100644 --- a/ash/src/extensions/mvk/macos_surface.rs +++ b/ash/src/extensions/mvk/macos_surface.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; -use version::{EntryV1_0, InstanceV1_0}; -use vk; -use RawPtr; #[derive(Clone)] pub struct MacOSSurface { diff --git a/ash/src/extensions/nv/mesh_shader.rs b/ash/src/extensions/nv/mesh_shader.rs index c982951..20e3fea 100644 --- a/ash/src/extensions/nv/mesh_shader.rs +++ b/ash/src/extensions/nv/mesh_shader.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] +use crate::version::{DeviceV1_0, InstanceV1_0}; +use crate::vk; use std::ffi::CStr; use std::mem; -use version::{DeviceV1_0, InstanceV1_0}; -use vk; #[derive(Clone)] pub struct MeshShader { diff --git a/ash/src/extensions/nv/ray_tracing.rs b/ash/src/extensions/nv/ray_tracing.rs index 02aa71f..591aa6a 100644 --- a/ash/src/extensions/nv/ray_tracing.rs +++ b/ash/src/extensions/nv/ray_tracing.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] -use prelude::*; +use crate::prelude::*; +use crate::version::{DeviceV1_0, InstanceV1_0, InstanceV1_1}; +use crate::vk; +use crate::RawPtr; use std::ffi::CStr; use std::mem; -use version::{DeviceV1_0, InstanceV1_0, InstanceV1_1}; -use vk; -use RawPtr; #[derive(Clone)] pub struct RayTracing { diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 4db5ceb..1cb3bf1 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -1,11 +1,11 @@ #![allow(dead_code)] -use device::Device; -use prelude::*; +use crate::device::Device; +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; use std::mem; use std::os::raw::c_char; use std::ptr; -use vk; -use RawPtr; #[doc = ""] #[derive(Clone)] diff --git a/ash/src/lib.rs b/ash/src/lib.rs index d6e5fc2..caa2ad3 100644 --- a/ash/src/lib.rs +++ b/ash/src/lib.rs @@ -23,11 +23,9 @@ //! ``` //! -extern crate shared_library; - -pub use device::Device; -pub use entry::{Entry, EntryCustom, InstanceError, LoadingError}; -pub use instance::Instance; +pub use crate::device::Device; +pub use crate::entry::{Entry, EntryCustom, InstanceError, LoadingError}; +pub use crate::instance::Instance; mod device; mod entry; diff --git a/ash/src/prelude.rs b/ash/src/prelude.rs index a01406c..b4a888c 100644 --- a/ash/src/prelude.rs +++ b/ash/src/prelude.rs @@ -1,2 +1,2 @@ -use vk; +use crate::vk; pub type VkResult = Result; diff --git a/ash/src/util.rs b/ash/src/util.rs index 178da36..d2f50d5 100644 --- a/ash/src/util.rs +++ b/ash/src/util.rs @@ -1,9 +1,9 @@ +use crate::vk; use std::iter::Iterator; use std::marker::PhantomData; use std::mem::size_of; use std::os::raw::c_void; use std::{io, slice}; -use vk; /// `Align` handles dynamic alignment. The is useful for dynamic uniform buffers where /// the alignment might be different. For example a 4x4 f32 matrix has a size of 64 bytes diff --git a/ash/src/version.rs b/ash/src/version.rs index 922f6bf..e6121a8 100644 --- a/ash/src/version.rs +++ b/ash/src/version.rs @@ -1,3 +1,3 @@ -pub use device::{DeviceV1_0, DeviceV1_1}; -pub use entry::{EntryV1_0, EntryV1_1}; -pub use instance::{InstanceV1_0, InstanceV1_1}; +pub use crate::device::{DeviceV1_0, DeviceV1_1}; +pub use crate::entry::{EntryV1_0, EntryV1_1}; +pub use crate::instance::{InstanceV1_0, InstanceV1_1}; diff --git a/ash/src/vk.rs b/ash/src/vk.rs index bcd41b8..711b0e4 100644 --- a/ash/src/vk.rs +++ b/ash/src/vk.rs @@ -18,7 +18,7 @@ pub(crate) unsafe fn ptr_chain_iter(ptr: &mut T) -> impl Iterator u64; - fn from_raw(u64) -> Self; + fn from_raw(_: u64) -> Self; } #[doc = ""] #[macro_export] @@ -85,19 +85,19 @@ macro_rules! vk_bitflags_wrapped { } impl $name { #[inline] - pub fn empty() -> $name { + pub const fn empty() -> $name { $name(0) } #[inline] - pub fn all() -> $name { + pub const fn all() -> $name { $name($all) } #[inline] - pub fn from_raw(x: $flag_type) -> Self { + pub const fn from_raw(x: $flag_type) -> Self { $name(x) } #[inline] - pub fn as_raw(self) -> $flag_type { + pub const fn as_raw(self) -> $flag_type { self.0 } #[inline] @@ -199,7 +199,7 @@ macro_rules! handle_nondispatchable { } } impl $name { - pub fn null() -> $name { + pub const fn null() -> $name { $name(0) } } @@ -242,7 +242,7 @@ macro_rules! define_handle { unsafe impl Send for $name {} unsafe impl Sync for $name {} impl $name { - pub fn null() -> Self { + pub const fn null() -> Self { $name(::std::ptr::null_mut()) } } diff --git a/ash/tests/constant_size_arrays.rs b/ash/tests/constant_size_arrays.rs index f736c0a..74378e9 100644 --- a/ash/tests/constant_size_arrays.rs +++ b/ash/tests/constant_size_arrays.rs @@ -1,4 +1,4 @@ -extern crate ash; +use ash; use ash::vk::{PhysicalDeviceProperties, PipelineColorBlendStateCreateInfo}; diff --git a/ash/tests/display.rs b/ash/tests/display.rs index 8746022..f4131fd 100644 --- a/ash/tests/display.rs +++ b/ash/tests/display.rs @@ -1,4 +1,3 @@ -extern crate ash; use ash::vk; #[test] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 1ff2abf..27c4cea 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -2,6 +2,7 @@ name = "examples" version = "0.1.0" authors = ["maik klein "] +edition = "2018" [dependencies] winit = "0.16" diff --git a/examples/src/bin/texture.rs b/examples/src/bin/texture.rs index 42664a5..3fd0976 100644 --- a/examples/src/bin/texture.rs +++ b/examples/src/bin/texture.rs @@ -1,7 +1,3 @@ -extern crate ash; -extern crate examples; -extern crate image; - use std::default::Default; use std::ffi::CString; use std::fs::File; diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index 0104344..936dea5 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -1,6 +1,3 @@ -extern crate ash; -extern crate examples; - use ash::util::*; use ash::vk; use examples::*; diff --git a/generator/Cargo.toml b/generator/Cargo.toml index 12ffbd5..215d66b 100644 --- a/generator/Cargo.toml +++ b/generator/Cargo.toml @@ -2,6 +2,7 @@ name = "generator" version = "0.1.0" authors = ["Maik Klein "] +edition = "2018" [dependencies] vk-parse = "0.2" diff --git a/generator/src/bin/generator.rs b/generator/src/bin/generator.rs index c639a2a..42d33ff 100644 --- a/generator/src/bin/generator.rs +++ b/generator/src/bin/generator.rs @@ -1,4 +1,3 @@ -extern crate generator; use generator::write_source_code; use std::path::Path; diff --git a/generator/src/lib.rs b/generator/src/lib.rs index a63ca4a..9c0587b 100644 --- a/generator/src/lib.rs +++ b/generator/src/lib.rs @@ -1,14 +1,13 @@ #![recursion_limit = "256"] -extern crate heck; -extern crate itertools; + #[macro_use] extern crate nom; -extern crate proc_macro2; +use proc_macro2; #[macro_use] extern crate quote; -extern crate syn; -pub extern crate vk_parse; -pub extern crate vkxml; +use syn; +pub use vk_parse; +pub use vkxml; use heck::{CamelCase, ShoutySnakeCase, SnakeCase}; use itertools::Itertools; @@ -122,7 +121,7 @@ pub fn define_handle_macro() -> Tokens { unsafe impl Sync for $name {} impl $name{ - pub fn null() -> Self{ + pub const fn null() -> Self{ $name(::std::ptr::null_mut()) } } @@ -163,7 +162,7 @@ pub fn handle_nondispatchable_macro() -> Tokens { } impl $name{ - pub fn null() -> $name{ + pub const fn null() -> $name{ $name(0) } } @@ -232,20 +231,20 @@ pub fn vk_bitflags_wrapped_macro() -> Tokens { impl $name { #[inline] - pub fn empty() -> $name { + pub const fn empty() -> $name { $name(0) } #[inline] - pub fn all() -> $name { + pub const fn all() -> $name { $name($all) } #[inline] - pub fn from_raw(x: $flag_type) -> Self { $name(x) } + pub const fn from_raw(x: $flag_type) -> Self { $name(x) } #[inline] - pub fn as_raw(self) -> $flag_type { self.0 } + pub const fn as_raw(self) -> $flag_type { self.0 } #[inline] pub fn is_empty(self) -> bool { @@ -1432,7 +1431,7 @@ pub fn derive_setters( _ => None, }); - let (has_next, is_next_const) = match members + let (has_next, _is_next_const) = match members .clone() .find(|field| field.param_ident().to_string() == "p_next") { @@ -2275,7 +2274,7 @@ pub fn write_source_code(path: &Path) { pub trait Handle { const TYPE: ObjectType; fn as_raw(self) -> u64; - fn from_raw(u64) -> Self; + fn from_raw(_: u64) -> Self; } #version_macros