From b3dbca40016a22712d883b2775e2ad4647b13108 Mon Sep 17 00:00:00 2001 From: Rua Date: Fri, 25 Aug 2023 03:01:45 +0200 Subject: [PATCH] Rust 1.72 fixes (#2302) --- Cargo.toml | 10 ++-------- examples/src/bin/simple-particles.rs | 7 ++++--- vulkano-util/src/window.rs | 2 +- vulkano/autogen/features.rs | 2 +- vulkano/autogen/formats.rs | 2 +- vulkano/autogen/properties.rs | 2 +- vulkano/src/buffer/mod.rs | 1 - vulkano/src/lib.rs | 1 + vulkano/src/memory/allocator/suballocator.rs | 2 +- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 108ef6c1..0d1d646e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,3 @@ [workspace] -members = [ - "examples", - "vulkano", - "vulkano-macros", - "vulkano-shaders", - "vulkano-util", - "vulkano-win", -] +members = ["examples", "vulkano", "vulkano-macros", "vulkano-shaders", "vulkano-util", "vulkano-win"] +resolver = "2" diff --git a/examples/src/bin/simple-particles.rs b/examples/src/bin/simple-particles.rs index 68cbaf4c..482d815d 100644 --- a/examples/src/bin/simple-particles.rs +++ b/examples/src/bin/simple-particles.rs @@ -508,7 +508,8 @@ fn main() { .unwrap() }; - let mut fences: Vec>>> = vec![None; framebuffers.len()]; + let mut fences: Vec>> = + (0..framebuffers.len()).map(|_| None).collect(); let mut previous_fence_index = 0u32; let start_time = SystemTime::now(); @@ -566,7 +567,7 @@ fn main() { // If the previous image has a fence then use it for synchronization, else create // a new one. - let previous_future = match fences[previous_fence_index as usize].clone() { + let previous_future = match fences[previous_fence_index as usize].take() { // Ensure current frame is synchronized with previous. Some(fence) => fence.boxed(), // Create new future to guarentee synchronization with (fake) previous frame. @@ -629,7 +630,7 @@ fn main() { // Update this frame's future with current fence. fences[image_index as usize] = match future.map_err(Validated::unwrap) { // Success, store result into vector. - Ok(future) => Some(Arc::new(future)), + Ok(future) => Some(future), // Unknown failure. Err(e) => panic!("failed to flush future: {e}"), diff --git a/vulkano-util/src/window.rs b/vulkano-util/src/window.rs index fc014ffc..1a2556a4 100644 --- a/vulkano-util/src/window.rs +++ b/vulkano-util/src/window.rs @@ -150,7 +150,7 @@ impl VulkanoWindows { match winit_window.set_cursor_grab(CursorGrabMode::Confined) { Ok(_) => {} Err(winit::error::ExternalError::NotSupported(_)) => {} - Err(err) => Err(err).unwrap(), + Err(err) => panic!("{:?}", err), } } diff --git a/vulkano/autogen/features.rs b/vulkano/autogen/features.rs index 2fe39cca..59f23523 100644 --- a/vulkano/autogen/features.rs +++ b/vulkano/autogen/features.rs @@ -483,7 +483,7 @@ fn features_output(members: &[FeaturesMember]) -> TokenStream { fn features_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec { let mut features = HashMap::default(); std::iter::once(&types["VkPhysicalDeviceFeatures"]) - .chain(sorted_structs(types).into_iter()) + .chain(sorted_structs(types)) .filter(|(ty, _)| { ty.name.as_deref() == Some("VkPhysicalDeviceFeatures") || ty.structextends.as_deref() diff --git a/vulkano/autogen/formats.rs b/vulkano/autogen/formats.rs index a0dad3a6..1bfddc99 100644 --- a/vulkano/autogen/formats.rs +++ b/vulkano/autogen/formats.rs @@ -810,7 +810,7 @@ fn formats_members( // cgmath only has 1, 2, 3 and 4-component vector types. // Fall back to arrays for anything else. - if matches!(component_count, 1 | 2 | 3 | 4) { + if matches!(component_count, 1..=4) { let ty = format_ident!("{}", format!("Vector{}", component_count)); member.type_cgmath = Some(quote! { cgmath::#ty<#component_type> }); } diff --git a/vulkano/autogen/properties.rs b/vulkano/autogen/properties.rs index 1212dbaf..b3e58bc9 100644 --- a/vulkano/autogen/properties.rs +++ b/vulkano/autogen/properties.rs @@ -147,7 +147,7 @@ fn properties_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec