From bae0e70e8d6f869354d1ded35fd24300d829c992 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 14 Feb 2025 13:32:21 +0700 Subject: [PATCH] Fix `clippy::unneeded_struct_pattern` lints (#7136) --- naga/src/back/continue_forward.rs | 4 ++-- naga/src/back/mod.rs | 2 +- naga/src/back/msl/writer.rs | 4 ++-- naga/src/proc/constant_evaluator.rs | 4 +--- naga/tests/wgsl_errors.rs | 2 +- wgpu-core/src/validation.rs | 4 ++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/naga/src/back/continue_forward.rs b/naga/src/back/continue_forward.rs index cecb93a83..b880c1757 100644 --- a/naga/src/back/continue_forward.rs +++ b/naga/src/back/continue_forward.rs @@ -222,7 +222,7 @@ impl ContinueCtx { // forward continue statements within this `Switch`. We can leave // the stack empty. None => None, - Some(&Nesting::Loop { .. }) => { + Some(&Nesting::Loop) => { let variable = Rc::new(namer.call("should_continue")); self.stack.push(Nesting::Switch { variable: Rc::clone(&variable), @@ -253,7 +253,7 @@ impl ContinueCtx { // This doesn't indicate a problem: we don't start pushing entries // for `Switch` statements unless we have an enclosing `Loop`. None => ExitControlFlow::None, - Some(Nesting::Loop { .. }) => { + Some(Nesting::Loop) => { unreachable!("Unexpected loop state when exiting switch"); } Some(Nesting::Switch { diff --git a/naga/src/back/mod.rs b/naga/src/back/mod.rs index e83985300..7e6ca85d4 100644 --- a/naga/src/back/mod.rs +++ b/naga/src/back/mod.rs @@ -263,7 +263,7 @@ impl crate::TypeInner { match *self { crate::TypeInner::Image { .. } | crate::TypeInner::Sampler { .. } - | crate::TypeInner::AccelerationStructure { .. } => true, + | crate::TypeInner::AccelerationStructure => true, _ => false, } } diff --git a/naga/src/back/msl/writer.rs b/naga/src/back/msl/writer.rs index cc58693f5..5815499a4 100644 --- a/naga/src/back/msl/writer.rs +++ b/naga/src/back/msl/writer.rs @@ -5286,13 +5286,13 @@ template LocationMode::VertexOutput, true, ), - crate::ShaderStage::Fragment { .. } => ( + crate::ShaderStage::Fragment => ( "fragment", LocationMode::FragmentInput, LocationMode::FragmentOutput, false, ), - crate::ShaderStage::Compute { .. } => ( + crate::ShaderStage::Compute => ( "kernel", LocationMode::Uniform, LocationMode::Uniform, diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index bf97bedc3..fcb325f53 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -957,9 +957,7 @@ impl<'a> ConstantEvaluator<'a> { Expression::RayQueryProceedResult | Expression::RayQueryGetIntersection { .. } => { Err(ConstantEvaluatorError::RayQueryExpression) } - Expression::SubgroupBallotResult { .. } => { - Err(ConstantEvaluatorError::SubgroupExpression) - } + Expression::SubgroupBallotResult => Err(ConstantEvaluatorError::SubgroupExpression), Expression::SubgroupOperationResult { .. } => { Err(ConstantEvaluatorError::SubgroupExpression) } diff --git a/naga/tests/wgsl_errors.rs b/naga/tests/wgsl_errors.rs index c54acf37f..2dcd0588c 100644 --- a/naga/tests/wgsl_errors.rs +++ b/naga/tests/wgsl_errors.rs @@ -1107,7 +1107,7 @@ fn invalid_functions() { Err(naga::valid::ValidationError::Type { source: naga::valid::TypeError::InvalidPointerToUnsized { base: _, - space: naga::AddressSpace::WorkGroup { .. }, + space: naga::AddressSpace::WorkGroup, }, .. }) diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index 2fd1e1495..236675b8a 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -35,7 +35,7 @@ impl From<&ResourceType> for BindingTypeName { ResourceType::Buffer { .. } => BindingTypeName::Buffer, ResourceType::Texture { .. } => BindingTypeName::Texture, ResourceType::Sampler { .. } => BindingTypeName::Sampler, - ResourceType::AccelerationStructure { .. } => BindingTypeName::AccelerationStructure, + ResourceType::AccelerationStructure => BindingTypeName::AccelerationStructure, } } } @@ -47,7 +47,7 @@ impl From<&BindingType> for BindingTypeName { BindingType::Texture { .. } => BindingTypeName::Texture, BindingType::StorageTexture { .. } => BindingTypeName::Texture, BindingType::Sampler { .. } => BindingTypeName::Sampler, - BindingType::AccelerationStructure { .. } => BindingTypeName::AccelerationStructure, + BindingType::AccelerationStructure => BindingTypeName::AccelerationStructure, } } }