From b31afdedffee07f0d249e80a191e1f4eb5cb1488 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Sun, 17 Dec 2023 16:12:47 +0100 Subject: [PATCH] Allow clippy::pattern_type_mismatch --- wgpu-core/src/device/resource.rs | 2 +- wgpu-core/src/lib.rs | 8 +++----- wgpu-core/src/storage.rs | 2 +- wgpu-core/src/track/range.rs | 4 ++-- wgpu-core/src/track/stateless.rs | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 9e27888f39..5bd92242f2 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3073,7 +3073,7 @@ impl Device { if validated_stages.contains(wgt::ShaderStages::FRAGMENT) { for (i, output) in io.iter() { match color_targets.get(*i as usize) { - Some(&Some(ref state)) => { + Some(Some(state)) => { validation::check_texture_format(state.format, &output.ty).map_err( |pipeline| { pipeline::CreateRenderPipelineError::ColorState( diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 01fd3419a3..78fdcbf6c0 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -34,17 +34,15 @@ // For some reason `rustc` can warn about these in const generics even // though they are required. unused_braces, - // Clashes with clippy::pattern_type_mismatch - clippy::needless_borrowed_reference, + // It gets in the way a lot and does not prevent bugs in practice. + clippy::pattern_type_mismatch, )] #![warn( trivial_casts, trivial_numeric_casts, unsafe_op_in_unsafe_fn, unused_extern_crates, - unused_qualifications, - // We don't match on a reference, unless required. - clippy::pattern_type_mismatch, + unused_qualifications )] pub mod any_surface; diff --git a/wgpu-core/src/storage.rs b/wgpu-core/src/storage.rs index 9b92883917..891b7954e6 100644 --- a/wgpu-core/src/storage.rs +++ b/wgpu-core/src/storage.rs @@ -134,7 +134,7 @@ where pub(crate) fn label_for_invalid_id(&self, id: I) -> &str { let (index, _, _) = id.unzip(); match self.map.get(index as usize) { - Some(&Element::Error(_, ref label)) => label, + Some(Element::Error(_, label)) => label, _ => "", } } diff --git a/wgpu-core/src/track/range.rs b/wgpu-core/src/track/range.rs index 12c527fb2a..3961220c2c 100644 --- a/wgpu-core/src/track/range.rs +++ b/wgpu-core/src/track/range.rs @@ -77,8 +77,8 @@ impl RangedStates { ) -> impl Iterator, &T)> + 'a { self.ranges .iter() - .filter(move |&&(ref inner, ..)| inner.end > range.start && inner.start < range.end) - .map(move |&(ref inner, ref v)| { + .filter(move |&(inner, ..)| inner.end > range.start && inner.start < range.end) + .map(move |(inner, v)| { let new_range = inner.start.max(range.start)..inner.end.min(range.end); (new_range, v) diff --git a/wgpu-core/src/track/stateless.rs b/wgpu-core/src/track/stateless.rs index 747a55db6d..b33905f512 100644 --- a/wgpu-core/src/track/stateless.rs +++ b/wgpu-core/src/track/stateless.rs @@ -42,7 +42,7 @@ impl> StatelessBindGroupSate { let resources = self.resources.lock(); resources .iter() - .map(|&(_, ref resource)| resource.clone()) + .map(|(_, resource)| resource.clone()) .collect::>() .into_iter() }